UNPKG

ngx-core-business

Version:

A comprehensive solution designed to streamline the development of enterprise-level Angular applications.

2,888 lines 155 kB
import * as i0 from '@angular/core';
import { Component, Input, HostBinding, EventEmitter, Output, NgModule, Inject, ViewChild, Injectable, Directive, ContentChild, HostListener } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule, Location } from '@angular/common';
import * as i2$1 from '@angular/material/button';
import { MatButtonModule } from '@angular/material/button';
import * as i3 from '@angular/material/icon';
import { MatIconModule } from '@angular/material/icon';
import * as i4 from '@angular/material/toolbar';
import { MatToolbarModule } from '@angular/material/toolbar';
import * as i2 from '@angular/cdk/overlay';
import { OverlayModule } from '@angular/cdk/overlay';
import * as i1$1 from '@angular/material/dialog';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angular/material/dialog';
import * as i2$2 from '@angular/platform-browser';
import { MatPaginator } from '@angular/material/paginator';
import * as i4$1 from '@angular/material/sort';
import { MatSortModule, MatSort } from '@angular/material/sort';
import * as i5 from '@angular/material/table';
import { MatTableModule, MatTable } from '@angular/material/table';
import * as i6 from '@angular/material/tooltip';
import { MatTooltipModule } from '@angular/material/tooltip';
import * as i3$1 from '@angular/material/progress-bar';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { Subject, BehaviorSubject, of } from 'rxjs';
import { finalize, debounceTime, switchMap, catchError } from 'rxjs/operators';
import * as i2$3 from '@angular/forms';
import { FormsModule, Validators, UntypedFormBuilder } from '@angular/forms';
import * as i1$2 from '@angular/router';
import { NavigationEnd, RouterModule, Router, ActivatedRoute } from '@angular/router';
import * as i3$2 from '@angular/material/expansion';
import { MatExpansionModule } from '@angular/material/expansion';
import * as i5$1 from '@angular/material/list';
import { MatListModule } from '@angular/material/list';
import * as i2$4 from '@angular/material/progress-spinner';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import * as i1$3 from '@angular/material/snack-bar';
import { MAT_SNACK_BAR_DATA, MatSnackBarModule } from '@angular/material/snack-bar';
import { HttpStatusCode, HttpClient } from '@angular/common/http';
import { SelectionModel } from '@angular/cdk/collections';
import { HttpCollectionService } from 'ngx-core-business/http';

class AvatarComponent {
    constructor() {
        this.size = 32;
    }
    get height() { return this.size; }
    get width() { return this.size; }
    getAvarType() {
        if (this.src) {
            return 'image';
        }
        return 'text';
    }
    getInitials() {
        if (this.name) {
            const names = this.name.split(' ');
            let initials = '';
            names.forEach((name) => {
                initials += name[0];
            });
            return initials;
        }
        return '';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: AvatarComponent, isStandalone: false, selector: "ngbiz-avatar", inputs: { src: "src", name: "name", size: "size" }, host: { properties: { "style.height.px": "this.height", "style.width.px": "this.width" } }, ngImport: i0, template: "<img *ngIf=\"getAvarType()=='image'\" [src]=\"src\" alt=\"Avatar\" />\r\n<span *ngIf=\"getAvarType()=='text'\" class=\"avatar-name\" [style]=\"{'lineHeigth.px':size }\">\r\n    <span class=\"initials\">{{getInitials()}}</span>\r\n</span>", styles: [":host{display:inline-block;border-radius:50%;position:relative}:host img{width:100%;height:100%;border-radius:50%}.avatar-name{display:flex;border-radius:50%;background:#616161;color:#fff;width:100%;height:100%;font-size:12px}.avatar-name .initials{height:100%;width:100%;top:0;justify-content:center;display:flex;align-items:center;left:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AvatarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-avatar', standalone: false, template: "<img *ngIf=\"getAvarType()=='image'\" [src]=\"src\" alt=\"Avatar\" />\r\n<span *ngIf=\"getAvarType()=='text'\" class=\"avatar-name\" [style]=\"{'lineHeigth.px':size }\">\r\n    <span class=\"initials\">{{getInitials()}}</span>\r\n</span>", styles: [":host{display:inline-block;border-radius:50%;position:relative}:host img{width:100%;height:100%;border-radius:50%}.avatar-name{display:flex;border-radius:50%;background:#616161;color:#fff;width:100%;height:100%;font-size:12px}.avatar-name .initials{height:100%;width:100%;top:0;justify-content:center;display:flex;align-items:center;left:0}\n"] }]
        }], propDecorators: { src: [{
                type: Input
            }], name: [{
                type: Input
            }], size: [{
                type: Input
            }], height: [{
                type: HostBinding,
                args: ['style.height.px']
            }], width: [{
                type: HostBinding,
                args: ['style.width.px']
            }] } });

class AppHeaderComponent {
    constructor() {
        this.menuButtonClick = new EventEmitter();
        this.logoutButtonClick = new EventEmitter();
        this.appName = '';
        this.showDefaultUserInfo = true;
        this.user = null;
        this.logoutText = 'Logout';
        this.height = 36;
        this.showMenu = false;
        this.avatarSize = 24;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AppHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: AppHeaderComponent, isStandalone: false, selector: "ngbiz-app-header", inputs: { appName: "appName", showDefaultUserInfo: "showDefaultUserInfo", user: "user", logoutText: "logoutText", height: "height" }, outputs: { menuButtonClick: "menuButtonClick", logoutButtonClick: "logoutButtonClick" }, host: { properties: { "style.height.px": "this.height" } }, ngImport: i0, template: "<mat-toolbar role=\"heading\" class=\"px-1\">\r\n  <button mat-icon-button class=\"menu-button\" (click)=\"menuButtonClick.emit()\">\r\n    <mat-icon>menu</mat-icon>\r\n  </button>\r\n  <ng-content select=\"[beforeAppName]\"></ng-content>\r\n  <span *ngIf=\"appName\" class=\"px-[6px]\">{{ appName }}</span>\r\n  <ng-content select=\"[afterAppName]\"></ng-content>\r\n  <div class=\"flex-1 flex\">\r\n    <ng-content select=\"[content]\"></ng-content>\r\n  </div>\r\n  <ng-content select=\"[beforeUser]\"></ng-content>\r\n  <div\r\n    *ngIf=\"showDefaultUserInfo\"\r\n    cdkOverlayOrigin\r\n    #trigger=\"cdkOverlayOrigin\"\r\n    class=\"flex cursor-pointer px-[6px]\"\r\n  >\r\n    <ngbiz-avatar\r\n      [src]=\"user?.picture\"\r\n      [name]=\"user?.name\"\r\n      [size]=\"avatarSize\"\r\n      (click)=\"showMenu = !showMenu\"\r\n    ></ngbiz-avatar>\r\n    <!-- User menu -->\r\n    <ng-template\r\n      cdkConnectedOverlayHasBackdrop\r\n      cdkConnectedOverlay\r\n      [cdkConnectedOverlayOrigin]=\"trigger\"\r\n      [cdkConnectedOverlayOpen]=\"showMenu\"\r\n      cdkConnectedOverlayBackdropClass=\"cdk-overlay-dark-backdrop\"\r\n      (backdropClick)=\"showMenu = false\"\r\n    >\r\n      <div class=\"modal-menu bg-gray-50 p-4 shadow-md mt-1 rounded flex\">\r\n        <ngbiz-avatar [src]=\"user?.picture\" [name]=\"user?.name\"></ngbiz-avatar>\r\n        <div class=\"pl-3\">\r\n          <div class=\"min-h-8 flex flex-col justify-center\">\r\n            <div>{{ user?.name }}</div>\r\n            <div *ngIf=\"user?.email\" class=\"text-xs\">{{ user?.email }}</div>\r\n          </div>\r\n          <div class=\"mt-2 text-right\">\r\n            <button mat-button (click)=\"logoutButtonClick.emit()\">\r\n              <mat-icon>exit_to_app</mat-icon><span>{{ logoutText }}</span>\r\n            </button>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </ng-template>\r\n  </div>\r\n  <ng-content select=\"[afterUser]\"></ng-content>\r\n</mat-toolbar>\r\n", styles: [":host{display:block;box-sizing:border-box;width:100%}mat-toolbar{background-color:var(--mat-sys-primary);color:var(--mat-sys-on-primary);height:100%;font-size:13px;padding:0 6px}.mat-mdc-icon-button.menu-button{color:var(--mat-sys-on-primary);border-radius:0;width:36px;height:36px;padding:6px}.mat-mdc-icon-button.menu-button mat-icon{font-size:24px;height:24px;width:24px;margin:0}.ngbiz-username{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.photo-url{width:24px;height:24px;border-radius:50%}.modal-menu{font-family:var(--mat-sys-body-medium-font);font-size:var(--mat-sys-body-medium-size)}.block-user-idenfication{display:flex;padding:0 16px;text-transform:uppercase;text-align:left;overflow:hidden}.block-user-idenfication .names-wrapper{display:flex;flex-direction:column;justify-content:center;margin-left:4px;overflow:hidden}.block-user-idenfication .names-wrapper>div{line-height:1.2;font-size:10px;text-overflow:ellipsis;overflow:hidden}.exit-button{font-size:12px}.exit-button mat-icon{font-size:19px;height:20px;width:20px}.separator{border-left:1px solid #fff;width:1px;height:22px}.abc{background-color:red}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i2.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i2$1.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", exportAs: ["matButton"] }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: AvatarComponent, selector: "ngbiz-avatar", inputs: ["src", "name", "size"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: AppHeaderComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-app-header', standalone: false, template: "<mat-toolbar role=\"heading\" class=\"px-1\">\r\n  <button mat-icon-button class=\"menu-button\" (click)=\"menuButtonClick.emit()\">\r\n    <mat-icon>menu</mat-icon>\r\n  </button>\r\n  <ng-content select=\"[beforeAppName]\"></ng-content>\r\n  <span *ngIf=\"appName\" class=\"px-[6px]\">{{ appName }}</span>\r\n  <ng-content select=\"[afterAppName]\"></ng-content>\r\n  <div class=\"flex-1 flex\">\r\n    <ng-content select=\"[content]\"></ng-content>\r\n  </div>\r\n  <ng-content select=\"[beforeUser]\"></ng-content>\r\n  <div\r\n    *ngIf=\"showDefaultUserInfo\"\r\n    cdkOverlayOrigin\r\n    #trigger=\"cdkOverlayOrigin\"\r\n    class=\"flex cursor-pointer px-[6px]\"\r\n  >\r\n    <ngbiz-avatar\r\n      [src]=\"user?.picture\"\r\n      [name]=\"user?.name\"\r\n      [size]=\"avatarSize\"\r\n      (click)=\"showMenu = !showMenu\"\r\n    ></ngbiz-avatar>\r\n    <!-- User menu -->\r\n    <ng-template\r\n      cdkConnectedOverlayHasBackdrop\r\n      cdkConnectedOverlay\r\n      [cdkConnectedOverlayOrigin]=\"trigger\"\r\n      [cdkConnectedOverlayOpen]=\"showMenu\"\r\n      cdkConnectedOverlayBackdropClass=\"cdk-overlay-dark-backdrop\"\r\n      (backdropClick)=\"showMenu = false\"\r\n    >\r\n      <div class=\"modal-menu bg-gray-50 p-4 shadow-md mt-1 rounded flex\">\r\n        <ngbiz-avatar [src]=\"user?.picture\" [name]=\"user?.name\"></ngbiz-avatar>\r\n        <div class=\"pl-3\">\r\n          <div class=\"min-h-8 flex flex-col justify-center\">\r\n            <div>{{ user?.name }}</div>\r\n            <div *ngIf=\"user?.email\" class=\"text-xs\">{{ user?.email }}</div>\r\n          </div>\r\n          <div class=\"mt-2 text-right\">\r\n            <button mat-button (click)=\"logoutButtonClick.emit()\">\r\n              <mat-icon>exit_to_app</mat-icon><span>{{ logoutText }}</span>\r\n            </button>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </ng-template>\r\n  </div>\r\n  <ng-content select=\"[afterUser]\"></ng-content>\r\n</mat-toolbar>\r\n", styles: [":host{display:block;box-sizing:border-box;width:100%}mat-toolbar{background-color:var(--mat-sys-primary);color:var(--mat-sys-on-primary);height:100%;font-size:13px;padding:0 6px}.mat-mdc-icon-button.menu-button{color:var(--mat-sys-on-primary);border-radius:0;width:36px;height:36px;padding:6px}.mat-mdc-icon-button.menu-button mat-icon{font-size:24px;height:24px;width:24px;margin:0}.ngbiz-username{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.photo-url{width:24px;height:24px;border-radius:50%}.modal-menu{font-family:var(--mat-sys-body-medium-font);font-size:var(--mat-sys-body-medium-size)}.block-user-idenfication{display:flex;padding:0 16px;text-transform:uppercase;text-align:left;overflow:hidden}.block-user-idenfication .names-wrapper{display:flex;flex-direction:column;justify-content:center;margin-left:4px;overflow:hidden}.block-user-idenfication .names-wrapper>div{line-height:1.2;font-size:10px;text-overflow:ellipsis;overflow:hidden}.exit-button{font-size:12px}.exit-button mat-icon{font-size:19px;height:20px;width:20px}.separator{border-left:1px solid #fff;width:1px;height:22px}.abc{background-color:red}\n"] }]
        }], propDecorators: { menuButtonClick: [{
                type: Output
            }], logoutButtonClick: [{
                type: Output
            }], appName: [{
                type: Input
            }], showDefaultUserInfo: [{
                type: Input
            }], user: [{
                type: Input
            }], logoutText: [{
                type: Input
            }], height: [{
                type: Input
            }, {
                type: HostBinding,
                args: ['style.height.px']
            }] } });

class NgBizAvatarModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizAvatarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizAvatarModule, declarations: [AvatarComponent], imports: [CommonModule,
            MatIconModule], exports: [AvatarComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizAvatarModule, imports: [CommonModule,
            MatIconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizAvatarModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        AvatarComponent,
                    ],
                    imports: [
                        CommonModule,
                        MatIconModule,
                    ],
                    exports: [
                        AvatarComponent,
                    ],
                }]
        }] });

/*
 * Public API Surface of ngx-core-business
 */

class NgBizAppHeaderModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizAppHeaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizAppHeaderModule, declarations: [AppHeaderComponent], imports: [CommonModule,
            OverlayModule,
            MatIconModule,
            MatToolbarModule,
            MatButtonModule,
            NgBizAvatarModule], exports: [AppHeaderComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizAppHeaderModule, imports: [CommonModule,
            OverlayModule,
            MatIconModule,
            MatToolbarModule,
            MatButtonModule,
            NgBizAvatarModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizAppHeaderModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        AppHeaderComponent,
                    ],
                    imports: [
                        CommonModule,
                        OverlayModule,
                        MatIconModule,
                        MatToolbarModule,
                        MatButtonModule,
                        NgBizAvatarModule,
                    ],
                    exports: [
                        AppHeaderComponent,
                    ],
                }]
        }] });

/*
 * Public API Surface of ngx-core-business
 */

const HTTP_STATUS_MESSAGES = {
    0: 'No se logró establecer conexión con el servidor',
    400: 'El servidor no pudo procesar la petición',
    401: 'Inicio de sesión requerido.',
    403: 'Ud. No cuenta con los permisos necesarios para realizar acceder a está funcionalidad.',
    404: 'Es servicio solicitado no existe.',
    500: 'Ha ocurrido un error en nuestro servidor, por favor intente más tarde.',
    502: 'No se recibio respuesta de servicio externo.',
    503: 'Este servicio se encuentra temporalmente deshabilitado.'
};
class DataErrorViewComponent {
    constructor() {
        this.defaultErrorMessage = 'Ha ocurrido un error en nuestro servidor, por favor intente más tarde.';
        this.errorIcon = 'app:ha-cloud-error';
        this.buttonIcon = 'app:refresh';
        this.buttonText = 'Intentar nuevamente';
        this.showActionButton = true;
        this.actionClick = new EventEmitter();
    }
    ngOnInit() {
        const me = this;
        me.message = HTTP_STATUS_MESSAGES[me.status] || me.defaultErrorMessage;
        // Autenticacion requerida
        if (me.status === 401) {
            me.showActionButton = false;
            return;
        }
        // Acceso prohibido
        if (me.status === 403) {
            me.showActionButton = false;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DataErrorViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: DataErrorViewComponent, isStandalone: false, selector: "ngbiz-data-error-view", inputs: { errorIcon: "errorIcon", buttonIcon: "buttonIcon", buttonText: "buttonText", status: "status", showActionButton: "showActionButton" }, outputs: { actionClick: "actionClick" }, host: { classAttribute: "container-center info-view danger" }, ngImport: i0, template: "<div class=\"cmp-wrapper\">\n  <div>\n    <mat-icon class=\"icon\" [svgIcon]=\"errorIcon\"></mat-icon>\n  </div>\n  <div class=\"messaje\">{{message}}</div>\n  <div *ngIf=\"showActionButton\" class=\"action-container\">\n    <button color=\"primary\" mat-stroked-button (click)=\"actionClick.emit()\">\n      <mat-icon *ngIf=\"buttonIcon\" class=\"action-icon\" [svgIcon]=\"buttonIcon\"></mat-icon>\n      <span>{{buttonText}}</span>\n    </button>\n  </div>\n</div>\n", styles: [":host{z-index:200;background-color:#fafafa}.cmp-wrapper{text-align:center}.icon{color:#f44336;width:64px;height:64px}.messaje{display:inline-block;max-width:320px;margin-top:24px}.action-container{margin-top:48px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DataErrorViewComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-data-error-view', host: { class: 'container-center info-view danger' }, standalone: false, template: "<div class=\"cmp-wrapper\">\n  <div>\n    <mat-icon class=\"icon\" [svgIcon]=\"errorIcon\"></mat-icon>\n  </div>\n  <div class=\"messaje\">{{message}}</div>\n  <div *ngIf=\"showActionButton\" class=\"action-container\">\n    <button color=\"primary\" mat-stroked-button (click)=\"actionClick.emit()\">\n      <mat-icon *ngIf=\"buttonIcon\" class=\"action-icon\" [svgIcon]=\"buttonIcon\"></mat-icon>\n      <span>{{buttonText}}</span>\n    </button>\n  </div>\n</div>\n", styles: [":host{z-index:200;background-color:#fafafa}.cmp-wrapper{text-align:center}.icon{color:#f44336;width:64px;height:64px}.messaje{display:inline-block;max-width:320px;margin-top:24px}.action-container{margin-top:48px}\n"] }]
        }], propDecorators: { errorIcon: [{
                type: Input
            }], buttonIcon: [{
                type: Input
            }], buttonText: [{
                type: Input
            }], status: [{
                type: Input
            }], showActionButton: [{
                type: Input
            }], actionClick: [{
                type: Output
            }] } });

class NgBizDataErrorViewModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizDataErrorViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizDataErrorViewModule, declarations: [DataErrorViewComponent], imports: [CommonModule,
            MatButtonModule,
            MatIconModule], exports: [DataErrorViewComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizDataErrorViewModule, imports: [CommonModule,
            MatButtonModule,
            MatIconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizDataErrorViewModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        DataErrorViewComponent,
                    ],
                    imports: [
                        CommonModule,
                        MatButtonModule,
                        MatIconModule,
                    ],
                    exports: [
                        DataErrorViewComponent,
                    ],
                }]
        }] });

var ButtonType;
(function (ButtonType) {
    ButtonType["RAISED"] = "raised";
    ButtonType["STROKED"] = "stroked";
    ButtonType["NORMAL"] = "normal";
})(ButtonType || (ButtonType = {}));
class DialogComponent {
    constructor(dialogRef, inputData, sanitizer) {
        this.dialogRef = dialogRef;
        this.inputData = inputData;
        this.sanitizer = sanitizer;
        this.title = 'Confirmar';
        this.message = '';
        this.safeMessage = '';
        this.actionText = 'ACEPTAR';
        this.yesText = 'SÍ';
        this.noText = 'NO';
        this.actionButtonColor = 'primary';
        this.actionButtonType = ButtonType.RAISED;
        this.cancelText = 'CANCELAR';
        this.options = [];
        this.suggested = 'none';
    }
    ngOnInit() {
        this.setPropsFromData();
    }
    setPropsFromData() {
        const me = this;
        Object.assign(me, me.inputData);
        me.safeMessage = me.sanitizer.bypassSecurityTrustHtml(me.message);
        if (!me.options.length) {
            me.setDefaultButtons();
        }
    }
    setDefaultButtons() {
        const me = this;
        // Buttons YES/NOT
        if (me.buttons == 'yes_not') {
            me.options = me.getYesNotButtons();
            return;
        }
        if (me.buttons == 'confirm_cancel' || me.buttons == 'cancel_confirm') {
            me.options = [
                {
                    text: me.actionText,
                    buttonColor: me.actionButtonColor ? me.actionButtonColor : 'primary',
                    buttonType: ButtonType.RAISED,
                    option: true,
                    suggested: me.suggested == 'confirm',
                },
                {
                    text: me.cancelText,
                    buttonType: ButtonType.NORMAL,
                    option: false,
                    suggested: me.suggested == 'cancel',
                },
            ];
            if (me.buttons == 'cancel_confirm') {
                me.options.reverse();
            }
            return;
        }
        if (me.buttons == 'ok') {
            me.options = [
                {
                    text: me.actionText,
                    buttonColor: me.actionButtonColor ? me.actionButtonColor : 'primary',
                    buttonType: ButtonType.RAISED,
                    option: true,
                },
            ];
        }
    }
    getYesNotButtons() {
        const me = this;
        return [
            {
                text: me.yesText,
                buttonColor: 'primary',
                buttonType: me.suggested == 'yes' ? ButtonType.RAISED : ButtonType.STROKED,
                option: true,
            },
            {
                text: me.noText,
                buttonColor: me.suggested == 'no' ? 'primary' : 'warn',
                buttonType: me.suggested == 'no' ? ButtonType.RAISED : ButtonType.STROKED,
                option: false,
            },
        ];
    }
    onOptionClick(option) {
        const me = this;
        me.dialogRef.close(option.option);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DialogComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: DialogComponent, isStandalone: false, selector: "app-dialog", ngImport: i0, template: "<h2 mat-dialog-title>{{title}}</h2>\r\n<div mat-dialog-content [innerHTML]=\"safeMessage\" [ngStyle]=\"{'max-width': maxWidth?maxWidth + 'px':null}\"></div>\r\n<mat-dialog-actions align=\"end\" class=\"text-right\">\r\n  <ng-container *ngFor=\"let option of options\">\r\n    <button *ngIf=\"!option.buttonType\" (click)=\"onOptionClick(option)\" mat-button\r\n      [color]=\"option.buttonColor\">{{option.text}}</button>\r\n    <button *ngIf=\"option.buttonType == 'normal'\" (click)=\"onOptionClick(option)\" mat-button\r\n      [color]=\"option.buttonColor\">{{option.text}}</button>\r\n    <button *ngIf=\"option.buttonType == 'raised'\" (click)=\"onOptionClick(option)\" mat-raised-button\r\n      [color]=\"option.buttonColor\">{{option.text}}</button>\r\n    <button *ngIf=\"option.buttonType == 'stroked'\" (click)=\"onOptionClick(option)\" mat-stroked-button\r\n      [color]=\"option.buttonColor\">{{option.text}}</button>\r\n  </ng-container>\r\n</mat-dialog-actions>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2$1.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", exportAs: ["matButton"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DialogComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-dialog', standalone: false, template: "<h2 mat-dialog-title>{{title}}</h2>\r\n<div mat-dialog-content [innerHTML]=\"safeMessage\" [ngStyle]=\"{'max-width': maxWidth?maxWidth + 'px':null}\"></div>\r\n<mat-dialog-actions align=\"end\" class=\"text-right\">\r\n  <ng-container *ngFor=\"let option of options\">\r\n    <button *ngIf=\"!option.buttonType\" (click)=\"onOptionClick(option)\" mat-button\r\n      [color]=\"option.buttonColor\">{{option.text}}</button>\r\n    <button *ngIf=\"option.buttonType == 'normal'\" (click)=\"onOptionClick(option)\" mat-button\r\n      [color]=\"option.buttonColor\">{{option.text}}</button>\r\n    <button *ngIf=\"option.buttonType == 'raised'\" (click)=\"onOptionClick(option)\" mat-raised-button\r\n      [color]=\"option.buttonColor\">{{option.text}}</button>\r\n    <button *ngIf=\"option.buttonType == 'stroked'\" (click)=\"onOptionClick(option)\" mat-stroked-button\r\n      [color]=\"option.buttonColor\">{{option.text}}</button>\r\n  </ng-container>\r\n</mat-dialog-actions>\r\n" }]
        }], ctorParameters: () => [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: i2$2.DomSanitizer }] });

class NgBizDialogModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizDialogModule, declarations: [DialogComponent], imports: [CommonModule,
            MatButtonModule,
            MatDialogModule], exports: [DialogComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizDialogModule, imports: [CommonModule,
            MatButtonModule,
            MatDialogModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizDialogModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        DialogComponent,
                    ],
                    imports: [
                        CommonModule,
                        MatButtonModule,
                        MatDialogModule,
                    ],
                    exports: [
                        DialogComponent,
                    ],
                }]
        }] });

class EditionPinComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: EditionPinComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: EditionPinComponent, isStandalone: false, selector: "ngbiz-edition-pin", inputs: { icon: "icon" }, ngImport: i0, template: "<mat-icon>{{icon}}</mat-icon>\r\n", styles: [":host{display:inline-block;margin-right:8px}mat-icon{box-sizing:border-box;background-color:var(--mat-sys-primary);color:#fff;border-radius:50%;padding:4px;vertical-align:middle;width:28px;height:28px;line-height:1;font-size:20px}\n"], dependencies: [{ kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: EditionPinComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-edition-pin', standalone: false, template: "<mat-icon>{{icon}}</mat-icon>\r\n", styles: [":host{display:inline-block;margin-right:8px}mat-icon{box-sizing:border-box;background-color:var(--mat-sys-primary);color:#fff;border-radius:50%;padding:4px;vertical-align:middle;width:28px;height:28px;line-height:1;font-size:20px}\n"] }]
        }], propDecorators: { icon: [{
                type: Input
            }] } });

class NgBizEditionPinModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizEditionPinModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizEditionPinModule, declarations: [EditionPinComponent], imports: [CommonModule,
            MatIconModule], exports: [EditionPinComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizEditionPinModule, imports: [CommonModule,
            MatIconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizEditionPinModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        EditionPinComponent,
                    ],
                    imports: [
                        CommonModule,
                        MatIconModule,
                    ],
                    exports: [
                        EditionPinComponent,
                    ],
                }]
        }] });

/*
 * Public API Surface of ngx-core-business
 */

