import * as i0 from '@angular/core';
import { ViewContainerRef, Component, ChangeDetectionStrategy, Input, ViewChild, NgModule } from '@angular/core';
import * as i1 from '@vendure/admin-ui/core';
import { titleSetter, GetLatestOrdersDocument, SortOrder, CoreModule, SharedModule, MetricType, GetOrderChartDataDocument, GetOrderSummaryDocument, Permission, ADMIN_UI_VERSION, getAppConfig } from '@vendure/admin-ui/core';
import { assertNever } from '@vendure/common/lib/shared-utils';
import { map, tap, distinctUntilChanged, startWith, shareReplay, switchMap as switchMap$1 } from 'rxjs/operators';
import * as i2$1 from '@clr/angular';
import * as i3 from '@angular/common';
import * as i4 from '@angular/cdk/drag-drop';
import * as i2 from '@ngx-translate/core';
import * as i3$1 from '@angular/router';
import { RouterModule } from '@angular/router';
import { marker } from '@biesbjerg/ngx-translate-extract-marker';
import { gql } from 'apollo-angular';
import { Subject, BehaviorSubject, combineLatest, switchMap } from 'rxjs';
import dayjs from 'dayjs';

class DashboardWidgetComponent {
    ngAfterViewInit() {
        this.loadWidget();
    }
    async loadWidget() {
        const loadComponentResult = this.widgetConfig.loadComponent();
        const componentType = loadComponentResult instanceof Promise ? await loadComponentResult : loadComponentResult;
        this.componentRef = this.portal.createComponent(componentType);
        this.componentRef.changeDetectorRef.detectChanges();
    }
    ngOnDestroy() {
        if (this.componentRef) {
            this.componentRef.destroy();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DashboardWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: DashboardWidgetComponent, selector: "vdr-dashboard-widget", inputs: { widgetConfig: "widgetConfig" }, viewQueries: [{ propertyName: "portal", first: true, predicate: ["portal"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<vdr-card [title]=\"widgetConfig.title ?? '' | translate\">\n    <ng-template vdrCardControls>\n        <ng-content></ng-content>\n    </ng-template>\n    <ng-template #portal></ng-template>\n</vdr-card>\n", styles: [":host{display:block}.card{margin-top:0;min-height:200px}.card-header{display:flex;justify-content:space-between}\n"], dependencies: [{ kind: "component", type: i1.CardComponent, selector: "vdr-card", inputs: ["title", "paddingX"] }, { kind: "directive", type: i1.CardControlsDirective, selector: "[vdrCardControls]" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DashboardWidgetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-dashboard-widget', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-card [title]=\"widgetConfig.title ?? '' | translate\">\n    <ng-template vdrCardControls>\n        <ng-content></ng-content>\n    </ng-template>\n    <ng-template #portal></ng-template>\n</vdr-card>\n", styles: [":host{display:block}.card{margin-top:0;min-height:200px}.card-header{display:flex;justify-content:space-between}\n"] }]
        }], propDecorators: { widgetConfig: [{
                type: Input
            }], portal: [{
                type: ViewChild,
                args: ['portal', { read: ViewContainerRef }]
            }] } });

class DashboardComponent {
    constructor(dashboardWidgetService, localStorageService, changedDetectorRef, dataService) {
        this.dashboardWidgetService = dashboardWidgetService;
        this.localStorageService = localStorageService;
        this.changedDetectorRef = changedDetectorRef;
        this.dataService = dataService;
        this.deletionMarker = '__delete__';
        this.setTitle = titleSetter();
    }
    ngOnInit() {
        this.availableWidgets$ = this.dataService.client.userStatus().stream$.pipe(map(({ userStatus }) => userStatus.permissions), map(permissions => this.dashboardWidgetService.getAvailableWidgets(permissions)), tap(widgets => (this.widgetLayout = this.initLayout(widgets.map(w => w.id)))));
        this.setTitle('breadcrumb.dashboard');
    }
    getClassForWidth(width) {
        switch (width) {
            case 3:
                return `clr-col-12 clr-col-sm-6 clr-col-lg-3`;
            case 4:
                return `clr-col-12 clr-col-sm-6 clr-col-lg-4`;
            case 6:
                return `clr-col-12 clr-col-lg-6`;
            case 8:
                return `clr-col-12 clr-col-lg-8`;
            case 12:
                return `clr-col-12`;
            default:
                assertNever(width);
        }
    }
    getSupportedWidths(config) {
        return config.supportedWidths || [3, 4, 6, 8, 12];
    }
    setWidgetWidth(widget, width) {
        widget.width = width;
        this.recalculateLayout();
    }
    trackRow(index, row) {
        const id = row.map(item => `${item.id}:${item.width}`).join('|');
        return id;
    }
    trackRowItem(index, item) {
        return item.config;
    }
    addWidget(id) {
        const config = this.dashboardWidgetService.getWidgetById(id);
        if (config) {
            const width = this.getSupportedWidths(config)[0];
            const widget = {
                id,
                config,
                width,
            };
            let targetRow;
            if (this.widgetLayout && this.widgetLayout.length) {
                targetRow = this.widgetLayout[this.widgetLayout.length - 1];
            }
            else {
                targetRow = [];
                this.widgetLayout?.push(targetRow);
            }
            targetRow.push(widget);
            this.recalculateLayout();
        }
    }
    removeWidget(widget) {
        widget.id = this.deletionMarker;
        this.recalculateLayout();
    }
    drop(event) {
        const { currentIndex, previousIndex, previousContainer, container } = event;
        if (previousIndex === currentIndex && previousContainer.data.index === container.data.index) {
            // Nothing changed
            return;
        }
        if (this.widgetLayout) {
            const previousLayoutRow = this.widgetLayout[previousContainer.data.index];
            const newLayoutRow = this.widgetLayout[container.data.index];
            previousLayoutRow.splice(previousIndex, 1);
            newLayoutRow.splice(currentIndex, 0, event.item.data);
            this.recalculateLayout();
        }
    }
    initLayout(availableIds) {
        const savedLayoutDef = this.localStorageService.get('dashboardWidgetLayout');
        let layoutDef;
        if (savedLayoutDef) {
            // validate all the IDs from the saved layout are still available
            layoutDef = savedLayoutDef.filter(item => availableIds.includes(item.id));
        }
        return this.dashboardWidgetService.getWidgetLayout(layoutDef);
    }
    recalculateLayout() {
        if (this.widgetLayout) {
            const flattened = this.widgetLayout
                .reduce((flat, row) => [...flat, ...row], [])
                .filter(item => item.id !== this.deletionMarker);
            const newLayoutDef = flattened.map(item => ({
                id: item.id,
                width: item.width,
            }));
            this.widgetLayout = this.dashboardWidgetService.getWidgetLayout(newLayoutDef);
            this.localStorageService.set('dashboardWidgetLayout', newLayoutDef);
            setTimeout(() => this.changedDetectorRef.markForCheck());
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DashboardComponent, deps: [{ token: i1.DashboardWidgetService }, { token: i1.LocalStorageService }, { token: i0.ChangeDetectorRef }, { token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: DashboardComponent, selector: "vdr-dashboard", ngImport: i0, template: "<vdr-page-block>\n    <div class=\"widget-header mb-1\">\n        <vdr-dropdown>\n            <button class=\"btn btn-secondary btn-sm\" vdrDropdownTrigger>\n                <clr-icon shape=\"plus\"></clr-icon>\n                {{ 'dashboard.add-widget' | translate }}\n                <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n            </button>\n            <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n                <button\n                    vdrDropdownItem\n                    *ngFor=\"let widget of availableWidgets$ | async\"\n                    (click)=\"addWidget(widget.id)\"\n                >\n                    {{ (widget.config.title ?? widget.id) | translate }}\n                </button>\n            </vdr-dropdown-menu>\n        </vdr-dropdown>\n    </div>\n    <div cdkDropListGroup>\n        <div\n            class=\"clr-row dashboard-row\"\n            *ngFor=\"let row of widgetLayout; index as rowIndex; trackBy: trackRow\"\n            cdkDropList\n            (cdkDropListDropped)=\"drop($event)\"\n            cdkDropListOrientation=\"horizontal\"\n            [cdkDropListData]=\"{ index: rowIndex }\"\n        >\n            <div\n                *ngFor=\"let widget of row; trackBy: trackRowItem\"\n                class=\"dashboard-item\"\n                [ngClass]=\"getClassForWidth(widget.width)\"\n                cdkDrag\n                [cdkDragData]=\"widget\"\n            >\n                <vdr-dashboard-widget\n                    *vdrIfPermissions=\"widget.config.requiresPermissions || null\"\n                    [widgetConfig]=\"widget.config\"\n                >\n                    <div class=\"flex\">\n                        <div class=\"drag-handle\" cdkDragHandle>\n                            <clr-icon shape=\"drag-handle\" size=\"24\"></clr-icon>\n                        </div>\n                        <vdr-dropdown>\n                            <button class=\"icon-button\" vdrDropdownTrigger>\n                                <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n                            </button>\n                            <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n                                <h4 class=\"dropdown-header\">{{ 'dashboard.widget-resize' | translate }}</h4>\n                                <button\n                                    vdrDropdownItem\n                                    [disabled]=\"width === widget.width\"\n                                    *ngFor=\"let width of getSupportedWidths(widget.config)\"\n                                    (click)=\"setWidgetWidth(widget, width)\"\n                                >\n                                    {{ 'dashboard.widget-width' | translate : { width: width } }}\n                                </button>\n                                <div class=\"dropdown-divider\" role=\"separator\"></div>\n                                <button vdrDropdownItem (click)=\"removeWidget(widget)\">\n                                    <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\n                                    {{ 'dashboard.remove-widget' | translate }}\n                                </button>\n                            </vdr-dropdown-menu>\n                        </vdr-dropdown>\n                    </div>\n                </vdr-dashboard-widget>\n            </div>\n        </div>\n    </div>\n</vdr-page-block>\n", styles: [".widget-header{display:flex;justify-content:flex-end}.placeholder{color:var(--color-grey-300);text-align:center}.placeholder .version{font-size:3em;margin:24px;line-height:1em}.placeholder ::ng-deep .clr-i-outline{fill:var(--color-grey-200)}vdr-dashboard-widget{margin-bottom:24px}.drag-handle{cursor:move}.cdk-drag-preview{box-sizing:border-box;border-radius:4px}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.dashboard-row{padding:0;border-width:1;margin-bottom:6px;transition:padding .2s,margin .2s}.dashboard-row.cdk-drop-list-dragging,.dashboard-row.cdk-drop-list-receiving{border:2px dashed var(--color-component-border-200);border-radius:var(--border-radius);padding:6px}.dashboard-row.cdk-drop-list-dragging .dashboard-item:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "directive", type: i2$1.ClrDatagridItemsTrackBy, selector: "[ngForTrackBy]", inputs: ["ngForTrackBy"] }, { kind: "directive", type: i2$1.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i4.CdkDropListGroup, selector: "[cdkDropListGroup]", inputs: ["cdkDropListGroupDisabled"], exportAs: ["cdkDropListGroup"] }, { kind: "directive", type: i4.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i4.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "directive", type: i1.DropdownItemDirective, selector: "[vdrDropdownItem]" }, { kind: "directive", type: i1.IfPermissionsDirective, selector: "[vdrIfPermissions]", inputs: ["vdrIfPermissions", "vdrIfPermissionsElse"] }, { kind: "component", type: i1.PageBlockComponent, selector: "vdr-page-block" }, { kind: "component", type: DashboardWidgetComponent, selector: "vdr-dashboard-widget", inputs: ["widgetConfig"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DashboardComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-dashboard', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-page-block>\n    <div class=\"widget-header mb-1\">\n        <vdr-dropdown>\n            <button class=\"btn btn-secondary btn-sm\" vdrDropdownTrigger>\n                <clr-icon shape=\"plus\"></clr-icon>\n                {{ 'dashboard.add-widget' | translate }}\n                <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n            </button>\n            <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n                <button\n                    vdrDropdownItem\n                    *ngFor=\"let widget of availableWidgets$ | async\"\n                    (click)=\"addWidget(widget.id)\"\n                >\n                    {{ (widget.config.title ?? widget.id) | translate }}\n                </button>\n            </vdr-dropdown-menu>\n        </vdr-dropdown>\n    </div>\n    <div cdkDropListGroup>\n        <div\n            class=\"clr-row dashboard-row\"\n            *ngFor=\"let row of widgetLayout; index as rowIndex; trackBy: trackRow\"\n            cdkDropList\n            (cdkDropListDropped)=\"drop($event)\"\n            cdkDropListOrientation=\"horizontal\"\n            [cdkDropListData]=\"{ index: rowIndex }\"\n        >\n            <div\n                *ngFor=\"let widget of row; trackBy: trackRowItem\"\n                class=\"dashboard-item\"\n                [ngClass]=\"getClassForWidth(widget.width)\"\n                cdkDrag\n                [cdkDragData]=\"widget\"\n            >\n                <vdr-dashboard-widget\n                    *vdrIfPermissions=\"widget.config.requiresPermissions || null\"\n                    [widgetConfig]=\"widget.config\"\n                >\n                    <div class=\"flex\">\n                        <div class=\"drag-handle\" cdkDragHandle>\n                            <clr-icon shape=\"drag-handle\" size=\"24\"></clr-icon>\n                        </div>\n                        <vdr-dropdown>\n                            <button class=\"icon-button\" vdrDropdownTrigger>\n                                <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n                            </button>\n                            <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n                                <h4 class=\"dropdown-header\">{{ 'dashboard.widget-resize' | translate }}</h4>\n                                <button\n                                    vdrDropdownItem\n                                    [disabled]=\"width === widget.width\"\n                                    *ngFor=\"let width of getSupportedWidths(widget.config)\"\n                                    (click)=\"setWidgetWidth(widget, width)\"\n                                >\n                                    {{ 'dashboard.widget-width' | translate : { width: width } }}\n                                </button>\n                                <div class=\"dropdown-divider\" role=\"separator\"></div>\n                                <button vdrDropdownItem (click)=\"removeWidget(widget)\">\n                                    <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\n                                    {{ 'dashboard.remove-widget' | translate }}\n                                </button>\n                            </vdr-dropdown-menu>\n                        </vdr-dropdown>\n                    </div>\n                </vdr-dashboard-widget>\n            </div>\n        </div>\n    </div>\n</vdr-page-block>\n", styles: [".widget-header{display:flex;justify-content:flex-end}.placeholder{color:var(--color-grey-300);text-align:center}.placeholder .version{font-size:3em;margin:24px;line-height:1em}.placeholder ::ng-deep .clr-i-outline{fill:var(--color-grey-200)}vdr-dashboard-widget{margin-bottom:24px}.drag-handle{cursor:move}.cdk-drag-preview{box-sizing:border-box;border-radius:4px}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.dashboard-row{padding:0;border-width:1;margin-bottom:6px;transition:padding .2s,margin .2s}.dashboard-row.cdk-drop-list-dragging,.dashboard-row.cdk-drop-list-receiving{border:2px dashed var(--color-component-border-200);border-radius:var(--border-radius);padding:6px}.dashboard-row.cdk-drop-list-dragging .dashboard-item:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.DashboardWidgetService }, { type: i1.LocalStorageService }, { type: i0.ChangeDetectorRef }, { type: i1.DataService }]; } });

const dashboardRoutes = [
    {
        path: '',
        component: DashboardComponent,
        pathMatch: 'full',
    },
];

const GET_LATEST_ORDERS = gql `
    query GetLatestOrders($options: OrderListOptions) {
        orders(options: $options) {
            items {
                id
                createdAt
                updatedAt
                type
                orderPlacedAt
                code
                state
                total
                totalWithTax
                currencyCode
                customer {
                    id
                    firstName
                    lastName
                }
            }
        }
    }
`;
class LatestOrdersWidgetComponent {
    constructor(dataService) {
        this.dataService = dataService;
    }
    ngOnInit() {
        this.latestOrders$ = this.dataService
            .query(GetLatestOrdersDocument, {
            options: {
                take: 10,
                filter: {
                    active: { eq: false },
                    state: { notIn: ['Cancelled', 'Draft'] },
                },
                sort: {
                    orderPlacedAt: SortOrder.DESC,
                },
            },
        })
            .refetchOnChannelChange()
            .mapStream(data => data.orders.items);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: LatestOrdersWidgetComponent, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: LatestOrdersWidgetComponent, selector: "vdr-latest-orders-widget", ngImport: i0, template: "<vdr-data-table-2 [items]=\"latestOrders$ | async\" id=\"latest-orders-widget-list\">\n    <vdr-dt2-column [heading]=\"'common.code' | translate\" id=\"code\">\n        <ng-template let-order=\"item\">\n            <a class=\"button-ghost\" [routerLink]=\"['/orders/', order.id]\"\n                ><span>{{ order.code }}</span>\n                <clr-icon shape=\"arrow right\"></clr-icon>\n            </a>\n        </ng-template>\n    </vdr-dt2-column>\n    <vdr-dt2-column [heading]=\"'order.state' | translate\" id=\"state\" [hiddenByDefault]=\"true\">\n        <ng-template let-order=\"item\">\n            <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n        </ng-template>\n    </vdr-dt2-column>\n    <vdr-dt2-column [heading]=\"'customer.customer' | translate\" id=\"customer\" [hiddenByDefault]=\"true\">\n        <ng-template let-order=\"item\">\n            <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\n        </ng-template>\n    </vdr-dt2-column>\n    <vdr-dt2-column [heading]=\"'order.total' | translate\" id=\"total\">\n        <ng-template let-order=\"item\">\n            {{ order.totalWithTax | localeCurrency : order.currencyCode }}\n        </ng-template>\n    </vdr-dt2-column>\n    <vdr-dt2-column [heading]=\"'order.placed-at' | translate\" id=\"placed-at\">\n        <ng-template let-order=\"item\">\n            {{ order.orderPlacedAt | timeAgo }}\n        </ng-template>\n    </vdr-dt2-column>\n</vdr-data-table-2>\n", styles: ["vdr-data-table ::ng-deep table{margin-top:0}vdr-order-state-label{display:inline-block;margin-top:2px}\n"], dependencies: [{ kind: "directive", type: i2$1.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1.CustomerLabelComponent, selector: "vdr-customer-label", inputs: ["customer"] }, { kind: "component", type: i1.OrderStateLabelComponent, selector: "vdr-order-state-label", inputs: ["state"] }, { kind: "component", type: i1.DataTable2Component, selector: "vdr-data-table-2", inputs: ["id", "items", "itemsPerPage", "currentPage", "totalItems", "emptyStateLabel", "filters", "activeIndex"], outputs: ["pageChange", "itemsPerPageChange"] }, { kind: "component", type: i1.DataTable2ColumnComponent, selector: "vdr-dt2-column", inputs: ["id", "expand", "heading", "align", "sort", "optional", "hiddenByDefault", "orderable"], exportAs: ["row"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.TimeAgoPipe, name: "timeAgo" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: LatestOrdersWidgetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-latest-orders-widget', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-data-table-2 [items]=\"latestOrders$ | async\" id=\"latest-orders-widget-list\">\n    <vdr-dt2-column [heading]=\"'common.code' | translate\" id=\"code\">\n        <ng-template let-order=\"item\">\n            <a class=\"button-ghost\" [routerLink]=\"['/orders/', order.id]\"\n                ><span>{{ order.code }}</span>\n                <clr-icon shape=\"arrow right\"></clr-icon>\n            </a>\n        </ng-template>\n    </vdr-dt2-column>\n    <vdr-dt2-column [heading]=\"'order.state' | translate\" id=\"state\" [hiddenByDefault]=\"true\">\n        <ng-template let-order=\"item\">\n            <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\n        </ng-template>\n    </vdr-dt2-column>\n    <vdr-dt2-column [heading]=\"'customer.customer' | translate\" id=\"customer\" [hiddenByDefault]=\"true\">\n        <ng-template let-order=\"item\">\n            <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\n        </ng-template>\n    </vdr-dt2-column>\n    <vdr-dt2-column [heading]=\"'order.total' | translate\" id=\"total\">\n        <ng-template let-order=\"item\">\n            {{ order.totalWithTax | localeCurrency : order.currencyCode }}\n        </ng-template>\n    </vdr-dt2-column>\n    <vdr-dt2-column [heading]=\"'order.placed-at' | translate\" id=\"placed-at\">\n        <ng-template let-order=\"item\">\n            {{ order.orderPlacedAt | timeAgo }}\n        </ng-template>\n    </vdr-dt2-column>\n</vdr-data-table-2>\n", styles: ["vdr-data-table ::ng-deep table{margin-top:0}vdr-order-state-label{display:inline-block;margin-top:2px}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.DataService }]; } });
class LatestOrdersWidgetModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: LatestOrdersWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: LatestOrdersWidgetModule, declarations: [LatestOrdersWidgetComponent], imports: [CoreModule, SharedModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: LatestOrdersWidgetModule, imports: [CoreModule, SharedModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: LatestOrdersWidgetModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CoreModule, SharedModule],
                    declarations: [LatestOrdersWidgetComponent],
                }]
        }] });

const GET_ORDER_CHART_DATA = gql `
    query GetOrderChartData($refresh: Boolean, $types: [MetricType!]!) {
        metricSummary(input: { interval: Daily, types: $types, refresh: $refresh }) {
            interval
            type
            entries {
                label
                value
            }
        }
    }
`;
class OrderChartWidgetComponent {
    constructor(dataService) {
        this.dataService = dataService;
        this.refresh$ = new Subject();
        this.metricType$ = new BehaviorSubject(MetricType.OrderTotal);
        this.MetricType = MetricType;
    }
    ngOnInit() {
        const currencyCode$ = this.dataService.settings
            .getActiveChannel()
            .refetchOnChannelChange()
            .mapStream(data => data.activeChannel.defaultCurrencyCode || undefined);
        const uiState$ = this.dataService.client.uiState().mapStream(data => data.uiState);
        const metricType$ = this.metricType$.pipe(distinctUntilChanged());
        this.metrics$ = combineLatest(metricType$, currencyCode$, uiState$).pipe(switchMap(([metricType, currencyCode, uiState]) => this.refresh$.pipe(startWith(false), switchMap(refresh => this.dataService
            .query(GetOrderChartDataDocument, {
            types: [metricType],
            refresh,
        })
            .mapSingle(data => data.metricSummary)
            .pipe(map(metrics => {
            const formatValueAs = metricType === MetricType.OrderCount ? 'number' : 'currency';
            const locale = `${uiState.language}-${uiState.locale}`;
            const formatOptions = {
                formatValueAs,
                currencyCode,
                locale,
            };
            return (metrics
                .find(m => m.type === metricType)
                ?.entries.map(entry => ({ ...entry, formatOptions })) ?? []);
        }))))));
    }
    refresh() {
        this.refresh$.next(true);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderChartWidgetComponent, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: OrderChartWidgetComponent, selector: "vdr-order-chart-widget", ngImport: i0, template: "<vdr-chart [entries]=\"metrics$ | async\" />\n<div class=\"flex\" *ngIf=\"metricType$ | async as activeMetricType\">\n    <button\n        class=\"button-small\"\n        (click)=\"metricType$.next(MetricType.OrderTotal)\"\n        [class.active]=\"activeMetricType === MetricType.OrderTotal\"\n    >\n        {{ 'dashboard.metric-order-total-value' | translate }}\n    </button>\n    <button\n        class=\"ml-1 button-small\"\n        (click)=\"metricType$.next(MetricType.OrderCount)\"\n        [class.active]=\"activeMetricType === MetricType.OrderCount\"\n    >\n        {{ 'dashboard.metric-number-of-orders' | translate }}\n    </button>\n    <button\n        class=\"ml-1 button-small\"\n        (click)=\"metricType$.next(MetricType.AverageOrderValue)\"\n        [class.active]=\"activeMetricType === MetricType.AverageOrderValue\"\n    >\n        {{ 'dashboard.metric-average-order-value' | translate }}\n    </button>\n    <div class=\"flex-spacer\"></div>\n    <button class=\"button-small\" (click)=\"refresh()\">\n        <clr-icon shape=\"refresh\"></clr-icon>\n    </button>\n</div>\n", styles: [".button-small.active{background-color:var(--color-primary-200);color:var(--color-primary-900)}\n"], dependencies: [{ kind: "directive", type: i2$1.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ChartComponent, selector: "vdr-chart", inputs: ["entries", "options"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderChartWidgetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-order-chart-widget', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vdr-chart [entries]=\"metrics$ | async\" />\n<div class=\"flex\" *ngIf=\"metricType$ | async as activeMetricType\">\n    <button\n        class=\"button-small\"\n        (click)=\"metricType$.next(MetricType.OrderTotal)\"\n        [class.active]=\"activeMetricType === MetricType.OrderTotal\"\n    >\n        {{ 'dashboard.metric-order-total-value' | translate }}\n    </button>\n    <button\n        class=\"ml-1 button-small\"\n        (click)=\"metricType$.next(MetricType.OrderCount)\"\n        [class.active]=\"activeMetricType === MetricType.OrderCount\"\n    >\n        {{ 'dashboard.metric-number-of-orders' | translate }}\n    </button>\n    <button\n        class=\"ml-1 button-small\"\n        (click)=\"metricType$.next(MetricType.AverageOrderValue)\"\n        [class.active]=\"activeMetricType === MetricType.AverageOrderValue\"\n    >\n        {{ 'dashboard.metric-average-order-value' | translate }}\n    </button>\n    <div class=\"flex-spacer\"></div>\n    <button class=\"button-small\" (click)=\"refresh()\">\n        <clr-icon shape=\"refresh\"></clr-icon>\n    </button>\n</div>\n", styles: [".button-small.active{background-color:var(--color-primary-200);color:var(--color-primary-900)}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.DataService }]; } });

const GET_ORDER_SUMMARY = gql `
    query GetOrderSummary($start: DateTime!, $end: DateTime!) {
        orders(options: { filter: { orderPlacedAt: { between: { start: $start, end: $end } } } }) {
            totalItems
            items {
                id
                totalWithTax
                currencyCode
            }
        }
    }
`;
class OrderSummaryWidgetComponent {
    constructor(dataService) {
        this.dataService = dataService;
        this.today = new Date();
        this.yesterday = new Date(new Date().setDate(this.today.getDate() - 1));
        this.selection$ = new BehaviorSubject({
            timeframe: 'day',
            date: this.today,
        });
    }
    ngOnInit() {
        this.dateRange$ = this.selection$.pipe(distinctUntilChanged(), map(selection => ({
            start: dayjs(selection.date).startOf(selection.timeframe).toDate(),
            end: dayjs(selection.date).endOf(selection.timeframe).toDate(),
        })), shareReplay(1));
        const orderSummary$ = this.dateRange$.pipe(switchMap$1(({ start, end }) => this.dataService
            .query(GetOrderSummaryDocument, { start: start.toISOString(), end: end.toISOString() })
            .refetchOnChannelChange()
            .mapStream(data => data.orders)), shareReplay(1));
        this.totalOrderCount$ = orderSummary$.pipe(map(res => res.totalItems));
        this.totalOrderValue$ = orderSummary$.pipe(map(res => res.items.reduce((total, order) => total + order.totalWithTax, 0) / 100));
        this.currencyCode$ = this.dataService.settings
            .getActiveChannel()
            .refetchOnChannelChange()
            .mapStream(data => data.activeChannel.defaultCurrencyCode || undefined);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderSummaryWidgetComponent, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: OrderSummaryWidgetComponent, selector: "vdr-order-summary-widget", ngImport: i0, template: "<div class=\"stats\">\n    <div class=\"stat\">\n        <div class=\"stat-figure\">{{ totalOrderCount$ | async }}</div>\n        <div class=\"stat-label\">{{ 'dashboard.total-orders' | translate }}</div>\n    </div>\n    <div class=\"stat\">\n        <div class=\"stat-figure\">\n            {{ totalOrderValue$ | async | currency: (currencyCode$ | async) || undefined }}\n        </div>\n        <div class=\"stat-label\">{{ 'dashboard.total-order-value' | translate }}</div>\n    </div>\n</div>\n<div class=\"footer\">\n    <div class=\"flex\" *ngIf=\"selection$ | async as selection\">\n        <button class=\"button-small\" [class.active]=\"selection.date === today\" (click)=\"selection$.next({timeframe: 'day', date: today})\">\n            {{ 'dashboard.today' | translate }}\n        </button>\n        <button class=\"ml-1 button-small\" [class.active]=\"selection.date === yesterday\" (click)=\"selection$.next({timeframe: 'day', date: yesterday})\">\n            {{ 'dashboard.yesterday' | translate }}\n        </button>\n        <button class=\"ml-1 button-small\" [class.active]=\"selection.timeframe === 'week'\" (click)=\"selection$.next({timeframe: 'week'})\">\n            {{ 'dashboard.thisWeek' | translate }}\n        </button>\n        <button class=\"ml-1 button-small\" [class.active]=\"selection.timeframe === 'month'\" (click)=\"selection$.next({timeframe: 'month'})\">\n            {{ 'dashboard.thisMonth' | translate }}\n        </button>\n    </div>\n\n    <div class=\"date-range p5\" *ngIf=\"dateRange$ | async as range\">\n        {{ range.start | localeDate }} - {{ range.end | localeDate }}\n    </div>\n</div>\n", styles: [".stats{display:flex;justify-content:space-evenly}.stat{text-align:center}.stat-figure{font-size:2rem;line-height:3rem}.stat-label{text-transform:uppercase}.date-range{margin-top:0}.footer{margin-top:24px;display:flex;flex-direction:column;justify-content:space-between}.button-small.active{background-color:var(--color-primary-200);color:var(--color-primary-900)}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.LocaleDatePipe, name: "localeDate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderSummaryWidgetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-order-summary-widget', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"stats\">\n    <div class=\"stat\">\n        <div class=\"stat-figure\">{{ totalOrderCount$ | async }}</div>\n        <div class=\"stat-label\">{{ 'dashboard.total-orders' | translate }}</div>\n    </div>\n    <div class=\"stat\">\n        <div class=\"stat-figure\">\n            {{ totalOrderValue$ | async | currency: (currencyCode$ | async) || undefined }}\n        </div>\n        <div class=\"stat-label\">{{ 'dashboard.total-order-value' | translate }}</div>\n    </div>\n</div>\n<div class=\"footer\">\n    <div class=\"flex\" *ngIf=\"selection$ | async as selection\">\n        <button class=\"button-small\" [class.active]=\"selection.date === today\" (click)=\"selection$.next({timeframe: 'day', date: today})\">\n            {{ 'dashboard.today' | translate }}\n        </button>\n        <button class=\"ml-1 button-small\" [class.active]=\"selection.date === yesterday\" (click)=\"selection$.next({timeframe: 'day', date: yesterday})\">\n            {{ 'dashboard.yesterday' | translate }}\n        </button>\n        <button class=\"ml-1 button-small\" [class.active]=\"selection.timeframe === 'week'\" (click)=\"selection$.next({timeframe: 'week'})\">\n            {{ 'dashboard.thisWeek' | translate }}\n        </button>\n        <button class=\"ml-1 button-small\" [class.active]=\"selection.timeframe === 'month'\" (click)=\"selection$.next({timeframe: 'month'})\">\n            {{ 'dashboard.thisMonth' | translate }}\n        </button>\n    </div>\n\n    <div class=\"date-range p5\" *ngIf=\"dateRange$ | async as range\">\n        {{ range.start | localeDate }} - {{ range.end | localeDate }}\n    </div>\n</div>\n", styles: [".stats{display:flex;justify-content:space-evenly}.stat{text-align:center}.stat-figure{font-size:2rem;line-height:3rem}.stat-label{text-transform:uppercase}.date-range{margin-top:0}.footer{margin-top:24px;display:flex;flex-direction:column;justify-content:space-between}.button-small.active{background-color:var(--color-primary-200);color:var(--color-primary-900)}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.DataService }]; } });
class OrderSummaryWidgetModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderSummaryWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: OrderSummaryWidgetModule, declarations: [OrderSummaryWidgetComponent], imports: [CoreModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderSummaryWidgetModule, imports: [CoreModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderSummaryWidgetModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CoreModule],
                    declarations: [OrderSummaryWidgetComponent],
                }]
        }] });

const DEFAULT_DASHBOARD_WIDGET_LAYOUT = [
    { id: 'metrics', width: 12 },
    { id: 'orderSummary', width: 6 },
    { id: 'latestOrders', width: 6 },
];
const DEFAULT_WIDGETS = {
    metrics: {
        title: marker('dashboard.metrics'),
        supportedWidths: [6, 8, 12],
        loadComponent: () => OrderChartWidgetComponent,
        requiresPermissions: [Permission.ReadOrder],
    },
    orderSummary: {
        title: marker('dashboard.orders-summary'),
        loadComponent: () => OrderSummaryWidgetComponent,
        supportedWidths: [4, 6, 8, 12],
        requiresPermissions: [Permission.ReadOrder],
    },
    latestOrders: {
        title: marker('dashboard.latest-orders'),
        loadComponent: () => LatestOrdersWidgetComponent,
        supportedWidths: [6, 8, 12],
        requiresPermissions: [Permission.ReadOrder],
    },
};

class DashboardModule {
    constructor(dashboardWidgetService) {
        Object.entries(DEFAULT_WIDGETS).map(([id, config]) => {
            if (!dashboardWidgetService.getWidgetById(id)) {
                dashboardWidgetService.registerWidget(id, config);
            }
        });
        if (dashboardWidgetService.getDefaultLayout().length === 0) {
            dashboardWidgetService.setDefaultLayout(DEFAULT_DASHBOARD_WIDGET_LAYOUT);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DashboardModule, deps: [{ token: i1.DashboardWidgetService }], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: DashboardModule, declarations: [DashboardComponent, DashboardWidgetComponent, OrderChartWidgetComponent], imports: [SharedModule, i3$1.RouterModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DashboardModule, imports: [SharedModule, RouterModule.forChild(dashboardRoutes)] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DashboardModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [SharedModule, RouterModule.forChild(dashboardRoutes)],
                    declarations: [DashboardComponent, DashboardWidgetComponent, OrderChartWidgetComponent],
                }]
        }], ctorParameters: function () { return [{ type: i1.DashboardWidgetService }]; } });

class TestWidgetComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: TestWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: TestWidgetComponent, selector: "vdr-test-widget", ngImport: i0, template: "<p>This is a test widget!</p>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: TestWidgetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-test-widget', changeDetection: ChangeDetectionStrategy.OnPush, template: "<p>This is a test widget!</p>\n" }]
        }] });
class TestWidgetModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: TestWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: TestWidgetModule, declarations: [TestWidgetComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: TestWidgetModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: TestWidgetModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [TestWidgetComponent],
                }]
        }] });

class WelcomeWidgetComponent {
    constructor(dataService) {
        this.dataService = dataService;
        this.version = ADMIN_UI_VERSION;
        this.brand = getAppConfig().brand;
        this.hideVendureBranding = getAppConfig().hideVendureBranding;
        this.hideVersion = getAppConfig().hideVersion;
    }
    ngOnInit() {
        this.administrator$ = this.dataService.administrator
            .getActiveAdministrator()
            .mapStream(data => data.activeAdministrator || null);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: WelcomeWidgetComponent, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: WelcomeWidgetComponent, selector: "vdr-welcome-widget", ngImport: i0, template: "<div *ngIf=\"administrator$ | async as administrator\">\n    <h4 class=\"\">\n        Welcome, {{ administrator.firstName }} {{ administrator.lastName }}<br />\n        <small class=\"p5\">Last login: {{ administrator.user.lastLogin | timeAgo }}</small>\n    </h4>\n\n    <p class=\"p5\" *ngIf=\"!hideVendureBranding || !hideVersion\">\n        {{ hideVendureBranding ? '' : 'Vendure' }} {{ hideVersion ? '' : ('Admin UI v' + version) }}\n    </p>\n</div>\n<div class=\"placeholder\">\n    <clr-icon shape=\"line-chart\" size=\"128\"></clr-icon>\n</div>\n", styles: [":host{display:flex;justify-content:space-between}.placeholder{color:var(--color-grey-200)}\n"], dependencies: [{ kind: "directive", type: i2$1.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.TimeAgoPipe, name: "timeAgo" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: WelcomeWidgetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-welcome-widget', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"administrator$ | async as administrator\">\n    <h4 class=\"\">\n        Welcome, {{ administrator.firstName }} {{ administrator.lastName }}<br />\n        <small class=\"p5\">Last login: {{ administrator.user.lastLogin | timeAgo }}</small>\n    </h4>\n\n    <p class=\"p5\" *ngIf=\"!hideVendureBranding || !hideVersion\">\n        {{ hideVendureBranding ? '' : 'Vendure' }} {{ hideVersion ? '' : ('Admin UI v' + version) }}\n    </p>\n</div>\n<div class=\"placeholder\">\n    <clr-icon shape=\"line-chart\" size=\"128\"></clr-icon>\n</div>\n", styles: [":host{display:flex;justify-content:space-between}.placeholder{color:var(--color-grey-200)}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.DataService }]; } });
class WelcomeWidgetModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: WelcomeWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: WelcomeWidgetModule, declarations: [WelcomeWidgetComponent], imports: [CoreModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: WelcomeWidgetModule, imports: [CoreModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: WelcomeWidgetModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CoreModule],
                    declarations: [WelcomeWidgetComponent],
                }]
        }] });

// This file was generated by the build-public-api.ts script

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

export { DEFAULT_DASHBOARD_WIDGET_LAYOUT, DEFAULT_WIDGETS, DashboardComponent, DashboardModule, DashboardWidgetComponent, GET_ORDER_CHART_DATA, GET_ORDER_SUMMARY, LatestOrdersWidgetComponent, LatestOrdersWidgetModule, OrderChartWidgetComponent, OrderSummaryWidgetComponent, OrderSummaryWidgetModule, TestWidgetComponent, TestWidgetModule, WelcomeWidgetComponent, WelcomeWidgetModule, dashboardRoutes };
//# sourceMappingURL=vendure-admin-ui-dashboard.mjs.map
