UNPKG

ng-jhipster

Version:

A Jhipster util library for Angular

2,860 lines 113 kB
import { ɵɵdefineInjectable, Injectable, ɵɵinject, Component, Input, Directive, forwardRef, EventEmitter, Output, Host, ContentChild, HostListener, ElementRef, Optional, Pipe, NgModule, SecurityContext, NgZone } from '@angular/core';
import { faSort, faSortUp, faSortDown } from '@fortawesome/free-solid-svg-icons';
import { NG_VALIDATORS, FormsModule } from '@angular/forms';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { TranslateService } from '@ngx-translate/core';
import { Subject, Observable } from 'rxjs';
import { takeUntil, share, filter, map } from 'rxjs/operators';
import { CommonModule, DatePipe } from '@angular/common';
import { NgbActiveModal, NgbModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { DomSanitizer } from '@angular/platform-browser';

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiModuleConfig {
    constructor() {
        this.sortIcon = faSort;
        this.sortAscIcon = faSortUp;
        this.sortDescIcon = faSortDown;
        this.i18nEnabled = false;
        this.defaultI18nLang = 'en';
        this.noi18nMessage = 'translation-not-found';
        this.alertAsToast = false;
        this.alertTimeout = 5000;
        this.classBadgeTrue = 'badge badge-success';
        this.classBadgeFalse = 'badge badge-danger';
        this.classTrue = 'fa fa-lg fa-check text-success';
        this.classFalse = 'fa fa-lg fa-times text-danger';
    }
}
JhiModuleConfig.ɵprov = ɵɵdefineInjectable({ factory: function JhiModuleConfig_Factory() { return new JhiModuleConfig(); }, token: JhiModuleConfig, providedIn: "root" });
JhiModuleConfig.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiConfigService {
    constructor(moduleConfig) {
        this.CONFIG_OPTIONS = Object.assign(Object.assign({}, new JhiModuleConfig()), moduleConfig);
    }
    getConfig() {
        return this.CONFIG_OPTIONS;
    }
}
JhiConfigService.ɵprov = ɵɵdefineInjectable({ factory: function JhiConfigService_Factory() { return new JhiConfigService(ɵɵinject(JhiModuleConfig)); }, token: JhiConfigService, providedIn: "root" });
JhiConfigService.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiConfigService.ctorParameters = () => [
    { type: JhiModuleConfig }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
/**
 * A component that will take care of item count statistics of a pagination.
 */
class JhiItemCountComponent {
    constructor(config) {
        this.i18nEnabled = config.CONFIG_OPTIONS.i18nEnabled;
    }
    /**
     * "translate-values" JSON of the template
     */
    i18nValues() {
        const first = (this.page - 1) * this.itemsPerPage === 0 ? 1 : (this.page - 1) * this.itemsPerPage + 1;
        const second = this.page * this.itemsPerPage < this.total ? this.page * this.itemsPerPage : this.total;
        return {
            first,
            second,
            total: this.total
        };
    }
}
JhiItemCountComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-item-count',
                template: `
        <div *ngIf="i18nEnabled; else noI18n" class="info jhi-item-count" jhiTranslate="global.item-count" [translateValues]="i18nValues()">
            /* [attr.translateValues] is used to get entire values in tests */
        </div>
        <ng-template #noI18n class="info jhi-item-count">
            Showing
            {{ (page - 1) * itemsPerPage == 0 ? 1 : (page - 1) * itemsPerPage + 1 }}
            - {{ page * itemsPerPage < total ? page * itemsPerPage : total }} of {{ total }} items.
        </ng-template>
    `
            },] }
];
JhiItemCountComponent.ctorParameters = () => [
    { type: JhiConfigService }
];
JhiItemCountComponent.propDecorators = {
    page: [{ type: Input }],
    total: [{ type: Input }],
    itemsPerPage: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
/**
 * This component can be used to display a boolean value by defining the @Input attributes
 * If an attribute is not provided, default values will be applied (see JhiModuleConfig class)
 * Have a look at the following examples
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * <jhi-boolean [value]="inputBooleanVariable"></jhi-boolean>
 *
 * - Display a green check when inputBooleanVariable is true
 * - Display a red cross when inputBooleanVariable is false
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * <jhi-boolean
 *     [value]="inputBooleanVariable">
 *     classTrue="fa fa-lg fa-check text-primary"
 *     classFalse="fa fa-lg fa-times text-warning"
 * </jhi-boolean>
 *
 * - Display a blue check when inputBooleanVariable is true
 * - Display an orange cross when inputBooleanVariable is false
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * <jhi-boolean
 *     [value]="inputBooleanVariable">
 *     classTrue="fa fa-lg fa-check"
 *     classFalse=""
 * </jhi-boolean>
 *
 * - Display a black check when inputBooleanVariable is true
 * - Do not display anything when inputBooleanVariable is false
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * <jhi-boolean
 *     [value]="inputBooleanVariable"
 *     [textTrue]="'userManagement.activated' | translate"
 *     textFalse="deactivated">
 * </jhi-boolean>
 *
 * - Display a green badge when inputBooleanVariable is true
 * - Display a red badge when inputBooleanVariable is false
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * <jhi-boolean
 *     [value]="user.activated"
 *     classTrue="badge badge-warning"
 *     classFalse="badge badge-info"
 *     [textTrue]="'userManagement.activated' | translate"
 *     textFalse="deactivated">
 * </jhi-boolean>
 *
 * - Display an orange badge and write 'activated' when inputBooleanVariable is true
 * - Display a blue badge and write 'deactivated' when inputBooleanVariable is false
 */
class JhiBooleanComponent {
    constructor(configService) {
        this.config = configService.getConfig();
    }
    ngOnInit() {
        if (this.textTrue === undefined) {
            if (this.classTrue === undefined) {
                this.classTrue = this.config.classTrue;
            }
        }
        else {
            if (this.classTrue === undefined) {
                this.classTrue = this.config.classBadgeTrue;
            }
        }
        if (this.textFalse === undefined) {
            if (this.classFalse === undefined) {
                this.classFalse = this.config.classFalse;
            }
        }
        else {
            if (this.classFalse === undefined) {
                this.classFalse = this.config.classBadgeFalse;
            }
        }
    }
}
JhiBooleanComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-boolean',
                template: `
        <span [ngClass]="value ? classTrue : classFalse" [innerHtml]="value ? textTrue : textFalse"> </span>
    `
            },] }
];
JhiBooleanComponent.ctorParameters = () => [
    { type: JhiConfigService }
];
JhiBooleanComponent.propDecorators = {
    value: [{ type: Input }],
    classTrue: [{ type: Input }],
    classFalse: [{ type: Input }],
    textTrue: [{ type: Input }],
    textFalse: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
function numberOfBytes(base64String) {
    function endsWith(suffix, str) {
        return str.includes(suffix, str.length - suffix.length);
    }
    function paddingSize(value) {
        if (endsWith('==', value)) {
            return 2;
        }
        if (endsWith('=', value)) {
            return 1;
        }
        return 0;
    }
    return (base64String.length / 4) * 3 - paddingSize(base64String);
}

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMaxbytesValidatorDirective {
    constructor() { }
    validate(c) {
        return c.value && numberOfBytes(c.value) > this.jhiMaxbytes
            ? {
                maxbytes: {
                    valid: false
                }
            }
            : null;
    }
}
JhiMaxbytesValidatorDirective.decorators = [
    { type: Directive, args: [{
                selector: '[jhiMaxbytes][ngModel]',
                // eslint-disable-next-line @typescript-eslint/no-use-before-define
                providers: [{ provide: NG_VALIDATORS, useExisting: forwardRef(() => JhiMaxbytesValidatorDirective), multi: true }]
            },] }
];
JhiMaxbytesValidatorDirective.ctorParameters = () => [];
JhiMaxbytesValidatorDirective.propDecorators = {
    jhiMaxbytes: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMinbytesValidatorDirective {
    constructor() { }
    validate(c) {
        return c.value && numberOfBytes(c.value) < this.jhiMinbytes
            ? {
                minbytes: {
                    valid: false
                }
            }
            : null;
    }
}
JhiMinbytesValidatorDirective.decorators = [
    { type: Directive, args: [{
                selector: '[jhiMinbytes][ngModel]',
                // eslint-disable-next-line @typescript-eslint/no-use-before-define
                providers: [{ provide: NG_VALIDATORS, useExisting: forwardRef(() => JhiMinbytesValidatorDirective), multi: true }]
            },] }
];
JhiMinbytesValidatorDirective.ctorParameters = () => [];
JhiMinbytesValidatorDirective.propDecorators = {
    jhiMinbytes: [{ type: Input }]
};

/*
 Copyright 2013-Present the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMaxValidatorDirective {
    constructor() { }
    validate(c) {
        return c.value === undefined || c.value === null || c.value <= this.jhiMax
            ? null
            : {
                max: {
                    valid: false
                }
            };
    }
}
JhiMaxValidatorDirective.decorators = [
    { type: Directive, args: [{
                selector: '[jhiMax][ngModel]',
                // eslint-disable-next-line @typescript-eslint/no-use-before-define
                providers: [{ provide: NG_VALIDATORS, useExisting: forwardRef(() => JhiMaxValidatorDirective), multi: true }]
            },] }
];
JhiMaxValidatorDirective.ctorParameters = () => [];
JhiMaxValidatorDirective.propDecorators = {
    jhiMax: [{ type: Input }]
};

/*
 Copyright 2013-Present the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMinValidatorDirective {
    constructor() { }
    validate(c) {
        return c.value === undefined || c.value === null || c.value >= this.jhiMin
            ? null
            : {
                min: {
                    valid: false
                }
            };
    }
}
JhiMinValidatorDirective.decorators = [
    { type: Directive, args: [{
                selector: '[jhiMin][ngModel]',
                // eslint-disable-next-line @typescript-eslint/no-use-before-define
                providers: [{ provide: NG_VALIDATORS, useExisting: forwardRef(() => JhiMinValidatorDirective), multi: true }]
            },] }
];
JhiMinValidatorDirective.ctorParameters = () => [];
JhiMinValidatorDirective.propDecorators = {
    jhiMin: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiSortDirective {
    constructor() {
        this.predicateChange = new EventEmitter();
        this.ascendingChange = new EventEmitter();
    }
    sort(field) {
        this.ascending = field !== this.predicate ? true : !this.ascending;
        this.predicate = field;
        this.predicateChange.emit(field);
        this.ascendingChange.emit(this.ascending);
        this.callback();
    }
}
JhiSortDirective.decorators = [
    { type: Directive, args: [{
                selector: '[jhiSort]'
            },] }
];
JhiSortDirective.ctorParameters = () => [];
JhiSortDirective.propDecorators = {
    predicate: [{ type: Input }],
    ascending: [{ type: Input }],
    callback: [{ type: Input }],
    predicateChange: [{ type: Output }],
    ascendingChange: [{ type: Output }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiSortByDirective {
    constructor(jhiSort, configService) {
        this.jhiSort = jhiSort;
        this.jhiSort = jhiSort;
        const config = configService.getConfig();
        this.sortIcon = config.sortIcon;
        this.sortAscIcon = config.sortAscIcon;
        this.sortDescIcon = config.sortDescIcon;
    }
    ngAfterContentInit() {
        if (this.jhiSort.predicate && this.jhiSort.predicate !== '_score' && this.jhiSort.predicate === this.jhiSortBy) {
            this.updateIconDefinition(this.iconComponent, this.jhiSort.ascending ? this.sortAscIcon : this.sortDescIcon);
            this.jhiSort.activeIconComponent = this.iconComponent;
        }
    }
    onClick() {
        if (this.jhiSort.predicate && this.jhiSort.predicate !== '_score') {
            this.jhiSort.sort(this.jhiSortBy);
            this.updateIconDefinition(this.jhiSort.activeIconComponent, this.sortIcon);
            this.updateIconDefinition(this.iconComponent, this.jhiSort.ascending ? this.sortAscIcon : this.sortDescIcon);
            this.jhiSort.activeIconComponent = this.iconComponent;
        }
    }
    updateIconDefinition(iconComponent, icon) {
        if (iconComponent) {
            iconComponent.icon = icon.iconName;
            iconComponent.render();
        }
    }
}
JhiSortByDirective.decorators = [
    { type: Directive, args: [{
                selector: '[jhiSortBy]'
            },] }
];
JhiSortByDirective.ctorParameters = () => [
    { type: JhiSortDirective, decorators: [{ type: Host }] },
    { type: JhiConfigService }
];
JhiSortByDirective.propDecorators = {
    jhiSortBy: [{ type: Input }],
    iconComponent: [{ type: ContentChild, args: [FaIconComponent, { static: true },] }],
    onClick: [{ type: HostListener, args: ['click',] }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiLanguageService {
    constructor(translateService, configService) {
        this.translateService = translateService;
        this.configService = configService;
        this.currentLang = 'en';
    }
    init() {
        const config = this.configService.getConfig();
        this.currentLang = config.defaultI18nLang;
        this.translateService.setDefaultLang(this.currentLang);
        this.translateService.use(this.currentLang);
    }
    changeLanguage(languageKey) {
        this.currentLang = languageKey;
        this.configService.CONFIG_OPTIONS.defaultI18nLang = languageKey;
        this.translateService.use(this.currentLang);
    }
    /**
     * @deprecated Will be removed when releasing generator-jhipster v7
     */
    getCurrent() {
        return Promise.resolve(this.currentLang);
    }
    getCurrentLanguage() {
        return this.currentLang;
    }
}
JhiLanguageService.ɵprov = ɵɵdefineInjectable({ factory: function JhiLanguageService_Factory() { return new JhiLanguageService(ɵɵinject(TranslateService), ɵɵinject(JhiConfigService)); }, token: JhiLanguageService, providedIn: "root" });
JhiLanguageService.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiLanguageService.ctorParameters = () => [
    { type: TranslateService },
    { type: JhiConfigService }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
/**
 * A wrapper directive on top of the translate pipe as the inbuilt translate directive from ngx-translate is too verbose and buggy
 */
class JhiTranslateDirective {
    constructor(configService, el, translateService) {
        this.configService = configService;
        this.el = el;
        this.translateService = translateService;
        this.directiveDestroyed = new Subject();
    }
    ngOnInit() {
        const enabled = this.configService.getConfig().i18nEnabled;
        if (enabled) {
            this.translateService.onLangChange.pipe(takeUntil(this.directiveDestroyed)).subscribe(() => {
                this.getTranslation();
            });
        }
    }
    ngOnChanges() {
        const enabled = this.configService.getConfig().i18nEnabled;
        if (enabled) {
            this.getTranslation();
        }
    }
    ngOnDestroy() {
        this.directiveDestroyed.next();
        this.directiveDestroyed.complete();
    }
    getTranslation() {
        this.translateService
            .get(this.jhiTranslate, this.translateValues)
            .pipe(takeUntil(this.directiveDestroyed))
            .subscribe(value => {
            this.el.nativeElement.innerHTML = value;
        }, () => {
            return `${this.configService.getConfig().noi18nMessage}[${this.jhiTranslate}]`;
        });
    }
}
JhiTranslateDirective.decorators = [
    { type: Directive, args: [{
                selector: '[jhiTranslate]'
            },] }
];
JhiTranslateDirective.ctorParameters = () => [
    { type: JhiConfigService },
    { type: ElementRef },
    { type: TranslateService, decorators: [{ type: Optional }] }
];
JhiTranslateDirective.propDecorators = {
    jhiTranslate: [{ type: Input }],
    translateValues: [{ type: Input }]
};

class JhiMissingTranslationHandler {
    constructor(configService) {
        this.configService = configService;
    }
    handle(params) {
        const key = params.key;
        return `${this.configService.getConfig().noi18nMessage}[${key}]`;
    }
}

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiThreadModalComponent {
    constructor(activeModal) {
        this.activeModal = activeModal;
        this.threadDumpAll = 0;
        this.threadDumpBlocked = 0;
        this.threadDumpRunnable = 0;
        this.threadDumpTimedWaiting = 0;
        this.threadDumpWaiting = 0;
    }
    ngOnInit() {
        this.threadDump.forEach(value => {
            if (value.threadState === 'RUNNABLE') {
                this.threadDumpRunnable += 1;
            }
            else if (value.threadState === 'WAITING') {
                this.threadDumpWaiting += 1;
            }
            else if (value.threadState === 'TIMED_WAITING') {
                this.threadDumpTimedWaiting += 1;
            }
            else if (value.threadState === 'BLOCKED') {
                this.threadDumpBlocked += 1;
            }
        });
        this.threadDumpAll = this.threadDumpRunnable + this.threadDumpWaiting + this.threadDumpTimedWaiting + this.threadDumpBlocked;
    }
    getBadgeClass(threadState) {
        if (threadState === 'RUNNABLE') {
            return 'badge-success';
        }
        else if (threadState === 'WAITING') {
            return 'badge-info';
        }
        else if (threadState === 'TIMED_WAITING') {
            return 'badge-warning';
        }
        else if (threadState === 'BLOCKED') {
            return 'badge-danger';
        }
    }
}
JhiThreadModalComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-thread-modal',
                template: `
        <div class="modal-header">
            <h4 class="modal-title" jhiTranslate="metrics.jvm.threads.dump.title">Threads dump</h4>
            <button type="button" class="close" (click)="activeModal.dismiss('closed')">&times;</button>
        </div>
        <div class="modal-body">
            <span class="badge badge-primary" (click)="threadDumpFilter = {}">
                All&nbsp;<span class="badge badge-pill badge-default">{{ threadDumpAll }}</span> </span
            >&nbsp;
            <span class="badge badge-success" (click)="threadDumpFilter = { threadState: 'RUNNABLE' }">
                Runnable&nbsp;<span class="badge badge-pill badge-default">{{ threadDumpRunnable }}</span> </span
            >&nbsp;
            <span class="badge badge-info" (click)="threadDumpFilter = { threadState: 'WAITING' }"
                >Waiting&nbsp;<span class="badge badge-pill badge-default">{{ threadDumpWaiting }}</span></span
            >&nbsp;
            <span class="badge badge-warning" (click)="threadDumpFilter = { threadState: 'TIMED_WAITING' }">
                Timed Waiting&nbsp;<span class="badge badge-pill badge-default">{{ threadDumpTimedWaiting }}</span> </span
            >&nbsp;
            <span class="badge badge-danger" (click)="threadDumpFilter = { threadState: 'BLOCKED' }"
                >Blocked&nbsp;<span class="badge badge-pill badge-default">{{ threadDumpBlocked }}</span></span
            >&nbsp;
            <div class="mt-2">&nbsp;</div>
            Filter
            <input type="text" [(ngModel)]="threadDumpFilter" class="form-control" />
            <div class="pad" *ngFor="let entry of (threadDump | pureFilter: threadDumpFilter:'lockName' | keys)">
                <h6>
                    <span class="badge" [ngClass]="getBadgeClass(entry.value.threadState)">{{ entry.value.threadState }}</span
                    >&nbsp;{{ entry.value.threadName }}
                    (ID
                    {{ entry.value.threadId }})
                    <a (click)="entry.show = !entry.show" href="javascript:void(0);">
                        <span [hidden]="entry.show" jhiTranslate="metrics.jvm.threads.dump.show">Show StackTrace</span>
                        <span [hidden]="!entry.show" jhiTranslate="metrics.jvm.threads.dump.hide">Hide StackTrace</span>
                    </a>
                </h6>
                <div class="card" [hidden]="!entry.show">
                    <div class="card-body">
                        <div *ngFor="let st of (entry.value.stackTrace | keys)" class="break">
                            <samp
                                >{{ st.value.className }}.{{ st.value.methodName }}(<code
                                    >{{ st.value.fileName }}:{{ st.value.lineNumber }}</code
                                >)</samp
                            >
                            <span class="mt-1"></span>
                        </div>
                    </div>
                </div>
                <table class="table table-sm table-responsive">
                    <thead>
                        <tr>
                            <th jhiTranslate="metrics.jvm.threads.dump.blockedtime">Blocked Time</th>
                            <th jhiTranslate="metrics.jvm.threads.dump.blockedcount">Blocked Count</th>
                            <th jhiTranslate="metrics.jvm.threads.dump.waitedtime">Waited Time</th>
                            <th jhiTranslate="metrics.jvm.threads.dump.waitedcount">Waited Count</th>
                            <th jhiTranslate="metrics.jvm.threads.dump.lockname">Lock Name</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>{{ entry.value.blockedTime }}</td>
                            <td>{{ entry.value.blockedCount }}</td>
                            <td>{{ entry.value.waitedTime }}</td>
                            <td>{{ entry.value.waitedCount }}</td>
                            <td class="thread-dump-modal-lock" title="{{ entry.value.lockName }}">
                                <code>{{ entry.value.lockName }}</code>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-secondary float-left" data-dismiss="modal" (click)="activeModal.dismiss('closed')">
                Done
            </button>
        </div>
    `
            },] }
];
JhiThreadModalComponent.ctorParameters = () => [
    { type: NgbActiveModal }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiJvmMemoryComponent {
}
JhiJvmMemoryComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-jvm-memory',
                template: `
        <h4 jhiTranslate="metrics.jvm.memory.title">Memory</h4>
        <div *ngIf="!updating">
            <div *ngFor="let entry of (jvmMemoryMetrics | keys)">
                <span *ngIf="entry.value.max != -1; else other">
                    <span>{{ entry.key }}</span> ({{ entry.value.used / 1048576 | number: '1.0-0' }}M /
                    {{ entry.value.max / 1048576 | number: '1.0-0' }}M)
                </span>
                <div>Committed : {{ entry.value.committed / 1048576 | number: '1.0-0' }}M</div>
                <ng-template #other
                    ><span
                        ><span>{{ entry.key }}</span> {{ entry.value.used / 1048576 | number: '1.0-0' }}M</span
                    >
                </ng-template>
                <ngb-progressbar
                    *ngIf="entry.value.max != -1"
                    type="success"
                    [value]="(100 * entry.value.used) / entry.value.max"
                    [striped]="true"
                    [animated]="false"
                >
                    <span>{{ (entry.value.used * 100) / entry.value.max | number: '1.0-0' }}%</span>
                </ngb-progressbar>
            </div>
        </div>
    `
            },] }
];
JhiJvmMemoryComponent.propDecorators = {
    jvmMemoryMetrics: [{ type: Input }],
    updating: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiJvmThreadsComponent {
    constructor(modalService) {
        this.modalService = modalService;
    }
    ngOnInit() {
        this.threadStats = {
            threadDumpRunnable: 0,
            threadDumpWaiting: 0,
            threadDumpTimedWaiting: 0,
            threadDumpBlocked: 0,
            threadDumpAll: 0
        };
        this.threadData.forEach(value => {
            if (value.threadState === 'RUNNABLE') {
                this.threadStats.threadDumpRunnable += 1;
            }
            else if (value.threadState === 'WAITING') {
                this.threadStats.threadDumpWaiting += 1;
            }
            else if (value.threadState === 'TIMED_WAITING') {
                this.threadStats.threadDumpTimedWaiting += 1;
            }
            else if (value.threadState === 'BLOCKED') {
                this.threadStats.threadDumpBlocked += 1;
            }
        });
        this.threadStats.threadDumpAll =
            this.threadStats.threadDumpRunnable +
                this.threadStats.threadDumpWaiting +
                this.threadStats.threadDumpTimedWaiting +
                this.threadStats.threadDumpBlocked;
    }
    open() {
        const modalRef = this.modalService.open(JhiThreadModalComponent);
        modalRef.componentInstance.threadDump = this.threadData;
    }
}
JhiJvmThreadsComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-jvm-threads',
                template: `
        <h4 jhiTranslate="metrics.jvm.threads.title">Threads</h4>
        <span><span jhiTranslate="metrics.jvm.threads.runnable">Runnable</span> {{ threadStats.threadDumpRunnable }}</span>
        <ngb-progressbar
            [value]="threadStats.threadDumpRunnable"
            [max]="threadStats.threadDumpAll"
            [striped]="true"
            [animated]="false"
            type="success"
        >
            <span>{{ (threadStats.threadDumpRunnable * 100) / threadStats.threadDumpAll | number: '1.0-0' }}%</span>
        </ngb-progressbar>
        <span><span jhiTranslate="metrics.jvm.threads.timedwaiting">Timed Waiting</span> ({{ threadStats.threadDumpTimedWaiting }})</span>
        <ngb-progressbar
            [value]="threadStats.threadDumpTimedWaiting"
            [max]="threadStats.threadDumpAll"
            [striped]="true"
            [animated]="false"
            type="warning"
        >
            <span>{{ (threadStats.threadDumpTimedWaiting * 100) / threadStats.threadDumpAll | number: '1.0-0' }}%</span>
        </ngb-progressbar>
        <span><span jhiTranslate="metrics.jvm.threads.waiting">Waiting</span> ({{ threadStats.threadDumpWaiting }})</span>
        <ngb-progressbar
            [value]="threadStats.threadDumpWaiting"
            [max]="threadStats.threadDumpAll"
            [striped]="true"
            [animated]="false"
            type="warning"
        >
            <span>{{ (threadStats.threadDumpWaiting * 100) / threadStats.threadDumpAll | number: '1.0-0' }}%</span>
        </ngb-progressbar>
        <span><span jhiTranslate="metrics.jvm.threads.blocked">Blocked</span> ({{ threadStats.threadDumpBlocked }})</span>
        <ngb-progressbar
            [value]="threadStats.threadDumpBlocked"
            [max]="threadStats.threadDumpAll"
            [striped]="true"
            [animated]="false"
            type="success"
        >
            <span>{{ (threadStats.threadDumpBlocked * 100) / threadStats.threadDumpAll | number: '1.0-0' }}%</span>
        </ngb-progressbar>
        <div>Total: {{ threadStats.threadDumpAll }}</div>
        <button class="hand btn btn-primary btn-sm" (click)="open()" data-toggle="modal" data-target="#threadDump">
            <span>Expand</span>
        </button>
    `
            },] }
];
JhiJvmThreadsComponent.ctorParameters = () => [
    { type: NgbModal }
];
JhiJvmThreadsComponent.propDecorators = {
    threadData: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMetricsCacheComponent {
    filterNaN(input) {
        if (isNaN(input)) {
            return 0;
        }
        return input;
    }
}
JhiMetricsCacheComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-metrics-cache',
                template: `
        <h3 jhiTranslate="metrics.cache.title">Cache statistics</h3>
        <div class="table-responsive" *ngIf="!updating">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th jhiTranslate="metrics.cache.cachename">Cache name</th>
                        <th class="text-right" data-translate="metrics.cache.hits">Cache Hits</th>
                        <th class="text-right" data-translate="metrics.cache.misses">Cache Misses</th>
                        <th class="text-right" data-translate="metrics.cache.gets">Cache Gets</th>
                        <th class="text-right" data-translate="metrics.cache.puts">Cache Puts</th>
                        <th class="text-right" data-translate="metrics.cache.removals">Cache Removals</th>
                        <th class="text-right" data-translate="metrics.cache.evictions">Cache Evictions</th>
                        <th class="text-right" data-translate="metrics.cache.hitPercent">Cache Hit %</th>
                        <th class="text-right" data-translate="metrics.cache.missPercent">Cache Miss %</th>
                    </tr>
                </thead>
                <tbody>
                    <tr *ngFor="let entry of (cacheMetrics | keys)">
                        <td>{{ entry.key }}</td>
                        <td class="text-right">{{ entry.value['cache.gets.hit'] }}</td>
                        <td class="text-right">{{ entry.value['cache.gets.miss'] }}</td>
                        <td class="text-right">{{ entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'] }}</td>
                        <td class="text-right">{{ entry.value['cache.puts'] }}</td>
                        <td class="text-right">{{ entry.value['cache.removals'] }}</td>
                        <td class="text-right">{{ entry.value['cache.evictions'] }}</td>
                        <td class="text-right">
                            {{
                                filterNaN(
                                    (100 * entry.value['cache.gets.hit']) / (entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'])
                                ) | number: '1.0-4'
                            }}
                        </td>
                        <td class="text-right">
                            {{
                                filterNaN(
                                    (100 * entry.value['cache.gets.miss']) /
                                        (entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'])
                                ) | number: '1.0-4'
                            }}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    `
            },] }
];
JhiMetricsCacheComponent.propDecorators = {
    cacheMetrics: [{ type: Input }],
    updating: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMetricsDatasourceComponent {
    filterNaN(input) {
        if (isNaN(input)) {
            return 0;
        }
        return input;
    }
}
JhiMetricsDatasourceComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-metrics-datasource',
                template: `
        <h3 jhiTranslate="metrics.datasource.title">DataSource statistics (time in millisecond)</h3>
        <div class="table-responsive" *ngIf="!updating">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>
                            <span jhiTranslate="metrics.datasource.usage">Connection Pool Usage</span> (active:
                            {{ datasourceMetrics.active.value }}, min: {{ datasourceMetrics.min.value }}, max:
                            {{ datasourceMetrics.max.value }}, idle: {{ datasourceMetrics.idle.value }})
                        </th>
                        <th class="text-right" jhiTranslate="metrics.datasource.count">Count</th>
                        <th class="text-right" jhiTranslate="metrics.datasource.mean">Mean</th>
                        <th class="text-right" jhiTranslate="metrics.servicesstats.table.min">Min</th>
                        <th class="text-right" jhiTranslate="metrics.servicesstats.table.p50">p50</th>
                        <th class="text-right" jhiTranslate="metrics.servicesstats.table.p75">p75</th>
                        <th class="text-right" jhiTranslate="metrics.servicesstats.table.p95">p95</th>
                        <th class="text-right" jhiTranslate="metrics.servicesstats.table.p99">p99</th>
                        <th class="text-right" jhiTranslate="metrics.datasource.max">Max</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>Acquire</td>
                        <td class="text-right">{{ datasourceMetrics.acquire.count }}</td>
                        <td class="text-right">{{ filterNaN(datasourceMetrics.acquire.mean) | number: '1.0-2' }}</td>
                        <td class="text-right">{{ datasourceMetrics.acquire['0.0'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.acquire['0.5'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.acquire['0.75'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.acquire['0.95'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.acquire['0.99'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ filterNaN(datasourceMetrics.acquire.max) | number: '1.0-2' }}</td>
                    </tr>
                    <tr>
                        <td>Creation</td>
                        <td class="text-right">{{ datasourceMetrics.creation.count }}</td>
                        <td class="text-right">{{ filterNaN(datasourceMetrics.creation.mean) | number: '1.0-2' }}</td>
                        <td class="text-right">{{ datasourceMetrics.creation['0.0'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.creation['0.5'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.creation['0.75'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.creation['0.95'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.creation['0.99'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ filterNaN(datasourceMetrics.creation.max) | number: '1.0-2' }}</td>
                    </tr>
                    <tr>
                        <td>Usage</td>
                        <td class="text-right">{{ datasourceMetrics.usage.count }}</td>
                        <td class="text-right">{{ filterNaN(datasourceMetrics.usage.mean) | number: '1.0-2' }}</td>
                        <td class="text-right">{{ datasourceMetrics.usage['0.0'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.usage['0.5'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.usage['0.75'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.usage['0.95'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ datasourceMetrics.usage['0.99'] | number: '1.0-3' }}</td>
                        <td class="text-right">{{ filterNaN(datasourceMetrics.usage.max) | number: '1.0-2' }}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    `
            },] }
];
JhiMetricsDatasourceComponent.propDecorators = {
    datasourceMetrics: [{ type: Input }],
    updating: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMetricsEndpointsRequestsComponent {
}
JhiMetricsEndpointsRequestsComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-metrics-endpoints-requests',
                template: `
        <h3>Endpoints requests (time in millisecond)</h3>
        <div class="table-responsive" *ngIf="!updating">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>Method</th>
                        <th>Endpoint url</th>
                        <th class="text-right">Count</th>
                        <th class="text-right">Mean</th>
                    </tr>
                </thead>
                <tbody>
                    <ng-container *ngFor="let entry of (endpointsRequestsMetrics | keys)">
                        <tr *ngFor="let method of (entry.value | keys)">
                            <td>{{ method.key }}</td>
                            <td>{{ entry.key }}</td>
                            <td class="text-right">{{ method.value.count }}</td>
                            <td class="text-right">{{ method.value.mean | number: '1.0-3' }}</td>
                        </tr>
                    </ng-container>
                </tbody>
            </table>
        </div>
    `
            },] }
];
JhiMetricsEndpointsRequestsComponent.propDecorators = {
    endpointsRequestsMetrics: [{ type: Input }],
    updating: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMetricsGarbageCollectorComponent {
}
JhiMetricsGarbageCollectorComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-metrics-garbagecollector',
                template: `
        <div class="row">
            <div class="col-md-4">
                <div *ngIf="garbageCollectorMetrics">
                    <span>
                        GC Live Data Size/GC Max Data Size ({{
                            garbageCollectorMetrics['jvm.gc.live.data.size'] / 1048576 | number: '1.0-0'
                        }}M / {{ garbageCollectorMetrics['jvm.gc.max.data.size'] / 1048576 | number: '1.0-0' }}M)</span
                    >
                    <ngb-progressbar
                        [max]="garbageCollectorMetrics['jvm.gc.max.data.size']"
                        [value]="garbageCollectorMetrics['jvm.gc.live.data.size']"
                        [striped]="true"
                        [animated]="false"
                        type="success"
                    >
                        <span
                            >{{
                                (100 * garbageCollectorMetrics['jvm.gc.live.data.size']) / garbageCollectorMetrics['jvm.gc.max.data.size']
                                    | number: '1.0-2'
                            }}%</span
                        >
                    </ngb-progressbar>
                </div>
            </div>
            <div class="col-md-4">
                <div *ngIf="garbageCollectorMetrics">
                    <span>
                        GC Memory Promoted/GC Memory Allocated ({{
                            garbageCollectorMetrics['jvm.gc.memory.promoted'] / 1048576 | number: '1.0-0'
                        }}M / {{ garbageCollectorMetrics['jvm.gc.memory.allocated'] / 1048576 | number: '1.0-0' }}M)</span
                    >
                    <ngb-progressbar
                        [max]="garbageCollectorMetrics['jvm.gc.memory.allocated']"
                        [value]="garbageCollectorMetrics['jvm.gc.memory.promoted']"
                        [striped]="true"
                        [animated]="false"
                        type="success"
                    >
                        <span
                            >{{
                                (100 * garbageCollectorMetrics['jvm.gc.memory.promoted']) /
                                    garbageCollectorMetrics['jvm.gc.memory.allocated'] | number: '1.0-2'
                            }}%</span
                        >
                    </ngb-progressbar>
                </div>
            </div>
            <div class="col-md-4">
                <div class="row" *ngIf="garbageCollectorMetrics">
                    <div class="col-md-9">Classes loaded</div>
                    <div class="col-md-3 text-right">{{ garbageCollectorMetrics.classesLoaded }}</div>
                </div>
                <div class="row" *ngIf="garbageCollectorMetrics">
                    <div class="col-md-9">Classes unloaded</div>
                    <div class="col-md-3 text-right">{{ garbageCollectorMetrics.classesUnloaded }}</div>
                </div>
            </div>
            <div class="table-responsive" *ngIf="!updating && garbageCollectorMetrics">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th></th>
                            <th class="text-right" jhiTranslate="metrics.servicesstats.table.count">Count</th>
                            <th class="text-right" jhiTranslate="metrics.servicesstats.table.mean">Mean</th>
                            <th class="text-right" jhiTranslate="metrics.servicesstats.table.min">Min</th>
                            <th class="text-right" jhiTranslate="metrics.servicesstats.table.p50">p50</th>
                            <th class="text-right" jhiTranslate="metrics.servicesstats.table.p75">p75</th>
                            <th class="text-right" jhiTranslate="metrics.servicesstats.table.p95">p95</th>
                            <th class="text-right" jhiTranslate="metrics.servicesstats.table.p99">p99</th>
                            <th class="text-right" jhiTranslate="metrics.servicesstats.table.max">Max</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>jvm.gc.pause</td>
                            <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause'].count }}</td>
                            <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause'].mean | number: '1.0-3' }}</td>
                            <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.0'] | number: '1.0-3' }}</td>
                            <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.5'] | number: '1.0-3' }}</td>
                            <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.75'] | number: '1.0-3' }}</td>
                            <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.95'] | number: '1.0-3' }}</td>
                            <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause']['0.99'] | number: '1.0-3' }}</td>
                            <td class="text-right">{{ garbageCollectorMetrics['jvm.gc.pause'].max | number: '1.0-3' }}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    `
            },] }
];
JhiMetricsGarbageCollectorComponent.propDecorators = {
    garbageCollectorMetrics: [{ type: Input }],
    updating: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMetricsHttpRequestComponent {
    filterNaN(input) {
        if (isNaN(input)) {
            return 0;
        }
        return input;
    }
}
JhiMetricsHttpRequestComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-metrics-request',
                template: `
        <h3 jhiTranslate="metrics.jvm.http.title">HTTP requests (time in millisecond)</h3>
        <table class="table table-striped" *ngIf="!updating">
            <thead>
                <tr>
                    <th jhiTranslate="metrics.jvm.http.table.code">Code</th>
                    <th jhiTranslate="metrics.jvm.http.table.count">Count</th>
                    <th class="text-right" jhiTranslate="metrics.jvm.http.table.mean">Mean</th>
                    <th class="text-right" jhiTranslate="metrics.jvm.http.table.max">Max</th>
                </tr>
            </thead>
            <tbody>
                <tr *ngFor="let entry of (requestMetrics['percode'] | keys)">
                    <td>{{ entry.key }}</td>
                    <td>
                        <ngb-progressbar
                            [max]="requestMetrics['all'].count"
                            [value]="entry.value.count"
                            [striped]="true"
                            [animated]="false"
                            type="success"
                        >
                            <span>{{ entry.value.count }}</span>
                        </ngb-progressbar>
                    </td>
                    <td class="text-right">
                        {{ filterNaN(entry.value.mean) | number: '1.0-2' }}
                    </td>
                    <td class="text-right">{{ entry.value.max | number: '1.0-2' }}</td>
                </tr>
            </tbody>
        </table>
    `
            },] }
];
JhiMetricsHttpRequestComponent.propDecorators = {
    requestMetrics: [{ type: Input }],
    updating: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiMetricsSystemComponent {
    convertMillisecondsToDuration(ms) {
        const times = {
            year: 31557600000,
            month: 2629746000,
            day: 86400000,
            hour: 3600000,
            minute: 60000,
            second: 1000
        };
        let timeString = '';
        for (const key in times) {
            if (Math.floor(ms / times[key]) > 0) {
                let plural = '';
                if (Math.floor(ms / times[key]) > 1) {
                    plural = 's';
                }
                timeString += Math.floor(ms / times[key]).toString() + ' ' + key.toString() + plural + ' ';
                ms = ms - times[key] * Math.floor(ms / times[key]);
            }
        }
        return timeString;
    }
}
JhiMetricsSystemComponent.decorators = [
    { type: Component, args: [{
                selector: 'jhi-metrics-system',
                template: `
        <h4>System</h4>
        <div class="row" *ngIf="!updating">
            <div class="col-md-4">Uptime</div>
            <div class="col-md-8 text-right">{{ convertMillisecondsToDuration(systemMetrics['process.uptime']) }}</div>
        </div>
        <div class="row" *ngIf="!updating">
            <div class="col-md-4">Start time</div>
            <div class="col-md-8 text-right">{{ systemMetrics['process.start.time'] | date: 'full' }}</div>
        </div>
        <div class="row" *ngIf="!updating">
            <div class="col-md-9">Process CPU usage</div>
            <div class="col-md-3 text-right">{{ 100 * systemMetrics['process.cpu.usage'] | number: '1.0-2' }} %</div>
        </div>
        <ngb-progressbar
            [value]="100 * systemMetrics['process.cpu.usage']"
            [striped]="true"
            [animated]="false"
            type="success"
            *ngIf="!updating"
        >
            <span>{{ 100 * systemMetrics['process.cpu.usage'] | number: '1.0-2' }} %</span>
        </ngb-progressbar>
        <div class="row" *ngIf="!updating">
            <div class="col-md-9">System CPU usage</div>
            <div class="col-md-3 text-right">{{ 100 * systemMetrics['system.cpu.usage'] | number: '1.0-2' }} %</div>
        </div>
        <ngb-progressbar
            [value]="100 * systemMetrics['system.cpu.usage']"
            [striped]="true"
            [animated]="false"
            type="success"
            *ngIf="!updating"
        >
            <span>{{ 100 * systemMetrics['system.cpu.usage'] | number: '1.0-2' }} %</span>
        </ngb-progressbar>
        <div class="row" *ngIf="!updating">
            <div class="col-md-9">System CPU count</div>
            <div class="col-md-3 text-right">{{ systemMetrics['system.cpu.count'] }}</div>
        </div>
        <div class="row" *ngIf="!updating">
            <div class="col-md-9">System 1m Load average</div>
            <div class="col-md-3 text-right">{{ systemMetrics['system.load.average.1m'] | number: '1.0-2' }}</div>
        </div>
        <div class="row" *ngIf="!updating">
            <div class="col-md-9">Process files max</div>
            <div class="col-md-3 text-right">{{ systemMetrics['process.files.max'] | number: '1.0-0' }}</div>
        </div>
        <div class="row" *ngIf="!updating">
            <div class="col-md-9">Process files open</div>
            <div class="col-md-3 text-right">{{ systemMetrics['process.files.open'] | number: '1.0-0' }}</div>
        </div>
    `
            },] }
];
JhiMetricsSystemComponent.propDecorators = {
    systemMetrics: [{ type: Input }],
    updating: [{ type: Input }]
};

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiCapitalizePipe {
    transform(input) {
        if (input !== null) {
            input = input.toLowerCase();
        }
        return input.substring(0, 1).toUpperCase() + input.substring(1);
    }
}
JhiCapitalizePipe.decorators = [
    { type: Pipe, args: [{ name: 'capitalize' },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiFilterPipe {
    transform(input, filter, field) {
        if (typeof filter === 'undefined' || filter === '') {
            return input;
        }
        // if filter is of type 'function' compute current value of filter, otherwise return filter
        const currentFilter = typeof filter === 'function' ? filter() : filter;
        if (typeof currentFilter === 'number') {
            return input.filter(this.filterByNumber(currentFilter, field));
        }
        if (typeof currentFilter === 'boolean') {
            return input.filter(this.filterByBoolean(currentFilter, field));
        }
        if (typeof currentFilter === 'string') {
            return input.filter(this.filterByString(currentFilter, field));
        }
        if (typeof currentFilter === 'object') {
            // filter by object ignores 'field' if specified
            return input.filter(this.filterByObject(currentFilter));
        }
        // 'symbol' && 'undefined'
        return input.filter(this.filterDefault(currentFilter, field));
    }
    filterByNumber(filter, field) {
        return value => (value && !filter) || (typeof value === 'object' && field)
            ? value[field] && typeof value[field] === 'number' && value[field] === filter
            : typeof value === 'number' && value === filter;
    }
    filterByBoolean(filter, field) {
        return value => typeof value === 'object' && field
            ? value[field] && typeof value[field] === 'boolean' && value[field] === filter
            : typeof value === 'boolean' && value === filter;
    }
    filterByString(filter, field) {
        return value => (value && !filter) || (typeof value === 'object' && field)
            ? value[field] && typeof value[field] === 'string' && value[field].toLowerCase().includes(filter.toLowerCase())
            : typeof value === 'string' && value.toLowerCase().includes(filter.toLowerCase());
    }
    filterDefault(filter, field) {
        return value => ((value && !filter) || (typeof value === 'object' && field) ? value[field] && filter === value : filter === value);
    }
    filterByObject(filter) {
        return value => {
            const keys = Object.keys(filter);
            let isMatching = false;
            // all fields defined in filter object must match
            for (const key of keys) {
                if (typeof filter[key] === 'number') {
                    isMatching = this.filterByNumber(filter[key])(value[key]);
                }
                else if (typeof filter[key] === 'boolean') {
                    isMatching = this.filterByBoolean(filter[key])(value[key]);
                }
                else if (typeof filter[key] === 'string') {
                    isMatching = this.filterByString(filter[key])(value[key]);
                }
                else {
                    isMatching = this.filterDefault(filter[key])(value[key]);
                }
            }
            return isMatching;
        };
    }
}
JhiFilterPipe.decorators = [
    { type: Pipe, args: [{ name: 'filter', pure: false },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiKeysPipe {
    transform(value) {
        const keys = [];
        const valueKeys = Object.keys(value);
        for (const key of valueKeys) {
            keys.push({ key, value: value[key] });
        }
        return keys;
    }
}
JhiKeysPipe.decorators = [
    { type: Pipe, args: [{ name: 'keys' },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiOrderByPipe {
    transform(values, predicate = '', reverse = false) {
        if (predicate === '') {
            return reverse ? values.sort().reverse() : values.sort();
        }
        return values.sort((a, b) => {
            if (a[predicate] < b[predicate]) {
                return reverse ? 1 : -1;
            }
            else if (b[predicate] < a[predicate]) {
                return reverse ? -1 : 1;
            }
            return 0;
        });
    }
}
JhiOrderByPipe.decorators = [
    { type: Pipe, args: [{ name: 'orderBy' },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiPureFilterPipe extends JhiFilterPipe {
    transform(input, filter, field) {
        return super.transform(input, filter, field);
    }
}
JhiPureFilterPipe.decorators = [
    { type: Pipe, args: [{ name: 'pureFilter' },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiTruncateCharactersPipe {
    transform(input, chars, breakOnWord) {
        if (isNaN(chars)) {
            return input;
        }
        if (chars <= 0) {
            return '';
        }
        if (input && input.length > chars) {
            input = input.substring(0, chars);
            if (!breakOnWord) {
                const lastspace = input.lastIndexOf(' ');
                // Get last space
                if (lastspace !== -1) {
                    input = input.substr(0, lastspace);
                }
            }
            else {
                while (input.endsWith(' ')) {
                    input = input.substr(0, input.length - 1);
                }
            }
            return input + '...';
        }
        return input;
    }
}
JhiTruncateCharactersPipe.decorators = [
    { type: Pipe, args: [{ name: 'truncateCharacters' },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiTruncateWordsPipe {
    transform(input, words) {
        if (isNaN(words)) {
            return input;
        }
        if (words <= 0) {
            return '';
        }
        if (input) {
            const inputWords = input.split(/\s+/);
            if (inputWords.length > words) {
                input = inputWords.slice(0, words).join(' ') + '...';
            }
        }
        return input;
    }
}
JhiTruncateWordsPipe.decorators = [
    { type: Pipe, args: [{ name: 'truncateWords' },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
const JHI_PIPES = [
    JhiCapitalizePipe,
    JhiFilterPipe,
    JhiKeysPipe,
    JhiOrderByPipe,
    JhiPureFilterPipe,
    JhiTruncateCharactersPipe,
    JhiTruncateWordsPipe
];
const JHI_DIRECTIVES = [
    JhiMaxValidatorDirective,
    JhiMinValidatorDirective,
    JhiMaxbytesValidatorDirective,
    JhiMinbytesValidatorDirective,
    JhiSortDirective,
    JhiSortByDirective
];
const JHI_COMPONENTS = [
    JhiItemCountComponent,
    JhiBooleanComponent,
    JhiJvmMemoryComponent,
    JhiJvmThreadsComponent,
    JhiMetricsHttpRequestComponent,
    JhiMetricsEndpointsRequestsComponent,
    JhiMetricsCacheComponent,
    JhiMetricsDatasourceComponent,
    JhiMetricsSystemComponent,
    JhiMetricsGarbageCollectorComponent,
    JhiThreadModalComponent
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
function translatePartialLoader(http) {
    return new TranslateHttpLoader(http, 'i18n/', `.json?buildTimestamp=${process.env.BUILD_TIMESTAMP}`);
}
function missingTranslationHandler(configService) {
    return new JhiMissingTranslationHandler(configService);
}
class NgJhipsterModule {
    static forRoot(moduleConfig) {
        return {
            ngModule: NgJhipsterModule,
            providers: [{ provide: JhiModuleConfig, useValue: moduleConfig }],
        };
    }
}
NgJhipsterModule.decorators = [
    { type: NgModule, args: [{
                imports: [CommonModule, NgbModule, FormsModule],
                declarations: [...JHI_PIPES, ...JHI_DIRECTIVES, ...JHI_COMPONENTS, JhiTranslateDirective],
                entryComponents: [JhiThreadModalComponent],
                exports: [...JHI_PIPES, ...JHI_DIRECTIVES, ...JHI_COMPONENTS, JhiTranslateDirective, CommonModule],
            },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
/**
 * An utility service for pagination
 */
class JhiPaginationUtil {
    constructor() { }
    /**
     * Method to find whether the sort is defined
     */
    parseAscending(sort) {
        let sortArray = sort.split(',');
        sortArray = sortArray.length > 1 ? sortArray : sort.split('%2C');
        if (sortArray.length > 1) {
            return sortArray.slice(-1)[0] === 'asc';
        }
        // default to true if no sort is defined
        return true;
    }
    /**
     * Method to query params are strings, and need to be parsed
     */
    parsePage(page) {
        return parseInt(page, 10);
    }
    /**
     * Method to sort can be in the format `id,asc` or `id`
     */
    parsePredicate(sort) {
        return sort.split(',')[0].split('%2C')[0];
    }
}
JhiPaginationUtil.ɵprov = ɵɵdefineInjectable({ factory: function JhiPaginationUtil_Factory() { return new JhiPaginationUtil(); }, token: JhiPaginationUtil, providedIn: "root" });
JhiPaginationUtil.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiPaginationUtil.ctorParameters = () => [];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
/**
 * An utility service for link parsing.
 */
class JhiParseLinks {
    constructor() { }
    /**
     * Method to parse the links
     */
    parse(header) {
        if (header.length === 0) {
            throw new Error('input must not be of zero length');
        }
        // Split parts by comma
        const parts = header.split(',');
        const links = {};
        // Parse each part into a named link
        parts.forEach(p => {
            const section = p.split(';');
            if (section.length !== 2) {
                throw new Error('section could not be split on ";"');
            }
            const url = section[0].replace(/<(.*)>/, '$1').trim();
            const queryString = {};
            url.replace(new RegExp('([^?=&]+)(=([^&]*))?', 'g'), ($0, $1, $2, $3) => (queryString[$1] = $3));
            let page = queryString.page;
            if (typeof page === 'string') {
                page = parseInt(page, 10);
            }
            const name = section[1].replace(/rel="(.*)"/, '$1').trim();
            links[name] = page;
        });
        return links;
    }
}
JhiParseLinks.ɵprov = ɵɵdefineInjectable({ factory: function JhiParseLinks_Factory() { return new JhiParseLinks(); }, token: JhiParseLinks, providedIn: "root" });
JhiParseLinks.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiParseLinks.ctorParameters = () => [];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
/**
 * An utility service for data.
 */
class JhiDataUtils {
    constructor() { }
    /**
     * Method to abbreviate the text given
     */
    abbreviate(text, append = '...') {
        if (text.length < 30) {
            return text;
        }
        return text ? text.substring(0, 15) + append + text.slice(-10) : '';
    }
    /**
     * Method to find the byte size of the string provides
     */
    byteSize(base64String) {
        return this.formatAsBytes(this.size(base64String));
    }
    /**
     * Method to open file
     */
    openFile(contentType, data) {
        if (window.navigator && window.navigator.msSaveOrOpenBlob) {
            // To support IE and Edge
            const byteCharacters = atob(data);
            const byteNumbers = new Array(byteCharacters.length);
            for (let i = 0; i < byteCharacters.length; i++) {
                byteNumbers[i] = byteCharacters.charCodeAt(i);
            }
            const byteArray = new Uint8Array(byteNumbers);
            const blob = new Blob([byteArray], {
                type: contentType
            });
            window.navigator.msSaveOrOpenBlob(blob);
        }
        else {
            // Other browsers
            const fileURL = `data:${contentType};base64,${data}`;
            const win = window.open();
            win.document.write('<iframe src="' +
                fileURL +
                '" frameborder="0" style="border:0; top:0; left:0; bottom:0; right:0; width:100%; height:100%;" allowfullscreen></iframe>');
        }
    }
    /**
     * Method to convert the file to base64
     */
    toBase64(file, cb) {
        const fileReader = new FileReader();
        fileReader.onload = function (e) {
            const base64Data = e.target.result.substr(e.target.result.indexOf('base64,') + 'base64,'.length);
            cb(base64Data);
        };
        fileReader.readAsDataURL(file);
    }
    /**
     * Method to clear the input
     */
    clearInputImage(entity, elementRef, field, fieldContentType, idInput) {
        if (entity && field && fieldContentType) {
            if (Object.prototype.hasOwnProperty.call(entity, field)) {
                entity[field] = null;
            }
            if (Object.prototype.hasOwnProperty.call(entity, fieldContentType)) {
                entity[fieldContentType] = null;
            }
            if (elementRef && idInput && elementRef.nativeElement.querySelector('#' + idInput)) {
                elementRef.nativeElement.querySelector('#' + idInput).value = null;
            }
        }
    }
    /**
     * Sets the base 64 data & file type of the 1st file on the event (event.target.files[0]) in the passed entity object
     * and returns a promise.
     *
     * @param event the object containing the file (at event.target.files[0])
     * @param entity the object to set the file's 'base 64 data' and 'file type' on
     * @param field the field name to set the file's 'base 64 data' on
     * @param isImage boolean representing if the file represented by the event is an image
     * @returns a promise that resolves to the modified entity if operation is successful, otherwise rejects with an error message
     */
    setFileData(event, entity, field, isImage) {
        return new Promise((resolve, reject) => {
            if (event && event.target && event.target.files && event.target.files[0]) {
                const file = event.target.files[0];
                if (isImage && !file.type.startsWith('image/')) {
                    reject(`File was expected to be an image but was found to be ${file.type}`);
                }
                else {
                    this.toBase64(file, base64Data => {
                        entity[field] = base64Data;
                        entity[`${field}ContentType`] = file.type;
                        resolve(entity);
                    });
                }
            }
            else {
                reject(`Base64 data was not set as file could not be extracted from passed parameter: ${event}`);
            }
        });
    }
    /**
     * Sets the base 64 data & file type of the 1st file on the event (event.target.files[0]) in the passed entity object
     * and returns an observable.
     *
     * @param event the object containing the file (at event.target.files[0])
     * @param editForm the form group where the input field is located
     * @param field the field name to set the file's 'base 64 data' on
     * @param isImage boolean representing if the file represented by the event is an image
     * @returns an observable that loads file to form field and completes if sussessful
     *          or returns error as JhiFileLoadError on failure
     */
    loadFileToForm(event, editForm, field, isImage) {
        return new Observable((observer) => {
            const eventTarget = event.target;
            if (eventTarget.files && eventTarget.files[0]) {
                const file = eventTarget.files[0];
                if (isImage && !file.type.startsWith('image/')) {
                    const error = {
                        message: `File was expected to be an image but was found to be '${file.type}'`,
                        key: 'not.image',
                        params: { fileType: file.type }
                    };
                    observer.error(error);
                }
                else {
                    const fieldContentType = field + 'ContentType';
                    this.toBase64(file, (base64Data) => {
                        editForm.patchValue({
                            [field]: base64Data,
                            [fieldContentType]: file.type
                        });
                        observer.next();
                        observer.complete();
                    });
                }
            }
            else {
                const error = {
                    message: 'Could not extract file',
                    key: 'could.not.extract',
                    params: { event }
                };
                observer.error(error);
            }
        });
    }
    /**
     * Method to download file
     */
    downloadFile(contentType, data, fileName) {
        const byteCharacters = atob(data);
        const byteNumbers = new Array(byteCharacters.length);
        for (let i = 0; i < byteCharacters.length; i++) {
            byteNumbers[i] = byteCharacters.charCodeAt(i);
        }
        const byteArray = new Uint8Array(byteNumbers);
        const blob = new Blob([byteArray], {
            type: contentType
        });
        const tempLink = document.createElement('a');
        tempLink.href = window.URL.createObjectURL(blob);
        tempLink.download = fileName;
        tempLink.target = '_blank';
        tempLink.click();
    }
    endsWith(suffix, str) {
        return str.includes(suffix, str.length - suffix.length);
    }
    paddingSize(value) {
        if (this.endsWith('==', value)) {
            return 2;
        }
        if (this.endsWith('=', value)) {
            return 1;
        }
        return 0;
    }
    size(value) {
        return (value.length / 4) * 3 - this.paddingSize(value);
    }
    formatAsBytes(size) {
        return size.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ') + ' bytes';
    }
}
JhiDataUtils.ɵprov = ɵɵdefineInjectable({ factory: function JhiDataUtils_Factory() { return new JhiDataUtils(); }, token: JhiDataUtils, providedIn: "root" });
JhiDataUtils.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiDataUtils.ctorParameters = () => [];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
/**
 * An utility service for date.
 */
class JhiDateUtils {
    constructor() {
        this.pattern = 'yyyy-MM-dd';
        this.datePipe = new DatePipe('en');
    }
    /**
     * Method to convert the date time from server into JS date object
     */
    convertDateTimeFromServer(date) {
        if (date) {
            return new Date(date);
        }
        else {
            return null;
        }
    }
    /**
     * Method to convert the date from server into JS date object
     */
    convertLocalDateFromServer(date) {
        if (date) {
            const dateString = date.split('-');
            return new Date(dateString[0], dateString[1] - 1, dateString[2]);
        }
        return null;
    }
    /**
     * Method to convert the JS date object into specified date pattern
     */
    convertLocalDateToServer(date, pattern = this.pattern) {
        if (date) {
            const newDate = new Date(date.year, date.month - 1, date.day);
            return this.datePipe.transform(newDate, pattern);
        }
        else {
            return null;
        }
    }
    /**
     * Method to get the default date pattern
     */
    dateformat() {
        return this.pattern;
    }
    // TODO Change this method when moving from datetime-local input to NgbDatePicker
    toDate(date) {
        if (date === undefined || date === null) {
            return null;
        }
        const dateParts = date.split(/\D+/);
        if (dateParts.length === 7) {
            return new Date(dateParts[0], dateParts[1] - 1, dateParts[2], dateParts[3], dateParts[4], dateParts[5], dateParts[6]);
        }
        if (dateParts.length === 6) {
            return new Date(dateParts[0], dateParts[1] - 1, dateParts[2], dateParts[3], dateParts[4], dateParts[5]);
        }
        return new Date(dateParts[0], dateParts[1] - 1, dateParts[2], dateParts[3], dateParts[4]);
    }
}
JhiDateUtils.ɵprov = ɵɵdefineInjectable({ factory: function JhiDateUtils_Factory() { return new JhiDateUtils(); }, token: JhiDateUtils, providedIn: "root" });
JhiDateUtils.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiDateUtils.ctorParameters = () => [];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
/**
 * An utility class to manage RX events
 */
class JhiEventManager {
    constructor() {
        this.observable = Observable.create((observer) => {
            this.observer = observer;
        }).pipe(share());
    }
    /**
     * Method to broadcast the event to observer
     */
    broadcast(event) {
        if (this.observer) {
            this.observer.next(event);
        }
    }
    /**
     * Method to subscribe to an event with callback
     */
    subscribe(eventName, callback) {
        const subscriber = this.observable
            .pipe(filter((event) => {
            if (typeof event === 'string') {
                return event === eventName;
            }
            return event.name === eventName;
        }), map((event) => {
            if (typeof event !== 'string') {
                // when releasing generator-jhipster v7 then current return will be changed to
                // (to avoid redundant code response.content in JhiEventManager.subscribe callbacks):
                // return event.content;
                return event;
            }
        }))
            .subscribe(callback);
        return subscriber;
    }
    /**
     * Method to unsubscribe the subscription
     */
    destroy(subscriber) {
        subscriber.unsubscribe();
    }
}
JhiEventManager.ɵprov = ɵɵdefineInjectable({ factory: function JhiEventManager_Factory() { return new JhiEventManager(); }, token: JhiEventManager, providedIn: "root" });
JhiEventManager.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiEventManager.ctorParameters = () => [];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiEventWithContent {
    constructor(name, content) {
        this.name = name;
        this.content = content;
    }
}

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiAlertService {
    constructor(sanitizer, configService, ngZone, translateService) {
        this.sanitizer = sanitizer;
        this.configService = configService;
        this.ngZone = ngZone;
        this.translateService = translateService;
        const config = this.configService.getConfig();
        this.toast = config.alertAsToast;
        this.i18nEnabled = config.i18nEnabled;
        this.alertId = 0; // unique id for each alert. Starts from 0.
        this.alerts = [];
        this.timeout = config.alertTimeout;
    }
    clear() {
        this.alerts.splice(0, this.alerts.length);
    }
    get() {
        return this.alerts;
    }
    success(msg, params, position) {
        return this.addAlert({
            type: 'success',
            msg,
            params,
            timeout: this.timeout,
            toast: this.isToast(),
            position
        }, []);
    }
    error(msg, params, position) {
        return this.addAlert({
            type: 'danger',
            msg,
            params,
            timeout: this.timeout,
            toast: this.isToast(),
            position
        }, []);
    }
    warning(msg, params, position) {
        return this.addAlert({
            type: 'warning',
            msg,
            params,
            timeout: this.timeout,
            toast: this.isToast(),
            position
        }, []);
    }
    info(msg, params, position) {
        return this.addAlert({
            type: 'info',
            msg,
            params,
            timeout: this.timeout,
            toast: this.isToast(),
            position
        }, []);
    }
    addAlert(alertOptions, extAlerts) {
        alertOptions.id = this.alertId++;
        if (this.i18nEnabled && alertOptions.msg) {
            alertOptions.msg = this.translateService.instant(alertOptions.msg, alertOptions.params);
        }
        const alert = this.factory(alertOptions);
        if (alertOptions.timeout && alertOptions.timeout > 0) {
            // Workaround protractor waiting for setTimeout.
            // Reference https://www.protractortest.org/#/timeouts
            this.ngZone.runOutsideAngular(() => {
                setTimeout(() => {
                    this.ngZone.run(() => {
                        this.closeAlert(alertOptions.id, extAlerts);
                    });
                }, alertOptions.timeout);
            });
        }
        return alert;
    }
    closeAlert(id, extAlerts) {
        const thisAlerts = extAlerts && extAlerts.length > 0 ? extAlerts : this.alerts;
        return this.closeAlertByIndex(thisAlerts.map(e => e.id).indexOf(id), thisAlerts);
    }
    closeAlertByIndex(index, thisAlerts) {
        return thisAlerts.splice(index, 1);
    }
    isToast() {
        return this.toast;
    }
    factory(alertOptions) {
        const alert = {
            type: alertOptions.type,
            msg: this.sanitizer.sanitize(SecurityContext.HTML, alertOptions.msg),
            id: alertOptions.id,
            timeout: alertOptions.timeout,
            toast: alertOptions.toast,
            position: alertOptions.position ? alertOptions.position : 'top right',
            scoped: alertOptions.scoped,
            close: (alerts) => {
                return this.closeAlert(alertOptions.id, alerts);
            }
        };
        if (!alert.scoped) {
            this.alerts.push(alert);
        }
        return alert;
    }
}
JhiAlertService.ɵprov = ɵɵdefineInjectable({ factory: function JhiAlertService_Factory() { return new JhiAlertService(ɵɵinject(DomSanitizer), ɵɵinject(JhiConfigService), ɵɵinject(NgZone), ɵɵinject(TranslateService, 8)); }, token: JhiAlertService, providedIn: "root" });
JhiAlertService.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiAlertService.ctorParameters = () => [
    { type: DomSanitizer },
    { type: JhiConfigService },
    { type: NgZone },
    { type: TranslateService, decorators: [{ type: Optional }] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiBase64Service {
    constructor() {
        this.keyStr = 'ABCDEFGHIJKLMNOP' + 'QRSTUVWXYZabcdef' + 'ghijklmnopqrstuv' + 'wxyz0123456789+/' + '=';
    }
    encode(input) {
        let output = '';
        let enc1 = '';
        let enc2 = '';
        let enc3 = '';
        let enc4 = '';
        let chr1 = '';
        let chr2 = '';
        let chr3 = '';
        let i = 0;
        while (i < input.length) {
            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);
            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;
            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            }
            else if (isNaN(chr3)) {
                enc4 = 64;
            }
            output = output + this.keyStr.charAt(enc1) + this.keyStr.charAt(enc2) + this.keyStr.charAt(enc3) + this.keyStr.charAt(enc4);
            chr1 = chr2 = chr3 = '';
            enc1 = enc2 = enc3 = enc4 = '';
        }
        return output;
    }
    decode(input) {
        let output = '';
        let enc1 = '';
        let enc2 = '';
        let enc3 = '';
        let enc4 = '';
        let chr1 = '';
        let chr2 = '';
        let chr3 = '';
        let i = 0;
        // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
        input = input.replace(/[^A-Za-z0-9+/=]/g, '');
        while (i < input.length) {
            enc1 = this.keyStr.indexOf(input.charAt(i++));
            enc2 = this.keyStr.indexOf(input.charAt(i++));
            enc3 = this.keyStr.indexOf(input.charAt(i++));
            enc4 = this.keyStr.indexOf(input.charAt(i++));
            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;
            output = output + String.fromCharCode(chr1);
            if (enc3 !== 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 !== 64) {
                output = output + String.fromCharCode(chr3);
            }
            chr1 = chr2 = chr3 = '';
            enc1 = enc2 = enc3 = enc4 = '';
        }
        return output;
    }
}
JhiBase64Service.ɵprov = ɵɵdefineInjectable({ factory: function JhiBase64Service_Factory() { return new JhiBase64Service(); }, token: JhiBase64Service, providedIn: "root" });
JhiBase64Service.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
class JhiResolvePagingParams {
    constructor(paginationUtil) {
        this.paginationUtil = paginationUtil;
    }
    resolve(route, state) {
        const page = route.queryParams['page'] ? route.queryParams['page'] : '1';
        const defaultSort = route.data['defaultSort'] ? route.data['defaultSort'] : 'id,asc';
        const sort = route.queryParams['sort'] ? route.queryParams['sort'] : defaultSort;
        return {
            page: this.paginationUtil.parsePage(page),
            predicate: this.paginationUtil.parsePredicate(sort),
            ascending: this.paginationUtil.parseAscending(sort)
        };
    }
}
JhiResolvePagingParams.ɵprov = ɵɵdefineInjectable({ factory: function JhiResolvePagingParams_Factory() { return new JhiResolvePagingParams(ɵɵinject(JhiPaginationUtil)); }, token: JhiResolvePagingParams, providedIn: "root" });
JhiResolvePagingParams.decorators = [
    { type: Injectable, args: [{
                providedIn: 'root'
            },] }
];
JhiResolvePagingParams.ctorParameters = () => [
    { type: JhiPaginationUtil }
];

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

/*
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

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

export { JhiAlertService, JhiBase64Service, JhiBooleanComponent, JhiCapitalizePipe, JhiConfigService, JhiDataUtils, JhiDateUtils, JhiEventManager, JhiEventWithContent, JhiFilterPipe, JhiItemCountComponent, JhiKeysPipe, JhiLanguageService, JhiMaxValidatorDirective, JhiMaxbytesValidatorDirective, JhiMinValidatorDirective, JhiMinbytesValidatorDirective, JhiMissingTranslationHandler, JhiModuleConfig, JhiOrderByPipe, JhiPaginationUtil, JhiParseLinks, JhiPureFilterPipe, JhiResolvePagingParams, JhiSortByDirective, JhiSortDirective, JhiTranslateDirective, JhiTruncateCharactersPipe, JhiTruncateWordsPipe, NgJhipsterModule, missingTranslationHandler, translatePartialLoader, JHI_PIPES as ɵa, JHI_DIRECTIVES as ɵb, JHI_COMPONENTS as ɵc, JhiJvmMemoryComponent as ɵd, JhiJvmThreadsComponent as ɵe, JhiMetricsHttpRequestComponent as ɵf, JhiMetricsEndpointsRequestsComponent as ɵg, JhiMetricsCacheComponent as ɵh, JhiMetricsDatasourceComponent as ɵi, JhiMetricsSystemComponent as ɵj, JhiMetricsGarbageCollectorComponent as ɵk, JhiThreadModalComponent as ɵl };
//# sourceMappingURL=ng-jhipster.js.map