class GridComponent {
    constructor() {
        this.data = [];
        this.size = 'medium';
        this.displayedColumns = [];
        this.selectedRowIndex = -1;
        this.cols = [];
        this.pageIndex = 0;
        this.pageSize = 10;
    }
    set columns(columns) {
        this.cols = columns.map((column) => {
            if (column.field) {
                column.type = 'data';
                column.name = column.field;
            }
            else {
                column.type = 'actions';
            }
            return column;
        });
        this.displayedColumns = Array.from(this.cols, column => column.name);
    }
    getTableCls() {
        return ['ngbiz-custom-material__mat-table--lite', this.size];
    }
    getActionsColWidth(col) {
        return col.actions.length * 48;
    }
    getPageIndex() {
        return this.paginator ? this.paginator.pageIndex : this.pageIndex;
    }
    getPageSize() {
        return this.paginator ? this.paginator.pageSize : this.pageSize;
    }
    getItemNumber(index) {
        return this.getPageIndex() * this.getPageSize() + index + 1;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: GridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: GridComponent, isStandalone: false, selector: "ngbiz-grid", inputs: { data: "data", size: "size", columns: "columns", pageIndex: "pageIndex", pageSize: "pageSize" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "<table mat-table [dataSource]=\"data\" matSort [ngClass]=\"getTableCls()\">\n  <caption></caption>\n  <!-- Fila de cabecezas-->\n  <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky: true;\"></tr>\n\n  <!-- Fila de cuerpo -->\n  <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\" (click)=\"selectedRowIndex = row.id\"\n    [ngClass]=\"{'row-selected': selectedRowIndex == row.id}\"></tr>\n\n  <!-- Columns -->\n  <ng-container *ngFor=\"let col of cols\" [matColumnDef]=\"col.name\" [stickyEnd]=\"col.stickyEnd\">\n    @if (col.type==='data') {\n    <th mat-header-cell *matHeaderCellDef mat-sort-header>{{col.text}}</th>\n    <td mat-cell *matCellDef=\"let row; let i=index;\">\n      @if(col.field=='_rowNumber'){\n      {{getItemNumber(i)}}\n      }@else{\n      {{row[col.field]}}\n      }\n    </td>\n    } @else if(col.type==='actions') {\n    <th mat-header-cell *matHeaderCellDef class=\"row-actions-header-cell\">\n      <div>\n        <div [style.width.px]=\"getActionsColWidth(col)\">{{col.text}}</div>\n      </div>\n    </th>\n    <td mat-cell *matCellDef=\"let row; let i=index;\" class=\"row-actions-cell\">\n      <div class=\"row-actions-container\">\n        <button *ngFor=\"let action of col.actions\" mat-icon-button [class]=\"'row-action-button' + action.cls\"\n          (click)=\"action.handler(row)\" [matTooltip]=\"action.tooltip||''\">\n          <mat-icon>{{action.icon}}</mat-icon>\n        </button>\n      </div>\n    </td>\n    }\n  </ng-container>\n</table>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4$1.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i4$1.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: GridComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-grid', standalone: false, template: "<table mat-table [dataSource]=\"data\" matSort [ngClass]=\"getTableCls()\">\n  <caption></caption>\n  <!-- Fila de cabecezas-->\n  <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky: true;\"></tr>\n\n  <!-- Fila de cuerpo -->\n  <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\" (click)=\"selectedRowIndex = row.id\"\n    [ngClass]=\"{'row-selected': selectedRowIndex == row.id}\"></tr>\n\n  <!-- Columns -->\n  <ng-container *ngFor=\"let col of cols\" [matColumnDef]=\"col.name\" [stickyEnd]=\"col.stickyEnd\">\n    @if (col.type==='data') {\n    <th mat-header-cell *matHeaderCellDef mat-sort-header>{{col.text}}</th>\n    <td mat-cell *matCellDef=\"let row; let i=index;\">\n      @if(col.field=='_rowNumber'){\n      {{getItemNumber(i)}}\n      }@else{\n      {{row[col.field]}}\n      }\n    </td>\n    } @else if(col.type==='actions') {\n    <th mat-header-cell *matHeaderCellDef class=\"row-actions-header-cell\">\n      <div>\n        <div [style.width.px]=\"getActionsColWidth(col)\">{{col.text}}</div>\n      </div>\n    </th>\n    <td mat-cell *matCellDef=\"let row; let i=index;\" class=\"row-actions-cell\">\n      <div class=\"row-actions-container\">\n        <button *ngFor=\"let action of col.actions\" mat-icon-button [class]=\"'row-action-button' + action.cls\"\n          (click)=\"action.handler(row)\" [matTooltip]=\"action.tooltip||''\">\n          <mat-icon>{{action.icon}}</mat-icon>\n        </button>\n      </div>\n    </td>\n    }\n  </ng-container>\n</table>\n" }]
        }], propDecorators: { data: [{
                type: Input
            }], size: [{
                type: Input
            }], columns: [{
                type: Input
            }], pageIndex: [{
                type: Input
            }], pageSize: [{
                type: Input
            }], paginator: [{
                type: ViewChild,
                args: [MatPaginator]
            }] } });

class NgBizGridModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizGridModule, declarations: [GridComponent], imports: [CommonModule,
            MatButtonModule,
            MatIconModule,
            MatSortModule,
            MatTableModule,
            MatTooltipModule], exports: [GridComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizGridModule, imports: [CommonModule,
            MatButtonModule,
            MatIconModule,
            MatSortModule,
            MatTableModule,
            MatTooltipModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizGridModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        GridComponent,
                    ],
                    imports: [
                        CommonModule,
                        MatButtonModule,
                        MatIconModule,
                        MatSortModule,
                        MatTableModule,
                        MatTooltipModule,
                    ],
                    exports: [
                        GridComponent,
                    ],
                }]
        }] });

// Suggested types: 'text' | 'number' | 'date' | 'boolean' | 'currency' | 'percent' | 'icon' | 'link' | 'image' | 'custom'

/*
 * Public API Surface of ngx-core-business
 */

class HttpActivityService {
    constructor() {
        this.observer = new Subject();
        this.statusChange = this.observer.asObservable();
    }
    showIndicator() {
        this.observer.next(true);
    }
    hideIndicator() {
        this.observer.next(false);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: HttpActivityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: HttpActivityService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: HttpActivityService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }] });

class HttpActivityBarComponent {
    constructor(service) {
        this.service = service;
        this.zIndex = 1;
        this.active = false;
    }
    ngOnInit() {
        const me = this;
        me.service.statusChange.subscribe((active) => {
            setTimeout(() => {
                me.active = active;
            }, 0);
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: HttpActivityBarComponent, deps: [{ token: HttpActivityService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: HttpActivityBarComponent, isStandalone: false, selector: "ngbiz-http-activity-bar", inputs: { zIndex: "zIndex" }, host: { properties: { "style.z-index": "this.zIndex" } }, ngImport: i0, template: "<mat-progress-bar *ngIf=\"active\" mode=\"indeterminate\"></mat-progress-bar>\r\n", styles: [":host{display:block;position:fixed;width:100%;height:2px;top:0}mat-progress-bar{height:100%;overflow-y:hidden;background-color:rgba(var(--mat-sys-primary-rgb),.25)}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: HttpActivityBarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-http-activity-bar', standalone: false, template: "<mat-progress-bar *ngIf=\"active\" mode=\"indeterminate\"></mat-progress-bar>\r\n", styles: [":host{display:block;position:fixed;width:100%;height:2px;top:0}mat-progress-bar{height:100%;overflow-y:hidden;background-color:rgba(var(--mat-sys-primary-rgb),.25)}\n"] }]
        }], ctorParameters: () => [{ type: HttpActivityService }], propDecorators: { zIndex: [{
                type: HostBinding,
                args: ['style.z-index']
            }, {
                type: Input
            }] } });

class NgBizHttpActivityBarModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizHttpActivityBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizHttpActivityBarModule, declarations: [HttpActivityBarComponent], imports: [CommonModule,
            MatProgressBarModule], exports: [HttpActivityBarComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizHttpActivityBarModule, imports: [CommonModule,
            MatProgressBarModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizHttpActivityBarModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        HttpActivityBarComponent,
                    ],
                    imports: [
                        CommonModule,
                        MatProgressBarModule,
                    ],
                    exports: [
                        HttpActivityBarComponent,
                    ],
                }]
        }] });

class HttpActivityInterceptor {
    constructor(service) {
        this.service = service;
    }
    intercept(request, next) {
        const me = this;
        me.service.showIndicator();
        return next.handle(request).pipe(finalize(() => {
            me.service.hideIndicator();
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: HttpActivityInterceptor, deps: [{ token: HttpActivityService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: HttpActivityInterceptor }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: HttpActivityInterceptor, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: HttpActivityService }] });

class FiltersContainerComponent {
    constructor() {
        this.filters = [];
        this.filtersChange = new EventEmitter();
        this.searchFilterChange = new EventEmitter();
    }
    setFilterValue(id, value, active, operator) {
        const me = this;
        let filter = me.getFilter(id);
        if (filter) {
            filter.value = value;
            filter.active = true;
            filter.operator = operator ? operator : filter.operator;
            // Posibilidades de desactivar el filtro
            if (filter.type == 'string' &&
                (!value || value == filter.inactiveOnValue)) {
                filter.active = false;
            }
            if (filter.type == 'numeric' && value == filter.inactiveOnValue) {
                filter.active = false;
            }
            if (filter.type == 'list' && (!value || !value.length)) {
                filter.active = false;
            }
            if (filter.type == 'date' && (!value || !value.length)) {
                filter.active = false;
            }
            // El valor active predomina si es establecido esplicitamente
            if (active === true || active === false) {
                filter.active = active;
            }
        }
        me.fireEvent();
    }
    setSearchFilterValue(value) {
        this.searchFilter = { ...this.searchFilter, value };
        this.searchFilterChange.emit(this.searchFilter);
    }
    activeFilter(field, active) {
        const me = this;
        me.filters.forEach((item) => {
            if (item.field == field) {
                item.active = !!active;
            }
        });
    }
    addOrRemoveListFilterItemValue(id, itemValue, add) {
        const me = this;
        let newValue = [];
        let filter = me.getFilter(id);
        if (filter) {
            newValue = filter.value || [];
            // Add value
            if (add) {
                // Valor no está en la lista
                if (newValue.indexOf(itemValue) == -1) {
                    newValue.push(itemValue);
                }
            }
            // Remove value
            else {
                newValue = newValue.filter((value) => value != itemValue);
            }
            filter.value = newValue;
        }
        me.fireEvent();
    }
    fireEvent() {
        this.filtersChange.emit(this.getActiveFilters());
    }
    /**
     * Retorna solo los filtros activos
     */
    getActiveFilters() {
        let out = this.filters.filter((filter) => {
            if (filter.type == 'list') {
                return filter.value && filter.value.length;
            }
            return filter.active;
        });
        return out;
    }
    getFilter(id) {
        const me = this;
        let out = null;
        me.filters.forEach((item) => {
            if (item.id == id) {
                out = item;
            }
        });
        return out;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FiltersContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: FiltersContainerComponent, isStandalone: true, outputs: { filtersChange: "filtersChange", searchFilterChange: "searchFilterChange" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FiltersContainerComponent, decorators: [{
            type: Directive
        }], propDecorators: { filtersChange: [{
                type: Output
            }], searchFilterChange: [{
                type: Output
            }] } });

class TextFilterComponent {
    constructor() {
        this.debounceTime = 500;
        this.placeholder = 'Buscar';
        this.value = '';
        // Se usa valueChange porque change produce un error.
        this.valueChange = new EventEmitter();
        this.searchBoxObs = new Subject();
        this.searchBox = this.searchBoxObs.asObservable();
        const me = this;
        me.searchBox.pipe(debounceTime(me.debounceTime)).subscribe((word) => {
            me.fireEvent(word);
        });
    }
    /**
     * Called when searchbox value changes.
     * @param e
     */
    onSearchValueChange(e) {
        let value = (e.value || '').trim();
        if (this.debounceTime > 0) {
            this.searchBoxObs.next(value);
            return;
        }
        this.fireEvent(value);
    }
    fireEvent(value) {
        this.valueChange.emit(value);
    }
    clearText() {
        this.value = '';
        this.fireEvent('');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: TextFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: TextFilterComponent, isStandalone: false, selector: "ngbiz-text-filter", inputs: { debounceTime: "debounceTime", placeholder: "placeholder" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div class=\"wrapper\">\n  <mat-icon class=\"search-icon\">search</mat-icon>\n  <input type=\"text\" (input)=\"onSearchValueChange($event.target)\" [placeholder]=\"placeholder\"\n    type=\"text\" [(ngModel)]=\"value\" />\n  <mat-icon *ngIf=\"value\" class=\"clear-button\" (click)=\"clearText()\">clear</mat-icon>\n</div>\n", styles: [".wrapper{display:flex;width:100%;position:relative}input{flex:1;padding:0 31px;min-height:26px;width:100%;height:26px;border:1px solid #bdbdbd;border-radius:4px;outline-color:#37474f}input:focus-visible{outline-color:var(--ngbiz-primary, var(--mat-sys-primary, #76b82a));outline-style:solid;outline-width:1px;border-color:var(--ngbiz-primary, var(--mat-sys-primary, #76b82a))}.search-icon,.clear-button{font-size:20px;width:20px;height:20px}.search-icon{position:absolute;top:50%;left:7px;transform:translateY(-50%)}.clear-button{position:absolute;top:50%;right:7px;transform:translateY(-50%);cursor:pointer}.clear-button:hover{color:var(--ngbiz-primary, var(--mat-sys-primary, #76b82a))}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: TextFilterComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-text-filter', standalone: false, template: "<div class=\"wrapper\">\n  <mat-icon class=\"search-icon\">search</mat-icon>\n  <input type=\"text\" (input)=\"onSearchValueChange($event.target)\" [placeholder]=\"placeholder\"\n    type=\"text\" [(ngModel)]=\"value\" />\n  <mat-icon *ngIf=\"value\" class=\"clear-button\" (click)=\"clearText()\">clear</mat-icon>\n</div>\n", styles: [".wrapper{display:flex;width:100%;position:relative}input{flex:1;padding:0 31px;min-height:26px;width:100%;height:26px;border:1px solid #bdbdbd;border-radius:4px;outline-color:#37474f}input:focus-visible{outline-color:var(--ngbiz-primary, var(--mat-sys-primary, #76b82a));outline-style:solid;outline-width:1px;border-color:var(--ngbiz-primary, var(--mat-sys-primary, #76b82a))}.search-icon,.clear-button{font-size:20px;width:20px;height:20px}.search-icon{position:absolute;top:50%;left:7px;transform:translateY(-50%)}.clear-button{position:absolute;top:50%;right:7px;transform:translateY(-50%);cursor:pointer}.clear-button:hover{color:var(--ngbiz-primary, var(--mat-sys-primary, #76b82a))}\n"] }]
        }], ctorParameters: () => [], propDecorators: { debounceTime: [{
                type: Input
            }], placeholder: [{
                type: Input
            }], valueChange: [{
                type: Output
            }] } });

class ListToolbarComponent extends FiltersContainerComponent {
    constructor() {
        super(...arguments);
        this.searchDebounceTime = 500;
        this.searchFilter = { id: '_query', type: 'string', field: '_query', operator: '~' };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ListToolbarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ListToolbarComponent, isStandalone: false, selector: "ngbiz-list-toolbar", inputs: { searchDebounceTime: "searchDebounceTime" }, usesInheritance: true, ngImport: i0, template: "<ng-content select=\"[start]\"></ng-content>\n<ngbiz-text-filter (valueChange)=\"setSearchFilterValue($event)\" [debounceTime]=\"searchDebounceTime\"></ngbiz-text-filter>\n<ng-content select=\"[afterSearchBox]\"></ng-content>\n<ng-content select=\"[end]\"></ng-content>\n", styles: [":host{display:flex;padding:.25rem 16px;min-height:44px;align-items:center}app-text-filter{width:100%;max-width:320px}\n"], dependencies: [{ kind: "component", type: TextFilterComponent, selector: "ngbiz-text-filter", inputs: ["debounceTime", "placeholder"], outputs: ["valueChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ListToolbarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-list-toolbar', standalone: false, template: "<ng-content select=\"[start]\"></ng-content>\n<ngbiz-text-filter (valueChange)=\"setSearchFilterValue($event)\" [debounceTime]=\"searchDebounceTime\"></ngbiz-text-filter>\n<ng-content select=\"[afterSearchBox]\"></ng-content>\n<ng-content select=\"[end]\"></ng-content>\n", styles: [":host{display:flex;padding:.25rem 16px;min-height:44px;align-items:center}app-text-filter{width:100%;max-width:320px}\n"] }]
        }], propDecorators: { searchDebounceTime: [{
                type: Input
            }] } });

class NgBizTextFilterModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizTextFilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizTextFilterModule, declarations: [TextFilterComponent], imports: [CommonModule, FormsModule, MatIconModule], exports: [TextFilterComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizTextFilterModule, imports: [CommonModule, FormsModule, MatIconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizTextFilterModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [TextFilterComponent],
                    imports: [CommonModule, FormsModule, MatIconModule],
                    exports: [TextFilterComponent],
                }]
        }] });

/*
 * Public API Surface of ngx-core-business
 */

class NgBizListToolbarModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizListToolbarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizListToolbarModule, declarations: [ListToolbarComponent], imports: [CommonModule,
            NgBizTextFilterModule], exports: [ListToolbarComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizListToolbarModule, imports: [CommonModule,
            NgBizTextFilterModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizListToolbarModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        ListToolbarComponent,
                    ],
                    imports: [
                        CommonModule,
                        NgBizTextFilterModule,
                    ],
                    exports: [
                        ListToolbarComponent,
                    ],
                }]
        }] });

/*
 * Public API Surface of ngx-core-business
 */

class NavListComponent {
    constructor(router, el, renderer) {
        this.router = router;
        this.el = el;
        this.renderer = renderer;
        this.items = [];
        this.currentRoute = '';
    }
    onItemClick() {
        if (this.sidenav?.mode === 'over') {
            this.sidenav.close();
        }
    }
    isActive(item) {
        if (this.activeItemId) {
            return this.activeItemId === item.id;
        }
        let route = item.route;
        // Add / if it is not present
        if (route && route[0] !== '/') {
            route = '/' + route;
        }
        // Remove query params
        route = route?.split('?')[0];
        return this.currentRoute === route;
    }
    parseRoute(route) {
        return route[0] === '/' ? route : '/' + route;
    }
    ngOnInit() {
        this.router.events.subscribe((event) => {
            if (event instanceof NavigationEnd) {
                this.currentRoute = event.urlAfterRedirects;
                // remove query params
                this.currentRoute = this.currentRoute.split('?')[0];
            }
        });
    }
    ngAfterViewChecked() {
        this.removeExpansionPanelPadding();
    }
    removeExpansionPanelPadding() {
        const panels = this.el.nativeElement.querySelectorAll('.mat-expansion-panel-body');
        panels.forEach((panel) => {
            this.renderer.setStyle(panel, 'padding', '0');
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NavListComponent, deps: [{ token: i1$2.Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: NavListComponent, isStandalone: false, selector: "ngbiz-nav-list", inputs: { sidenav: "sidenav", items: "items", activeItemId: "activeItemId" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true }, { propertyName: "itemIconTemplate", first: true, predicate: ["itemIcon"], descendants: true }, { propertyName: "itemTextTemplate", first: true, predicate: ["itemText"], descendants: true }], ngImport: i0, template: "<mat-nav-list>\r\n  <ng-container *ngFor=\"let item of items\">\r\n    <ng-container\r\n      *ngTemplateOutlet=\"navItem; context: { item: item, level: 1 }\"\r\n    >\r\n    </ng-container>\r\n  </ng-container>\r\n</mat-nav-list>\r\n<ng-template #navItem let-item=\"item\" let-level=\"level\">\r\n  <a\r\n    *ngIf=\"!item.children?.length\"\r\n    mat-list-item\r\n    [routerLink]=\"parseRoute(item.route)\"\r\n    [activated]=\"isActive(item)\"\r\n    [class.active]=\"isActive(item)\"\r\n    (click)=\"onItemClick()\"\r\n    [class]=\"'l' + level\"\r\n  >\r\n    <div class=\"menu-item\">\r\n      <ng-container\r\n        *ngTemplateOutlet=\"\r\n          itemTemplate || defaultItemTemplate;\r\n          context: { item: item }\r\n        \"\r\n      />\r\n    </div>\r\n  </a>\r\n  <mat-expansion-panel *ngIf=\"item.children?.length\" class=\"mat-elevation-z0\">\r\n    <mat-expansion-panel-header [class]=\"'l' + level\">\r\n      <mat-panel-title>\r\n        <div class=\"menu-item\">\r\n          <ng-container\r\n            *ngTemplateOutlet=\"\r\n              itemTemplate || defaultItemTemplate;\r\n              context: { item: item }\r\n            \"\r\n          />\r\n        </div>\r\n      </mat-panel-title>\r\n    </mat-expansion-panel-header>\r\n    <ng-container *ngFor=\"let child of item.children\">\r\n      <ng-container\r\n        *ngTemplateOutlet=\"navItem; context: { item: child, level: level + 1 }\"\r\n      >\r\n      </ng-container>\r\n    </ng-container>\r\n  </mat-expansion-panel>\r\n</ng-template>\r\n<ng-template #defaultItemTemplate let-item=\"item\">\r\n  <ng-container\r\n    *ngTemplateOutlet=\"\r\n      itemIconTemplate || defaultItemIconTemplate;\r\n      context: { item: item }\r\n    \"\r\n  />\r\n  <ng-container\r\n    *ngTemplateOutlet=\"\r\n      itemTextTemplate || defaultItemTextTemplate;\r\n      context: { item: item }\r\n    \"\r\n  />\r\n</ng-template>\r\n<ng-template #defaultItemIconTemplate let-item=\"item\">\r\n  <mat-icon>{{ item.icon }}</mat-icon>\r\n</ng-template>\r\n<ng-template #defaultItemTextTemplate let-item=\"item\">\r\n  <span class=\"item__text\">{{ item.text }}</span>\r\n</ng-template>\r\n", styles: ["a{cursor:pointer}a.l1{padding-left:16px}a.l2{padding-left:38px}a.l3{padding-left:60px}a.l4{padding-left:82px}a:hover{background:var(--ngbiz-nav-list-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:8px}mat-expansion-panel-header{border-radius:8px}mat-expansion-panel-header.mat-expanded:hover{background:var(--ngbiz-nav-list-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}a.active mat-icon{color:var(--ngbiz-primary, var(--mat-sys-primary, #76b82a))}a.active.l1{padding-left:16px}a.active.l2{padding-left:38px}a.active.l3{padding-left:60px}a.active.l4{padding-left:82px}mat-nav-list{padding-top:0;width:100%}mat-nav-list .mat-mdc-list-item{height:36px}mat-icon{width:18px;height:18px;font-size:18px;line-height:18px!important;color:#616161}.menu-item{display:flex;align-items:center;column-gap:6px}.menu-item>*{line-height:20px}mat-expansion-panel{border-radius:0;background-color:initial}mat-expansion-panel-header{padding:0 16px;height:36px!important}mat-expansion-panel-header.l2{padding-left:38px}mat-expansion-panel-header.l3{padding-left:60px}mat-expansion-panel-header.l4{padding-left:82px}mat-expansion-panel-header.mat-expanded{height:36px}.item__text{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i3$2.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i3$2.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i3$2.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$1.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i5$1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NavListComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-nav-list', standalone: false, template: "<mat-nav-list>\r\n  <ng-container *ngFor=\"let item of items\">\r\n    <ng-container\r\n      *ngTemplateOutlet=\"navItem; context: { item: item, level: 1 }\"\r\n    >\r\n    </ng-container>\r\n  </ng-container>\r\n</mat-nav-list>\r\n<ng-template #navItem let-item=\"item\" let-level=\"level\">\r\n  <a\r\n    *ngIf=\"!item.children?.length\"\r\n    mat-list-item\r\n    [routerLink]=\"parseRoute(item.route)\"\r\n    [activated]=\"isActive(item)\"\r\n    [class.active]=\"isActive(item)\"\r\n    (click)=\"onItemClick()\"\r\n    [class]=\"'l' + level\"\r\n  >\r\n    <div class=\"menu-item\">\r\n      <ng-container\r\n        *ngTemplateOutlet=\"\r\n          itemTemplate || defaultItemTemplate;\r\n          context: { item: item }\r\n        \"\r\n      />\r\n    </div>\r\n  </a>\r\n  <mat-expansion-panel *ngIf=\"item.children?.length\" class=\"mat-elevation-z0\">\r\n    <mat-expansion-panel-header [class]=\"'l' + level\">\r\n      <mat-panel-title>\r\n        <div class=\"menu-item\">\r\n          <ng-container\r\n            *ngTemplateOutlet=\"\r\n              itemTemplate || defaultItemTemplate;\r\n              context: { item: item }\r\n            \"\r\n          />\r\n        </div>\r\n      </mat-panel-title>\r\n    </mat-expansion-panel-header>\r\n    <ng-container *ngFor=\"let child of item.children\">\r\n      <ng-container\r\n        *ngTemplateOutlet=\"navItem; context: { item: child, level: level + 1 }\"\r\n      >\r\n      </ng-container>\r\n    </ng-container>\r\n  </mat-expansion-panel>\r\n</ng-template>\r\n<ng-template #defaultItemTemplate let-item=\"item\">\r\n  <ng-container\r\n    *ngTemplateOutlet=\"\r\n      itemIconTemplate || defaultItemIconTemplate;\r\n      context: { item: item }\r\n    \"\r\n  />\r\n  <ng-container\r\n    *ngTemplateOutlet=\"\r\n      itemTextTemplate || defaultItemTextTemplate;\r\n      context: { item: item }\r\n    \"\r\n  />\r\n</ng-template>\r\n<ng-template #defaultItemIconTemplate let-item=\"item\">\r\n  <mat-icon>{{ item.icon }}</mat-icon>\r\n</ng-template>\r\n<ng-template #defaultItemTextTemplate let-item=\"item\">\r\n  <span class=\"item__text\">{{ item.text }}</span>\r\n</ng-template>\r\n", styles: ["a{cursor:pointer}a.l1{padding-left:16px}a.l2{padding-left:38px}a.l3{padding-left:60px}a.l4{padding-left:82px}a:hover{background:var(--ngbiz-nav-list-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:8px}mat-expansion-panel-header{border-radius:8px}mat-expansion-panel-header.mat-expanded:hover{background:var(--ngbiz-nav-list-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}a.active mat-icon{color:var(--ngbiz-primary, var(--mat-sys-primary, #76b82a))}a.active.l1{padding-left:16px}a.active.l2{padding-left:38px}a.active.l3{padding-left:60px}a.active.l4{padding-left:82px}mat-nav-list{padding-top:0;width:100%}mat-nav-list .mat-mdc-list-item{height:36px}mat-icon{width:18px;height:18px;font-size:18px;line-height:18px!important;color:#616161}.menu-item{display:flex;align-items:center;column-gap:6px}.menu-item>*{line-height:20px}mat-expansion-panel{border-radius:0;background-color:initial}mat-expansion-panel-header{padding:0 16px;height:36px!important}mat-expansion-panel-header.l2{padding-left:38px}mat-expansion-panel-header.l3{padding-left:60px}mat-expansion-panel-header.l4{padding-left:82px}mat-expansion-panel-header.mat-expanded{height:36px}.item__text{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}\n"] }]
        }], ctorParameters: () => [{ type: i1$2.Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { sidenav: [{
                type: Input
            }], items: [{
                type: Input
            }], activeItemId: [{
                type: Input
            }], itemTemplate: [{
                type: ContentChild,
                args: ['item']
            }], itemIconTemplate: [{
                type: ContentChild,
                args: ['itemIcon']
            }], itemTextTemplate: [{
                type: ContentChild,
                args: ['itemText']
            }] } });

class NgBizNavListModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizNavListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizNavListModule, declarations: [NavListComponent], imports: [CommonModule,
            RouterModule,
            MatButtonModule,
            MatExpansionModule,
            MatIconModule,
            MatListModule], exports: [NavListComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizNavListModule, imports: [CommonModule,
            RouterModule,
            MatButtonModule,
            MatExpansionModule,
            MatIconModule,
            MatListModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizNavListModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        NavListComponent,
                    ],
                    imports: [
                        CommonModule,
                        RouterModule,
                        MatButtonModule,
                        MatExpansionModule,
                        MatIconModule,
                        MatListModule,
                    ],
                    exports: [
                        NavListComponent,
                    ],
                }]
        }] });

class ProcessButtonComponent {
    constructor() {
        this.submit = true;
        this.rounded = false;
        this.activeProcess = false;
        this.disabled = false;
        this.color = 'primary';
        this.onButtonClick = new EventEmitter();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ProcessButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ProcessButtonComponent, isStandalone: false, selector: "ngbiz-process-button", inputs: { text: "text", submit: "submit", icon: "icon", rounded: "rounded", activeProcess: "activeProcess", disabled: "disabled", activeProcessText: "activeProcessText", color: "color" }, outputs: { onButtonClick: "onButtonClick" }, ngImport: i0, template: "<button [type]=\"submit?'submit':'button'\" [disabled]=\"disabled || activeProcess\" mat-raised-button [color]=\"color\"\r\n  [class.rounded]=\"rounded\" (click)=\"onButtonClick.emit()\">\r\n  <span *ngIf=\"activeProcess\" class=\"spinner-grow spinner-grow-sm\" role=\"status\" aria-hidden=\"true\"></span>\r\n  <mat-icon *ngIf=\"icon&&!activeProcess\" [svgIcon]=\"icon\"></mat-icon>{{activeProcess ? activeProcessText: text}}\r\n</button>\r\n", styles: [":host{display:inline-block}.spinner-grow{margin-right:8px;margin-top:-2px}mat-icon{margin-right:4px}.rounded{border-radius:18px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ProcessButtonComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-process-button', standalone: false, template: "<button [type]=\"submit?'submit':'button'\" [disabled]=\"disabled || activeProcess\" mat-raised-button [color]=\"color\"\r\n  [class.rounded]=\"rounded\" (click)=\"onButtonClick.emit()\">\r\n  <span *ngIf=\"activeProcess\" class=\"spinner-grow spinner-grow-sm\" role=\"status\" aria-hidden=\"true\"></span>\r\n  <mat-icon *ngIf=\"icon&&!activeProcess\" [svgIcon]=\"icon\"></mat-icon>{{activeProcess ? activeProcessText: text}}\r\n</button>\r\n", styles: [":host{display:inline-block}.spinner-grow{margin-right:8px;margin-top:-2px}mat-icon{margin-right:4px}.rounded{border-radius:18px!important}\n"] }]
        }], propDecorators: { text: [{
                type: Input
            }], submit: [{
                type: Input
            }], icon: [{
                type: Input
            }], rounded: [{
                type: Input
            }], activeProcess: [{
                type: Input
            }], disabled: [{
                type: Input
            }], activeProcessText: [{
                type: Input
            }], color: [{
                type: Input
            }], onButtonClick: [{
                type: Output
            }] } });

class NgBizProcessButtonModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProcessButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizProcessButtonModule, declarations: [ProcessButtonComponent], imports: [CommonModule,
            MatButtonModule,
            MatIconModule], exports: [ProcessButtonComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProcessButtonModule, imports: [CommonModule,
            MatButtonModule,
            MatIconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProcessButtonModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        ProcessButtonComponent,
                    ],
                    imports: [
                        CommonModule,
                        MatButtonModule,
                        MatIconModule,
                    ],
                    exports: [
                        ProcessButtonComponent,
                    ],
                }]
        }] });

/*
 * Public API Surface of ngx-core-business
 */

class ProcessMaskComponent {
    constructor(dialogRef, inputData) {
        this.dialogRef = dialogRef;
        this.inputData = inputData;
        this.message = '';
        const me = this;
        if (me.inputData) {
            me.message = me.inputData.message;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ProcessMaskComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ProcessMaskComponent, isStandalone: false, selector: "ng-component", inputs: { message: "message" }, ngImport: i0, template: "<mat-spinner diameter=\"48\"></mat-spinner>\r\n<div class=\"message\">{{message}}</div>\r\n", styles: [":host{display:flex;justify-items:center;flex-direction:column;text-align:center}\n"], dependencies: [{ kind: "component", type: i2$4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ProcessMaskComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<mat-spinner diameter=\"48\"></mat-spinner>\r\n<div class=\"message\">{{message}}</div>\r\n", styles: [":host{display:flex;justify-items:center;flex-direction:column;text-align:center}\n"] }]
        }], ctorParameters: () => [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }], propDecorators: { message: [{
                type: Input
            }] } });

class NgBizProcessMaskModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProcessMaskModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizProcessMaskModule, declarations: [ProcessMaskComponent], imports: [MatProgressSpinnerModule], exports: [ProcessMaskComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProcessMaskModule, imports: [MatProgressSpinnerModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProcessMaskModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        ProcessMaskComponent,
                    ],
                    imports: [
                        MatProgressSpinnerModule,
                    ],
                    exports: [
                        ProcessMaskComponent,
                    ],
                }]
        }] });

class ProgressViewComponent {
    constructor() {
        this.text = 'Cargando...';
        this.zIndex = 1000;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ProgressViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ProgressViewComponent, isStandalone: false, selector: "ngbiz-progress-view", inputs: { text: "text", zIndex: "zIndex" }, host: { properties: { "style.z-index": "this.zIndex" } }, ngImport: i0, template: "<div>\r\n  <span>{{text}}</span>\r\n  <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\r\n</div>\r\n", styles: [":host{background-color:#fafafa;position:absolute;inset:0;display:flex}:host>div{margin:auto}span{letter-spacing:6px;font-size:14px;display:block;color:#616161;margin-bottom:6px}mat-progress-bar{height:6px;border-radius:4px}\n"], dependencies: [{ kind: "component", type: i3$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ProgressViewComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-progress-view', standalone: false, template: "<div>\r\n  <span>{{text}}</span>\r\n  <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\r\n</div>\r\n", styles: [":host{background-color:#fafafa;position:absolute;inset:0;display:flex}:host>div{margin:auto}span{letter-spacing:6px;font-size:14px;display:block;color:#616161;margin-bottom:6px}mat-progress-bar{height:6px;border-radius:4px}\n"] }]
        }], propDecorators: { text: [{
                type: Input
            }], zIndex: [{
                type: HostBinding,
                args: ['style.z-index']
            }, {
                type: Input
            }] } });

class NgBizProgressViewModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProgressViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizProgressViewModule, declarations: [ProgressViewComponent], imports: [MatProgressBarModule], exports: [ProgressViewComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProgressViewModule, imports: [MatProgressBarModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizProgressViewModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        ProgressViewComponent,
                    ],
                    imports: [
                        MatProgressBarModule,
                    ],
                    exports: [
                        ProgressViewComponent,
                    ],
                }]
        }] });

class SnackBarComponent {
    constructor(data, snackBar) {
        this.data = data;
        this.snackBar = snackBar;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SnackBarComponent, deps: [{ token: MAT_SNACK_BAR_DATA }, { token: i1$3.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: SnackBarComponent, isStandalone: false, selector: "ng-component", ngImport: i0, template: "<div [innerHTML]=\"data.html\"></div>\r\n<div *ngIf=\"data.action\" class=\"text-right\">\r\n  <button mat-button (click)=\"snackBar.dismiss()\">{{data.action}}</button>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", exportAs: ["matButton"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SnackBarComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<div [innerHTML]=\"data.html\"></div>\r\n<div *ngIf=\"data.action\" class=\"text-right\">\r\n  <button mat-button (click)=\"snackBar.dismiss()\">{{data.action}}</button>\r\n</div>\r\n" }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_SNACK_BAR_DATA]
                }] }, { type: i1$3.MatSnackBar }] });

class NgBizSnackBarModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizSnackBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizSnackBarModule, declarations: [SnackBarComponent], imports: [CommonModule,
            MatButtonModule,
            MatSnackBarModule], exports: [SnackBarComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizSnackBarModule, imports: [CommonModule,
            MatButtonModule,
            MatSnackBarModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizSnackBarModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        SnackBarComponent,
                    ],
                    imports: [
                        CommonModule,
                        MatButtonModule,
                        MatSnackBarModule,
                    ],
                    exports: [
                        SnackBarComponent,
                    ]
                }]
        }] });

/**
 * Use this component to display a breadcrumb trail.
 */
class ViewBreadcrumbComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ViewBreadcrumbComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ViewBreadcrumbComponent, isStandalone: false, selector: "ngbiz-view-breadcrumb", ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:flex;align-items:center;height:28px;line-height:28px;padding-left:16px;padding-right:16px;background-color:#e0e0e0;font-weight:500;text-transform:uppercase;font-size:13px}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ViewBreadcrumbComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-view-breadcrumb', standalone: false, template: "<ng-content></ng-content>\n", styles: [":host{display:flex;align-items:center;height:28px;line-height:28px;padding-left:16px;padding-right:16px;background-color:#e0e0e0;font-weight:500;text-transform:uppercase;font-size:13px}\n"] }]
        }] });

class ViewBreadcrumbSeparatorComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ViewBreadcrumbSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ViewBreadcrumbSeparatorComponent, isStandalone: false, selector: "ngbiz-view-breadcrumb-separator", ngImport: i0, template: `&#10095;`, isInline: true, styles: [":host{margin:0 8px;line-height:1;padding-top:1px}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ViewBreadcrumbSeparatorComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-view-breadcrumb-separator', template: `&#10095;`, standalone: false, styles: [":host{margin:0 8px;line-height:1;padding-top:1px}\n"] }]
        }] });

class NgBizBreadcrumbModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizBreadcrumbModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizBreadcrumbModule, declarations: [ViewBreadcrumbComponent,
            ViewBreadcrumbSeparatorComponent], imports: [CommonModule], exports: [ViewBreadcrumbComponent,
            ViewBreadcrumbSeparatorComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizBreadcrumbModule, imports: [CommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizBreadcrumbModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        ViewBreadcrumbComponent,
                        ViewBreadcrumbSeparatorComponent,
                    ],
                    imports: [
                        CommonModule,
                    ],
                    exports: [
                        ViewBreadcrumbComponent,
                        ViewBreadcrumbSeparatorComponent,
                    ],
                }]
        }] });

/*
 * Public API Surface of ngx-core-business
 */

/**
 * Permite factorizar funcionalidad común en todas las páginas del del módulo de administración.
 *
 * @author Jaime Cruz.
 */
class ViewContentWrapperComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ViewContentWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ViewContentWrapperComponent, isStandalone: false, selector: "ngbiz-view-content-wrapper", inputs: { view: "view" }, ngImport: i0, template: "<ngbiz-progress-view *ngIf=\"view.shouldShowProgressView()\"></ngbiz-progress-view>\n<ngbiz-data-error-view *ngIf=\"view.shouldShowErrorView()\" [status]=\"view.getErrorStatus()\"\n  (actionClick)=\"view.loadData()\"></ngbiz-data-error-view>\n<ng-content></ng-content>\n", styles: [":host{display:flex!important;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DataErrorViewComponent, selector: "ngbiz-data-error-view", inputs: ["errorIcon", "buttonIcon", "buttonText", "status", "showActionButton"], outputs: ["actionClick"] }, { kind: "component", type: ProgressViewComponent, selector: "ngbiz-progress-view", inputs: ["text", "zIndex"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ViewContentWrapperComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-view-content-wrapper', standalone: false, template: "<ngbiz-progress-view *ngIf=\"view.shouldShowProgressView()\"></ngbiz-progress-view>\n<ngbiz-data-error-view *ngIf=\"view.shouldShowErrorView()\" [status]=\"view.getErrorStatus()\"\n  (actionClick)=\"view.loadData()\"></ngbiz-data-error-view>\n<ng-content></ng-content>\n", styles: [":host{display:flex!important;flex-direction:column;height:100%}\n"] }]
        }], propDecorators: { view: [{
                type: Input
            }] } });

class NgBizViewContentWrapperModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizViewContentWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizViewContentWrapperModule, declarations: [ViewContentWrapperComponent], imports: [CommonModule,
            NgBizDataErrorViewModule,
            NgBizProgressViewModule], exports: [ViewContentWrapperComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizViewContentWrapperModule, imports: [CommonModule,
            NgBizDataErrorViewModule,
            NgBizProgressViewModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizViewContentWrapperModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        ViewContentWrapperComponent,
                    ],
                    imports: [
                        CommonModule,
                        NgBizDataErrorViewModule,
                        NgBizProgressViewModule,
                    ],
                    exports: [
                        ViewContentWrapperComponent,
                    ],
                }]
        }] });

class ViewTitleComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ViewTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ViewTitleComponent, isStandalone: false, selector: "ngbiz-view-title", ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:block;padding-left:16px;padding-right:16px;font-size:13px}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ViewTitleComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ngbiz-view-title', standalone: false, template: "<ng-content></ng-content>\n", styles: [":host{display:block;padding-left:16px;padding-right:16px;font-size:13px}\n"] }]
        }] });

class NgBizViewTitleModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizViewTitleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: NgBizViewTitleModule, declarations: [ViewTitleComponent], imports: [CommonModule], exports: [ViewTitleComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizViewTitleModule, imports: [CommonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgBizViewTitleModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        ViewTitleComponent,
                    ],
                    imports: [
                        CommonModule,
                    ],
                    exports: [
                        ViewTitleComponent,
                    ],
                }]
        }] });

/*
 * Public API Surface of ngx-core-business
 */

class DialogService {
    constructor(matDialog) {
        this.matDialog = matDialog;
    }
    /**
     * Botones ACEPTAR/CANCELAR
     */
    confirm(title, message, suggested = 'confirm', actionText = 'CONFIRMAR', options) {
        return this.openDialog(DialogComponent, {
            title,
            message,
            buttons: 'confirm_cancel',
            suggested,
            actionText,
        }, options);
    }
    /**
     * Botones SÍ/NO
     */
    yesOrNot(title, message, suggested = 'yes') {
        return this.openDialog(DialogComponent, {
            title,
            message,
            buttons: 'yes_not',
            suggested,
        });
    }
    /**
     * Botones ELIMINAR/CANCELAR
     */
    confirmDelete(title, message, actionText = 'ELIMINAR') {
        return this.openDialog(DialogComponent, {
            title,
            message,
            buttons: 'confirm_cancel',
            actionText,
            actionButtonColor: 'warn',
            suggested: 'cancel',
            maxWidth: 360,
        });
    }
    /**
     * Botones ACEPTAR
     */
    alert(title, message, options) {
        return this.openDialog(DialogComponent, {
            title,
            message,
            buttons: 'ok',
            actionText: 'ACEPTAR',
            actionButtonColor: 'primary',
            maxWidth: 360,
            ...options,
        });
    }
    decide(title, message, options) {
        return this.openDialog(DialogComponent, {
            title,
            message,
            options,
        });
    }
    open(component, data, options) {
        return this.matDialog
            .open(component, {
            data,
            disableClose: true,
            position: { top: '50px' },
            width: '100%',
            ...options,
        })
            .afterClosed();
    }
    /**
     * Abrir editor
     *
     * @param editorCmp Dialog component
     * @param model      Model
     * @param parent      Parent Model
     * @param data        Aditional data
     */
    openEditor(editorCmp, model, parent, data) {
        return this.matDialog
            .open(editorCmp, {
            data: {
                model,
                parent,
                data,
            },
            disableClose: true,
            position: { top: '50px' },
        })
            .afterClosed();
    }
    openDialog(editor, data, options) {
        return this.matDialog
            .open(editor, {
            data,
            disableClose: true,
            position: { top: '50px' },
            ...options,
        })
            .afterClosed();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DialogService, deps: [{ token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DialogService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DialogService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [{ type: i1$1.MatDialog }] });

const HttpStatusMessages = {
    0: 'No se pudo conectar con el servidor',
    400: 'El servidor no pudo procesar la petición',
    401: 'Inicio de sesión requerido.',
    403: 'Acceso prohibido.',
    404: 'Es servicio solicitado no existe.',
    500: 'Ha ocurrido un error en nuestro servidor, por favor intente más tarde.',
    502: 'No se recibio respuesta de servicio externo.',
    503: 'Este servicio se encuentra temporalmente deshabilitado.'
};

class XhrInfo {
    /**
     * true is status = 400
     */
    static isBadRequest(xhr) {
        return xhr.status == HttpStatusCode.BadRequest;
    }
    /**
     * true is status = 401
     */
    static isUnauthorized(xhr) {
        return xhr.status == HttpStatusCode.Unauthorized;
    }
    /**
     * true is status = 403
     */
    static isForbidden(xhr) {
        return xhr.status == HttpStatusCode.Forbidden;
    }
    static getStatusMessage(status) {
        return HttpStatusMessages[status] || `Error status: ${status}`;
    }
}

class NotificationsService {
    constructor(_snackBar, matDialog) {
        this._snackBar = _snackBar;
        this.matDialog = matDialog;
        this.http_server_message_tpl = `
  <p style="max-width: 360px;">
    CITES - PERÚ<br>
    <i>{message}</i>
  </p>
  <small><small>ERROR {status}</small></small>`;
    }
    handleXhrError(xhr, cmp) {
        const me = this, defaultMessageStatuses = [
            0, // No internet
            404, // Servicio no encontrado
            500, // Server error
        ], status = xhr.status;
        let finalMessage;
        me.logXhr(xhr);
        // Defaul
        if (defaultMessageStatuses.indexOf(status) != -1) {
            me.showDefaultMessage(status);
            return;
        }
        // No server response
        if (status === undefined || status === null) {
            me.noServerResponse();
            return;
        }
        // Authentication Required
        if (status == 401 && cmp && cmp.__forceClose) {
            cmp.__forceClose();
            return;
        }
        // Authentication Required/Como login.redirect.interceptor.ts redirecciona a login,
        // No es necesario mostrar el mensaje de error.
        if (status == 401) {
            return;
        }
        // Autenticación requerida: 401
        if (status == 400) {
            const error = xhr.error.toString() == '[object Object]' ? xhr.error : {};
            const messageType = status == 400 ? 'warning' : 'danger';
            // Show server message
            if (error.message) {
                finalMessage = me.http_server_message_tpl
                    .replace('{message}', error.message)
                    .replace('{status}', status);
                me.showSnack(finalMessage, messageType);
                return;
            }
            me.showDefaultMessage(status);
            return;
        }
        me.showDefaultMessage(status);
    }
    showSnack(message, type) {
        this._snackBar.openFromComponent(SnackBarComponent, {
            panelClass: this.getSnackClass(type),
            data: {
                html: message,
            },
            duration: 2000,
            verticalPosition: 'top', // 'top' | 'bottom'
        });
    }
    mask(message) {
        return this.matDialog.open(ProcessMaskComponent, {
            disableClose: true,
            data: {
                message,
            },
        });
    }
    snackSuccess(message) {
        this._snackBar.openFromComponent(SnackBarComponent, {
            panelClass: this.getSnackClass('success'),
            data: {
                html: message,
            },
            duration: 2000,
            verticalPosition: 'top', // 'top' | 'bottom'
        });
    }
    snackDanger(message) {
        this._snackBar.openFromComponent(SnackBarComponent, {
            panelClass: this.getSnackClass('danger'),
            data: {
                html: message,
            },
            duration: 2000,
            verticalPosition: 'top', // 'top' | 'bottom'
        });
    }
    snackWarning(message) {
        this._snackBar.openFromComponent(SnackBarComponent, {
            panelClass: this.getSnackClass('warning'),
            data: {
                html: message,
            },
            duration: 2000,
            verticalPosition: 'top', // 'top' | 'bottom'
        });
    }
    snackInfo(message) {
        this._snackBar.openFromComponent(SnackBarComponent, {
            panelClass: this.getSnackClass('info'),
            data: {
                html: message,
            },
            duration: 2000,
            verticalPosition: 'top', // 'top' | 'bottom'
        });
    }
    getSnackClass(type) {
        const map = {
            warning: ['bg-warning', 'text-dark'],
            danger: ['bg-danger', 'text-white'],
            info: ['bg-info', 'text-white'],
            success: ['bg-success', 'text-white'],
        };
        return map[type];
    }
    logXhr(xhr) {
        console.error(xhr);
    }
    noInternet() {
        this.showDefaultMessage(0);
    }
    noServerResponse() {
        this.showDefaultMessage(503);
    }
    serverUnauthorized() {
        this.showDefaultMessage(401);
    }
    showDefaultMessage(status) {
        this._snackBar.open(XhrInfo.getStatusMessage(status), 'ACEPTAR', {
            verticalPosition: 'top',
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NotificationsService, deps: [{ token: i1$3.MatSnackBar }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NotificationsService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NotificationsService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [{ type: i1$3.MatSnackBar }, { type: i1$1.MatDialog }] });

const EMAIL_PATTERN = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
const URL_PATTERN = /(((^https?)|(^ftp)):\/\/((([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*)|(localhost|LOCALHOST))\/?)/i;
class FormBuilderHelper {
    constructor(formBuilder) {
        this.formBuilder = formBuilder;
    }
    buildFormGroup(fields, values = {}) {
        const me = this;
        const formGroupObjet = {};
        let formFieldDefinition;
        let fieldValue;
        values = values || {};
        for (const fieldName of Object.keys(fields)) {
            formFieldDefinition = fields[fieldName];
            fieldValue = values[fieldName];
            if (formFieldDefinition.groupType === 'object') {
                formGroupObjet[fieldName] = me.buildFormGroup(formFieldDefinition, fieldValue);
                continue;
            }
            if (formFieldDefinition.groupType === 'array') {
                formGroupObjet[fieldName] = me.buildFormArray(formFieldDefinition, fieldValue);
                continue;
            }
            formGroupObjet[fieldName] = me.getFormGroupFieldDefinition(formFieldDefinition, fieldValue);
        }
        return this.formBuilder.group(formGroupObjet);
    }
    /**
     * Retronar un arreglo de validadores
     *
     * @param field
     */
    getValidators(field) {
        const out = [];
        if (field.required) {
            out.push(Validators.required);
        }
        if (field.min !== undefined) {
            out.push(Validators.min(field.min));
        }
        if (field.max !== undefined) {
            out.push(Validators.max(field.max));
        }
        if (field.minLength) {
            out.push(Validators.minLength(field.minLength));
        }
        if (field.maxLength) {
            out.push(Validators.maxLength(field.maxLength));
        }
        if (field.email) {
            out.push(Validators.email);
        }
        if (field.emailPattern) {
            out.push(Validators.pattern(EMAIL_PATTERN));
        }
        if (field.urlPattern) {
            out.push(Validators.pattern(URL_PATTERN));
        }
        if (field.pattern) {
            out.push(Validators.pattern(field.pattern));
        }
        if (field.customValidation) {
            out.push(field.customValidation);
        }
        return out;
    }
    buildFormArray(fields, rows) {
        const me = this;
        const formArray = [];
        rows = rows || [];
        rows.forEach((item) => {
            formArray.push(me.buildFormGroup(fields, item));
        });
        return this.formBuilder.array(formArray);
    }
    getFormGroupFieldDefinition(formFieldDefinition, fieldValue) {
        const me = this;
        let fieldPropsObj;
        // If the valueType is array and the value is a string, we need to convert it to an array
        if (formFieldDefinition.valueType === 'array' && typeof fieldValue === 'string') {
            fieldValue = fieldValue.split(',').map((value) => {
                if (formFieldDefinition.arrayValueType === 'number') {
                    return Number(value);
                }
                return value.trim();
            });
        }
        fieldValue = fieldValue !== undefined ? fieldValue : formFieldDefinition.defaultValue;
        // disabled Field
        if (formFieldDefinition.disabled) {
            fieldPropsObj = { value: fieldValue, disabled: true };
        }
        else {
            fieldPropsObj = fieldValue;
        }
        return [fieldPropsObj, me.getValidators(formFieldDefinition)];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FormBuilderHelper, deps: [{ token: i2$3.FormBuilder }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FormBuilderHelper, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FormBuilderHelper, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: i2$3.FormBuilder }] });

/**
 * Form Component
 * EDITAR Y GUARDAR
 * Clase base para todos los formularios
 */
class FormDialogComponent {
    constructor(injector, api, dialogRef, inputData) {
        this.injector = injector;
        this.hostCls = 'ngbiz-custom-material__mat-dialog--form';
        //
        this.data = {};
        this.parent = {};
        this.modelIdProperty = 'id';
        this.apiUrl = '';
        this.dataPath = '';
        // Texts
        this.fieldRequiredErrorMessageText = 'Requerido';
        this.msgSuccessfulCreateText = 'Creado correctamente';
        this.msgSuccessfulUpdateText = 'Actualizado correctamente';
        this.invalidValuesMessage = 'Complete los campos requeridos y corrija los errores identificados';
        this.formFields = {};
        /**
         * Llamar al metodo buildFormModel al inicio.
         */
        this.buildFormModelOnInit = true;
        /**
         * @cfg
         * Definir los campos que tendrá el formulario
         */
        this.fields = [];
        this.notifications = injector.get(NotificationsService);
        this.formBuilder = injector.get(UntypedFormBuilder);
        this.dialogService = injector.get(DialogService);
        this.fbHelper = injector.get(FormBuilderHelper);
        this.api = api;
        this.dialogRef = dialogRef;
        this.model = inputData?.model ? inputData.model : this.createModel();
        this.parent = inputData ? inputData.parent : {};
        this.data = inputData ? inputData.data : {};
    }
    createModel() {
        return {};
    }
    /**
     * Enviar datos
     */
    onSubmit() {
        const me = this;
        // Si esta guardando.
        if (me._isSaving) {
            return;
        }
        // Si los datos son incorrectos
        if (!me.isValid()) {
            me.showInvalidValuesMessage();
            return;
        }
        me.setStatusSaving();
        let postModel = me.getPostData();
        me.getSaveService(postModel).subscribe((rec) => {
            me.notifications.snackSuccess(me.isCreationMode()
                ? me.msgSuccessfulCreateText
                : me.msgSuccessfulUpdateText);
            me.dialogRef.close(rec);
        }, (xhr) => {
            if (xhr.status == 401) {
                me.dialogRef.close();
                return;
            }
            me.handleServerError(xhr);
            me.setStatusReady();
        });
    }
    isNew() {
        return this.mode == 'add';
    }
    getSaveService(model) {
        return this.api.save(model, model[this.modelIdProperty]);
    }
    showInvalidValuesMessage() {
        const me = this;
        me.notifications.snackWarning(me.invalidValuesMessage);
    }
    /**
     * Este metodo puede ser sobre escrito para manejar internamente las excepciones del servidor
     */
    handleServerError(xhr) {
        this.notifications.handleXhrError(xhr, this);
    }
    isCreationMode() {
        return this.mode == 'add';
    }
    isEditionMode() {
        return this.mode == 'edit';
    }
    ngOnInit() {
        const me = this;
        me.mode = me.model && me.model[me.modelIdProperty] ? 'edit' : 'add';
        if (me.buildFormModelOnInit) {
            me.defineFormModel();
        }
        me.loadDatasets();
    }
    /**
     * Hook for data loading, it is called once on ngOnInit
     */
    loadDatasets() { }
    ;
    isValid() {
        return this.formModel.valid;
    }
    /**
     * Este metodo retorna los campos que son enviados al servidor
     */
    getPostData() {
        const me = this;
        if (this.useFormRawValue) {
            return { ...me.model, ...me.formModel.getRawValue() };
        }
        return { ...me.model, ...me.formModel.value };
    }
    /**
     * Permite determinar si el campo debe incluirse en el formulario
     * @param field
     * @returns
     */
    hasField(field) {
        return this.formFields && this.formFields.hasOwnProperty(field);
    }
    /**
     * Retorna el campo del formulario solicitado
     * @param name
     */
    getFormControl(name) {
        return this.formModel.get(name);
    }
    getFieldProperty(fieldName, prop) {
        return this.formFields[fieldName] ? this.formFields[fieldName][prop] : null;
    }
    hasError(fieldName, errorType) {
        return this.getFormControl(fieldName)?.hasError(errorType);
    }
    isFieldRequired(fieldName) {
        return this.hasError(fieldName, 'required');
    }
    hasMinLengthError(fieldName) {
        return this.hasError(fieldName, 'minlength');
    }
    hasMaxLengthError(fieldName) {
        return this.hasError(fieldName, 'maxlength');
    }
    hasPatternError(fieldName) {
        return this.hasError(fieldName, 'pattern');
    }
    getRequiredErrorMessage(_fieldName = '') {
        return this.fieldRequiredErrorMessageText;
    }
    getMinLengthErrorMessage(fieldName) {
        return `Mín ${this.getFieldProperty(fieldName, 'minLength')} caracteres.`;
    }
    getMaxLengthErrorMessage(fieldName) {
        return `Máx ${this.getFieldProperty(fieldName, 'maxLength')} caracteres.`;
    }
    shouldShowErrorMessage(fieldName) {
        const me = this;
        let control = me.getFormControl(fieldName);
        return control && control.invalid && (control.dirty || control.touched);
    }
    getFieldValue(field) {
        return this.getFormControl(field)?.value;
    }
    setFieldValue(field, value) {
        this.getFormControl(field)?.setValue(value);
    }
    isFieldValid(field) {
        return this.getFormControl(field)?.valid;
    }
    buildFormModel() {
        const me = this;
        let formGroupObjet = {}, fieldValue, fieldPropsObj;
        me.fields.forEach((field) => {
            field = me.preProcessDefinedField(field);
            fieldValue = me.model[field.name];
            fieldValue = fieldValue !== undefined ? fieldValue : field.defaultValue;
            // disabled Field
            if (field.disabled) {
                fieldPropsObj = { value: fieldValue, disabled: true };
            }
            else {
                fieldPropsObj = fieldValue;
            }
            formGroupObjet[field.name] = [fieldPropsObj, me.fbHelper.getValidators(field)];
        });
        if (me.formBuilder)
            me.formModel = me.formBuilder.group(formGroupObjet);
    }
    defineFormModel() {
        const me = this;
        const fields = {};
        for (const fieldName of Object.keys(me.formFields)) {
            fields[fieldName] = me.transformDefinedField(fieldName, me.formFields[fieldName]);
        }
        me.formModel = me.fbHelper.buildFormGroup(fields, me.getValuesForFormModel(me.model));
    }
    /**
   * Permite modificar la definición original del campo antes de construir el formControl
   * @param field
   * @returns
   */
    transformDefinedField(_fieldName, field) {
        return field;
    }
    /**
     * Permite modificar los valores que se usarán para construir el formControl
     * @param field
     * @returns
     */
    getValuesForFormModel(values) {
        return values;
    }
    updateForm() {
        this.buildFormModel();
    }
    /**
     * Permite modificar la definición original del campo antes de construir un formControl
     * @param field
     * @returns
     */
    preProcessDefinedField(field) {
        return field;
    }
    setFieldDisabled(fieldName, disabled) {
        const me = this;
        me.fields = me.fields.map((field) => {
            if (field.name == fieldName) {
                field.disabled = disabled;
            }
            return field;
        });
        me.updateForm();
    }
    // Estado por defecto
    setStatusReady() {
        this._isReady = true;
        this._isSaving = false;
    }
    // Guardando...
    setStatusSaving() {
        this._isSaving = true;
        this._isReady = false;
    }
    // Cierra inmediatamente la interfaz
    __forceClose() {
        this.dialogRef.close();
    }
    getApiUrl() {
        return this.apiUrl;
    }
    getDataPath() {
        return this.dataPath;
    }
    getCollectionUrl() {
        return this.getApiUrl() + '/' + this.getDataPath();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FormDialogComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: FormDialogComponent, isStandalone: true, host: { properties: { "class": "this.hostCls" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FormDialogComponent, decorators: [{
            type: Directive
        }], ctorParameters: () => [{ type: i0.Injector }, { type: undefined }, { type: undefined }, { type: undefined }], propDecorators: { hostCls: [{
                type: HostBinding,
                args: ['class']
            }] } });

class ModelViewComponent {
    constructor(injector) {
        this.injector = injector;
        // @config llama a loadData inmediatamente
        this.autoload = true;
        this._loadDataCount = 0;
        this._isLoadingData = false;
        this._didLoadDataFailed = false;
        this._didValidationFailed = false;
        this.messageType = 'info';
        this.messageActionText = 'Intentar nuevamente';
        this.messageActionIcon = 'app:refresh';
        this.modelObs = new BehaviorSubject(null);
        this.model$ = this.modelObs.asObservable();
        this.loadObs = new Subject();
        this.load = this.loadObs.asObservable();
        this.errorStatus = 0;
        this.notifications = injector.get(NotificationsService);
        this.router = injector.get(Router);
        this.route = injector.get(ActivatedRoute);
        this.location = injector.get(Location);
    }
    // Keyboard listeners
    keyEvent(e) {
        const me = this;
        if (e.target.tagName != 'BODY') {
            return;
        }
        // Reload data
        if (e.code === 'KeyA') {
            me.loadData();
        }
    }
    ngOnInit() {
        const me = this;
        me._subscribeLoadEvent();
        me.subscribeRouteParams();
        if (me.autoload) {
            me.loadData();
        }
    }
    ngOnDestroy() {
        if (this._loadSubcription) {
            this._loadSubcription.unsubscribe();
        }
    }
    loadData() {
        if (this.validParams()) {
            this.loadObs.next(null);
        }
    }
    validParams() {
        return true;
    }
    subscribeRouteParams() { }
    _subscribeLoadEvent() {
        const me = this;
        me._loadSubcription = me.load
            .pipe(switchMap(() => {
            me._loadDataCount++;
            me._isLoadingData = true;
            return me.getDataService().pipe(catchError((xhr) => {
                me._isLoadingData = false;
                me._didLoadDataFailed = true;
                me.onError(xhr);
                return of(null);
            }));
        }))
            .subscribe(me.setModel.bind(me));
    }
    onData(data) { }
    onError(xhr) {
        this.errorStatus = xhr.status;
    }
    setModel(model) {
        this.model = model;
        this.onData(model);
        this.modelObs.next(model);
    }
    /**
     * Determina si se debería o no mostrar el mensaje de cargando
     */
    shouldShowProgressView() {
        const me = this;
        return me._isLoadingData && !me.model;
    }
    shouldShowErrorView() {
        const me = this;
        return (!me._isLoadingData && (me._didLoadDataFailed || me._didValidationFailed));
    }
    shouldShowPageMessage() {
        const me = this;
        return (!me._isLoadingData && (me._didLoadDataFailed || me._didValidationFailed));
    }
    print() {
        window.print();
    }
    getErrorStatus() {
        return this.errorStatus;
    }
    getCurrentUrl() {
        return location.href;
    }
    getBaseHref() {
        return document.baseURI;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ModelViewComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: ModelViewComponent, isStandalone: true, host: { listeners: { "window:keyup": "keyEvent($event)" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ModelViewComponent, decorators: [{
            type: Directive
        }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { keyEvent: [{
                type: HostListener,
                args: ['window:keyup', ['$event']]
            }] } });

class FormComponent extends ModelViewComponent {
    constructor(injector, api) {
        super(injector);
        this.api = api;
        this.formFields = {};
        this.modelIdProperty = 'id';
        this.autoload = false;
        this.dataPath = '';
        // Texts
        this.fieldRequiredErrorMessageText = 'Requerido';
        this.invalidValuesMessageText = `<strong>El formulario contiene errores</strong>
                              <div>
                                Para continuar, corrija los errores indicados.
                              </div>`;
        this.msgSuccessfulCreateText = 'Creado correctamente';
        this.msgSuccessfulUpdateText = 'Actualizado correctamente';
        this._isSaving = false;
        /**
         * This property is used to idenfify whe the form model don't exist yet
         */
        this.routeCreateKeyword = 'registrar';
        this.api = api;
        this.fbHelper = injector.get(FormBuilderHelper);
    }
    subscribeRouteParams() {
        const me = this;
        me.route.paramMap.subscribe(function (paramMap) {
            let id = paramMap.get('id') || '';
            // Creation
            if (id === me.routeCreateKeyword) {
                return;
            }
            // Edition
            // RegEx id válido
            const re = /^[1-9]{1}\d*/;
            // Id inválido.
            if (!re.test(id)) {
                alert('invalid route');
                return;
            }
            me.modelId = +id;
        });
    }
    ngOnInit() {
        const me = this;
        super.ngOnInit();
        // Cargar datos
        me.loadDatasets();
        // Creation
        if (!me.isRecordStored()) {
            me.setModel(me.getNewModel());
            me.defineFormModel();
            return;
        }
        // Edition
        me.loadData();
    }
    onData(model) {
        this.defineFormModel();
    }
    /**
     * Hook para cargar datasets relacionados como por ejemplo: listas de selección
     */
    loadDatasets() { }
    ;
    getPostData() {
        const me = this;
        return { ...me.model, ...me.formModel.value };
    }
    getNewModel() {
        const me = this;
        return {};
    }
    getModelId() {
        return this.modelId || (this.model ? this.model[this.modelIdProperty] : null);
    }
    isFormValid() {
        return this.formModel.valid;
    }
    /**
     * Permite determinar si el campo debe incluirse en el formulario
     * @param field
     * @returns
     */
    hasField(field) {
        return this.formFields && this.formFields.hasOwnProperty(field);
    }
    /**
     * Retorna el campo del formulario solicitado
     * @param name
     */
    getFormControl(name) {
        return this.formModel.get(name);
    }
    hasError(fieldName, errorType) {
        return this.getFormControl(fieldName)?.hasError(errorType);
    }
    getFieldProperty(fieldName, prop) {
        return this.formFields[fieldName] ? this.formFields[fieldName][prop] : null;
    }
    getFieldValue(field) {
        return this.getFormControl(field)?.value;
    }
    defineFormModel() {
        const me = this;
        const fields = {};
        for (const fieldName of Object.keys(me.formFields)) {
            fields[fieldName] = me.transformDefinedField(fieldName, me.formFields[fieldName]);
        }
        me.formModel = me.fbHelper.buildFormGroup(fields, me.getValuesForFormModel(me.model));
    }
    /**
     * Permite modificar la definición original del campo antes de construir el formControl
     * @param field
     * @returns
     */
    transformDefinedField(fieldName, field) {
        return field;
    }
    /**
     * Permite modificar los valores que se usarán para construir el formControl
     * @param field
     * @returns
     */
    getValuesForFormModel(values) {
        return values;
    }
    isFieldRequired(fieldName) {
        return this.hasError(fieldName, 'required');
    }
    hasMinLengthError(fieldName) {
        return this.hasError(fieldName, 'minlength');
    }
    hasMaxLengthError(fieldName) {
        return this.hasError(fieldName, 'maxlength');
    }
    getRequiredErrorMessage(_fieldName = '') {
        return this.fieldRequiredErrorMessageText;
    }
    getMinLengthErrorMessage(fieldName) {
        return `Mín ${this.getFieldProperty(fieldName, 'minLength')} caracteres.`;
    }
    getMaxLengthErrorMessage(fieldName) {
        return `Máx ${this.getFieldProperty(fieldName, 'maxLength')} caracteres.`;
    }
    onSubmit() {
        const me = this;
        if (!me.isFormValid()) {
            me.notifications.snackWarning(me.invalidValuesMessageText);
            return;
        }
        me._isSaving = true;
        // Mostrar animación
        setTimeout(() => {
            me.getSaveService(me.getPostData()).subscribe((model) => {
                me.notifications.snackSuccess(me.isRecordStored()
                    ? me.msgSuccessfulUpdateText
                    : me.msgSuccessfulCreateText);
                me.setModel(model);
                me._isSaving = false;
            }, (xhr) => {
                me._isSaving = false;
                me.notifications.handleXhrError(xhr);
            });
        }, 250);
    }
    resetValues() {
        this.setModel(this.model);
    }
    /**
     *
     * @returns true si el modelo posee un id.
     */
    isRecordStored() {
        return !!this.getModelId();
    }
    getDataService() {
        return this.api.get(this.modelId);
    }
    getSaveService(model) {
        return this.api.save(model, this.getModelId());
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FormComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: FormComponent, isStandalone: true, inputs: { dataPath: "dataPath" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FormComponent, decorators: [{
            type: Directive
        }], ctorParameters: () => [{ type: i0.Injector }, { type: undefined }], propDecorators: { dataPath: [{
                type: Input
            }] } });

class StringUtils {
    /**
     * Example:
     * ```
     *  StringUtils.format('hello {0}', 'world');
     * ```
     *
     * @param tpl
     * @param args
     */
    static format(tpl, ...args) {
        args.forEach((value, idx) => {
            const re = new RegExp('\\{' + idx + '\\}', 'g');
            tpl = tpl.replace(re, value);
        });
        return tpl;
    }
    static compileTpl(tpl, tplData) {
        return tpl.replace(/\{([^}]+)\}/g, (_, key) => {
            return tplData[key];
        });
    }
}

/**
 * Component Base Class
 *
 * Clase base para componentes que muestran datos en formato de listas o tablas
 * cargando datos desde el servidor.
 *
 * @author Jaime Cruz.
 */
var COMPONENT_TYPE;
(function (COMPONENT_TYPE) {
    COMPONENT_TYPE["PAGE"] = "page";
    COMPONENT_TYPE["COMPONENT"] = "component";
})(COMPONENT_TYPE || (COMPONENT_TYPE = {}));
class TableViewComponent {
    constructor(injector) {
        this.injector = injector;
        this.selectionChange = new EventEmitter();
        /**
         * Tipo de componente
         *  - page: Si el componente que extiende está asociado con una ruta.
         *  - component: Si el componente extendido esta dentro de otro componente
         *
         */
        this.type = 'page';
        // @config llama a loadData inmediatamente
        this.autoload = true;
        this.apiUrl = '';
        this.sendModelOnDelete = false;
        this.requestParams = {};
        this.dataPath = '';
        this.displayedColumns = [];
        this.itemSingularName = 'ítem';
        this.itemPluralName = 'ítems';
        this.itemSingularArticle = 'el';
        // Si se asigna un valor a la propiedad en una subclase, ya no se usará confirmDeleteTitleTpl
        this.confirmDeleteTitle = '';
        this.confirmDeleteTitleTpl = 'Eliminar {itemName}';
        this.deleteItemQuestionText = '';
        this.deleteItemQuestionTextTpl = '¿Seguro que desea eliminar {itemArticle} {itemName}?';
        this.deleteItemConfirmDialogContentTpl = '{question}<div class="mt-2"><strong style="text-transform: capitalize;">{itemName}</strong></div>';
        this.deleteItemConfirmButtonText = 'ELIMINAR';
        this.successfullyDeletedItemNotificationTpl = '{itemName} eliminado correctamente';
        this.editionDisabled = false;
        // Propiedades disponibles
        this.pageSize = 25;
        this.pageIndex = 0;
        this.totalRecords = 0;
        this.selectedRowIndex = -1;
        this.selectionMultiple = false;
        this.modelIdProperty = 'id';
        this.modelNameProperty = 'name';
        this.filters = [];
        this.$fields = '';
        // Propiedades de estado
        this._isLoadingData = false;
        this._didLoadDataFailed = false;
        //
        this.clearDataOnFail = true;
        this.loadObs = new Subject();
        this.load = this.loadObs.asObservable();
        this.errorStatus = 0;
        this.notifications = injector.get(NotificationsService);
        this.http = injector.get(HttpClient);
        this.httpGetList = injector.get(HttpCollectionService);
        this.matDialog = injector.get(MatDialog);
        this.router = injector.get(Router);
        this.route = injector.get(ActivatedRoute);
        this.dialogService = injector.get(DialogService);
        // Selection model
        this.selection = new SelectionModel(this.selectionMultiple, []);
    }
    // Keyboard listeners
    keyEvent(e) {
        const me = this;
        if (e.target.tagName != 'BODY') {
            return;
        }
        // Reload data
        if (e.code === 'KeyA') {
            me.loadData();
            return;
        }
        // Open editor
        if (e.code === 'Enter' && me.getSelection().length == 1 && me.editorClass) {
            me.editItemHandler(me.selection.selected[0]);
            return;
        }
        // Select Next
        if (e.code === 'ArrowDown' && me.getSelection().length == 1) {
            me.selectNext();
            return;
        }
        // Select Previus
        if (e.code === 'ArrowUp' && me.getSelection().length == 1) {
            me.selectPrevious();
        }
    }
    loadData() {
        this.loadObs.next(null);
    }
    _subscribeLoadEvent() {
        const me = this;
        me._loadSubcription = me.load
            .pipe(switchMap(() => {
            me.beforeLoad();
            me._isLoadingData = true;
            me._didLoadDataFailed = false;
            return me.httpGetList
                .get(me.getRequestUrl(), me.getBaseRequestParams())
                .pipe(catchError((xhr) => {
                me._isLoadingData = false;
                me._didLoadDataFailed = true;
                me.handleServerError(xhr);
                return of(null);
            }));
        }))
            .subscribe(me.onDataServiceResponse.bind(me));
    }
    onDataServiceResponse(res) {
        const me = this;
        // When error has happened and was catched by catchError
        if (me._didLoadDataFailed)
            return;
        let data = [], total = 0;
        // res: {data: any[], total: number }
        if (Object.prototype.toString.call(res) == '[object Object]' &&
            Array.isArray(res.data)) {
            data = res.data;
            if (isNaN(res.total)) {
                total = data.length;
            }
            else {
                total = +res.total > data.length ? +res.total : data.length;
            }
        }
        // res: any[]
        else if (Array.isArray(res)) {
            data = res;
            total = res.length;
        }
        me._rawData = data.map(e => { return { ...e }; });
        me._rawTransformedData = me.transformServiceResponseData(data);
        me.data = me._rawTransformedData.map(e => { return { ...e }; });
        me.totalRecords = total;
        me._isLoadingData = false;
    }
    transformServiceResponseData(data) {
        return data;
    }
    /**
     * Hook
     * Es llamado antes de solicitar datos al servidor
     */
    beforeLoad() { }
    getSelection() {
        const me = this;
        let selection = me.selection.selected;
        if (selection.length) {
            // Single selection
            if (!me.selectionMultiple) {
                if (me.recordExists(selection[0])) {
                    return selection;
                }
                me.selection.clear();
                return [];
            }
            else {
                selection = selection.filter((item) => me.recordExists(item));
                me.selection.clear();
                selection.forEach((item) => me.selection.select(item));
            }
        }
        return me.selection.selected;
    }
    recordExists(rec) {
        let out = false;
        let data = this.data || [];
        data.forEach((item) => {
            if (item == rec) {
                out = true;
            }
        });
        return out;
    }
    getRecordByIndex(idx) {
        let data = this.data || [];
        return data[idx] ? data[idx] : null;
    }
    getRecordIndex(rec) {
        let out = -1;
        let data = this.data || [];
        data.forEach((item, idx) => {
            if (item === rec) {
                out = idx;
            }
        });
        return out;
    }
    selectNext() {
        const me = this;
        // Matener condicionales separadas
        if (!me.selection.hasValue()) {
            return;
        }
        if (me.selectionMultiple) {
            return;
        }
        let index = me.getRecordIndex(me.selection.selected[0]);
        if (me.validIndex(index)) {
            let nextRec = me.getRecordByIndex(index + 1);
            if (nextRec) {
                me.selection.select(nextRec);
            }
        }
    }
    selectPrevious() {
        const me = this;
        // Matener condicionales separadas
        if (!me.selection.hasValue()) {
            return;
        }
        if (me.selectionMultiple) {
            return;
        }
        let index = me.getRecordIndex(me.selection.selected[0]);
        if (me.validIndex(index)) {
            let nextRec = me.getRecordByIndex(index - 1);
            if (nextRec) {
                me.selection.select(nextRec);
            }
        }
    }
    validIndex(index) {
        return index != -1;
    }
    getBaseRequestParams() {
        const me = this, paginator = me.paginator, sorter = me.sort, filters = me.getFilters(), fields = me.$fields;
        let out = {};
        // Paginación
        if (paginator) {
            out.page = paginator.pageIndex + 1;
            out.limit = paginator.pageSize;
        }
        else {
            out.page = me.pageIndex + 1;
            out.limit = me.pageSize;
        }
        // Query
        if (me.searchFilter?.value) {
            out.query = me.searchFilter?.value;
        }
        // Filters
        if (filters && filters.length) {
            out.filters = filters;
        }
        // Sorters
        // Por ahora solo está soportando un simple sort
        if (sorter && sorter.active && sorter.direction) {
            out.sorters = [{ field: sorter.active, direction: sorter.direction }];
        }
        if (fields) {
            out.fields = fields;
        }
        return out;
    }
    getApiUrl() {
        return this.apiUrl;
    }
    getDataPath() {
        return this.dataPath;
    }
    getCollectionUrl() {
        return this.getApiUrl() + '/' + this.getDataPath();
    }
    getDeleteResourceUrl(model) {
        const me = this;
        let modelId = model[me.modelIdProperty];
        return me.getCollectionUrl() + '/' + modelId;
    }
    getRequestUrl() {
        const me = this, queryParams = me.getRequestParams(), url = me.router
            .createUrlTree([me.getDataPath()], { queryParams })
            .toString();
        return me.getApiUrl() + url;
    }
    getRequestParams() {
        return this.requestParams;
    }
    /**
     * ACTION HANDLERS
     */
    addItemHandler() {
        const me = this;
        const dialogRef = me.matDialog.open(me.editorClass, {
            data: me.getEditorData(),
            position: { top: '50px' },
            disableClose: true,
        });
        // Cuando el formulario se cierra.
        dialogRef.afterClosed().subscribe((data) => {
            me.afterCreateEditorClosed(data);
        });
    }
    editItemHandler(rec) {
        const me = this;
        if (me.editionDisabled) {
            return;
        }
        const dialogRef = me.matDialog.open(me.editorClass, {
            data: me.getEditorData(rec),
            disableClose: true,
            position: { top: '50px' },
        });
        dialogRef.afterClosed().subscribe((data) => {
            me.afterUpdateEditorClosed(data);
        });
    }
    deleteItemHandler(model) {
        const me = this;
        me.dialogService
            .confirmDelete(me.getDeleteItemConfirmDialogTitle(model), me.getDeleteItemConfirmDialogContent(model), me.deleteItemConfirmButtonText)
            .subscribe((ok) => {
            if (ok) {
                me.deleteResource(model);
            }
        });
    }
    deleteResource(model) {
        const me = this;
        me.http.delete(me.getDeleteResourceUrl(model), me.sendModelOnDelete ? { body: model } : undefined).subscribe(() => {
            me.notifications.snackSuccess(me.getSuccessfullyDeletedItemNotificationContent(model));
            me.removeRecord(model);
        });
    }
    getEditorData(rec) {
        return {
            model: rec,
        };
    }
    updateRecord(rec) {
        const me = this;
        me.data = me.data?.map((item) => item[me.modelIdProperty] != rec[me.modelIdProperty] ? item : rec);
        me.updateView();
    }
    removeRecord(model) {
        const me = this;
        me.data = me.data?.filter((rec) => {
            return rec != model;
        });
        me.totalRecords--;
        me.updateView();
    }
    /**
     * Este metodo puede ser sobre escrito para evitar el comportamiento por defecto.
     */
    afterCreateEditorClosed(model) {
        const me = this;
        if (model) {
            //funcion creada para agregar datos a la matriz
            me.data?.push(model);
            me.updateView();
        }
    }
    /**
     * Este metodo puede ser sobre escrito para evitar el comportamiento por defecto.
     */
    afterUpdateEditorClosed(model) {
        const me = this;
        if (model) {
            // Update record
            me.updateRecord(model);
        }
    }
    /**
     * Nota: Sobrescribir este metodo para titulos personalizados.
     */
    getDeleteItemConfirmDialogTitle(model) {
        const me = this;
        if (me.confirmDeleteTitle)
            return me.confirmDeleteTitle;
        return StringUtils.compileTpl(me.confirmDeleteTitleTpl, 
        // Capitalize string
        { itemName: me.itemSingularName.charAt(0).toUpperCase() + me.itemSingularName.slice(1) });
    }
    /**
     * Nota: Sobrescribir este metodo para mensajes personalizados
     */
    getDeleteItemConfirmDialogContent(model) {
        return StringUtils.compileTpl(this.deleteItemConfirmDialogContentTpl, this.getDeleteItemConfirmDialogTplData(model));
    }
    getDeleteItemConfirmDialogTplData(model) {
        const me = this;
        let question = me.deleteItemQuestionText;
        if (!question) {
            question = StringUtils.compileTpl(me.deleteItemQuestionTextTpl, {
                itemName: me.itemSingularName,
                itemArticle: me.itemSingularArticle
            });
        }
        return {
            question,
            itemName: this.getItemIdentificationName(model),
        };
    }
    /**
     * Nota: Sobrescribir este metodo para mensajes personalizados
     */
    getSuccessfullyDeletedItemNotificationContent(model) {
        return StringUtils.compileTpl(this.successfullyDeletedItemNotificationTpl, this.getSuccessfullyDeletedItemNotificationTplData(model));
    }
    getSuccessfullyDeletedItemNotificationTplData(model) {
        return {
            itemName: this.getItemIdentificationName(model),
        };
    }
    getItemIdentificationName(model) {
        return model[this.modelNameProperty] || '';
    }
    reloadHandler() {
        this.loadData();
    }
    ngOnInit() {
        const me = this;
        me._subscribeLoadEvent();
        me.subscribeRouteParams();
        me.loadDatasets();
        me._createSelectionModel();
        if (me.autoload) {
            me.loadData();
        }
    }
    subscribeRouteParams() { }
    loadDatasets() { }
    _createSelectionModel() {
        const me = this;
        me.selection = new SelectionModel(me.selectionMultiple, []);
        me.selection.changed.subscribe((selection) => {
            me.selectionChange.emit(selection.source.selected);
        });
    }
    ngAfterViewInit() {
        const me = this;
        if (me.sort) {
            me.sort.sortChange.subscribe(() => {
                if (me.paginator) {
                    me.paginator.pageIndex = 0;
                }
                me.loadData();
            });
        }
        if (me.paginator) {
            me.paginator.page.subscribe(() => {
                me.loadData();
            });
        }
    }
    /**
     * Solo notificará los errores de servidor componentes tipo component
     */
    handleServerError(xhr) {
        const me = this;
        this.errorStatus = xhr.status;
        if (me.type == COMPONENT_TYPE.COMPONENT) {
            me.notifications.handleXhrError(xhr);
        }
    }
    //*** actualizar las celdas */
    updateView() {
        if (this.table) {
            this.table.renderRows();
        }
    }
    applyFilters(filters) {
        const me = this;
        me.filters = filters;
        me.resetPageIndex();
        me.loadData();
    }
    resetPageIndex() {
        const me = this;
        if (me.paginator)
            me.paginator.pageIndex = 0;
    }
    getFilters() {
        return this.filters;
    }
    applySearchFilter(filter) {
        const me = this;
        me.searchFilter = filter;
        if (me.paginator)
            me.paginator.pageIndex = 0;
        me.loadData();
    }
    applyLocalSearchFilter(filter) {
        const me = this;
        me.localSearchFilter = filter;
        me.filterData(filter.value);
    }
    /**
     * Determina si se debería o no mostrar el mensaje de cargando
     */
    shouldShowProgressView() {
        const me = this;
        return me._isLoadingData && !me.data;
    }
    shouldShowErrorView() {
        const me = this;
        return me._didLoadDataFailed && !me._isLoadingData;
    }
    // FIX
    shouldShowTitleBar() {
        const me = this;
        return !me._didLoadDataFailed && !me._isLoadingData;
    }
    shouldShowContent() {
        const me = this;
        return !me._didLoadDataFailed && !me._isLoadingData;
    }
    /** Whether the number of selected elements matches the total number of rows. */
    isAllSelected() {
        const numSelected = this.getSelection().length;
        const numRows = this.data?.length;
        return numSelected === numRows;
    }
    /** Selects all rows if they are not all selected; otherwise clear selection. */
    masterToggle() {
        this.isAllSelected()
            ? this.selection.clear()
            : this.data?.forEach((row) => this.selection.select(row));
    }
    ngOnDestroy() {
        if (this._loadSubcription) {
            this._loadSubcription.unsubscribe();
        }
    }
    // Updates a specific field and makes the http request if it's necessary
    updateValue(model, fieldName, newValue) {
        const me = this;
        // No requiere actualizar
        if (model[fieldName] == newValue) {
            return;
        }
        const oldValue = model[fieldName];
        model[fieldName] = newValue;
        me.http
            .put(me.getCollectionUrl() + '/' + model[me.modelIdProperty], model)
            .subscribe((_) => {
            me.afterValueUpdated(model, fieldName, newValue, oldValue);
        }, (xhr) => {
            // Reset on error
            model[fieldName] = oldValue;
            me.notifications.handleXhrError(xhr);
        });
    }
    afterValueUpdated(model, fieldName, newValue, oldValue) {
    }
    navigateToItemView(id) {
        this.router.navigate(['./', id], { relativeTo: this.route });
    }
    getBaseHref() {
        return document.baseURI;
    }
    getPageIndex() {
        return this.paginator ? this.paginator.pageIndex : this.pageIndex;
    }
    getPageSize() {
        return this.paginator ? this.paginator.pageSize : this.pageSize;
    }
    getItemNumber(index) {
        return this.getPageIndex() * this.getPageSize() + index + 1;
    }
    /**
     * Filtra por todas las columnas
     * @param text Texto buscado
     */
    filterData(text) {
        const me = this;
        text = (text || '').toString().trimStart().toLowerCase();
        me.data = me._rawTransformedData.filter((item) => {
            return Object.keys(item).some(key => {
                const value = (item[key] || '').toString().toLowerCase();
                return value.includes(text.toLowerCase());
            });
        });
    }
    getErrorStatus() {
        return this.errorStatus;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: TableViewComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: TableViewComponent, isStandalone: true, outputs: { selectionChange: "selectionChange" }, host: { listeners: { "window:keyup": "keyEvent($event)" } }, viewQueries: [{ propertyName: "table", first: true, predicate: MatTable, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "errorView", first: true, predicate: DataErrorViewComponent, descendants: true }], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: TableViewComponent, decorators: [{
            type: Directive
        }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { selectionChange: [{
                type: Output
            }], table: [{
                type: ViewChild,
                args: [MatTable]
            }], sort: [{
                type: ViewChild,
                args: [MatSort]
            }], paginator: [{
                type: ViewChild,
                args: [MatPaginator]
            }], errorView: [{
                type: ViewChild,
                args: [DataErrorViewComponent]
            }], keyEvent: [{
                type: HostListener,
                args: ['window:keyup', ['$event']]
            }] } });

/*
 * Public API Surface of ngx-core-business
 */

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

export { AppHeaderComponent, AvatarComponent, ButtonType, DataErrorViewComponent, DialogComponent, DialogService, EMAIL_PATTERN, EditionPinComponent, FiltersContainerComponent, FormBuilderHelper, FormComponent, FormDialogComponent, GridComponent, HttpActivityBarComponent, HttpActivityInterceptor, HttpActivityService, ListToolbarComponent, ModelViewComponent, NavListComponent, NgBizAppHeaderModule, NgBizAvatarModule, NgBizBreadcrumbModule, NgBizDataErrorViewModule, NgBizDialogModule, NgBizEditionPinModule, NgBizGridModule, NgBizHttpActivityBarModule, NgBizListToolbarModule, NgBizNavListModule, NgBizProcessButtonModule, NgBizProcessMaskModule, NgBizProgressViewModule, NgBizSnackBarModule, NgBizTextFilterModule, NgBizViewContentWrapperModule, NgBizViewTitleModule, NotificationsService, ProcessButtonComponent, ProcessMaskComponent, ProgressViewComponent, SnackBarComponent, TableViewComponent, TextFilterComponent, URL_PATTERN, ViewBreadcrumbComponent, ViewBreadcrumbSeparatorComponent, ViewContentWrapperComponent, ViewTitleComponent };
//# sourceMappingURL=ngx-core-business-components.mjs.map