import * as i0 from '@angular/core';
import { Inject, Component, Injectable, Pipe, NgModule } from '@angular/core';
import * as i1$1 from '@sellan/core';
import { Utility, CoreBaseDestroyComponent, CoreDialog, CoreBaseModule, CoreMatModule, CoreControlModule, CoreDialogModule, CorePipeModule, CoreNotificationModule } from '@sellan/core';
import * as i1 from '@angular/material/dialog';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import * as i2 from '@angular/forms';
import * as i3 from 'ngx-scrollbar';
import { NgScrollbarModule } from 'ngx-scrollbar';
import * as i4 from '@angular/material/tooltip';
import * as i6 from '@angular/material/progress-bar';
import { of } from 'rxjs';

class DgmViewerTableParameterDialogWindow {
    constructor(_dialogRef, data) {
        this._dialogRef = _dialogRef;
        this.data = data;
        const value = data.parameter.value;
        this.headers = this.cloneHeaders(value.headers);
        this.rows = this.cloneRows(value.rows);
    }
    get title() {
        return this.data.parameter.name;
    }
    trackByIndex(index) {
        return index;
    }
    addRow() {
        this.rows.push(this.createEmptyRow());
    }
    removeRow(index) {
        if (index < 0 || index >= this.rows.length) {
            return;
        }
        this.rows.splice(index, 1);
    }
    accept() {
        const value = {
            ...this.data.parameter.value,
            headers: this.headers,
            rows: this.rows
        };
        this._dialogRef.close(value);
    }
    createEmptyRow() {
        const columnCount = this.headers?.length || this.rows[0]?.cells?.length || 0;
        const templateRow = this.rows[0];
        return {
            cells: Array.from({ length: columnCount }, (_, index) => this.createEmptyCell(templateRow?.cells[index]))
        };
    }
    createEmptyCell(templateCell) {
        return {
            elementSettings: templateCell?.elementSettings ? { ...templateCell.elementSettings, cellFontStyle: [...(templateCell.elementSettings.cellFontStyle || [])] } : null,
            data: '',
            width: templateCell?.width,
            background: templateCell?.background
        };
    }
    cloneHeaders(headers) {
        return headers?.map(header => ({
            ...header,
            elementSettings: header.elementSettings ? { ...header.elementSettings, cellFontStyle: [...(header.elementSettings.cellFontStyle || [])] } : null
        })) ?? [];
    }
    cloneRows(rows) {
        return rows?.map(row => ({
            cells: row.cells?.map(cell => ({
                ...cell,
                data: cell.data ?? '',
                elementSettings: cell.elementSettings ? { ...cell.elementSettings, cellFontStyle: [...(cell.elementSettings.cellFontStyle || [])] } : null
            })) ?? []
        })) ?? [];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmViewerTableParameterDialogWindow, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: DgmViewerTableParameterDialogWindow, isStandalone: false, selector: "ng-component", ngImport: i0, template: "<core-dialog dialogTitle=\"{{ title }}\" width=\"900\">\n  <div body>\n    <ng-scrollbar class=\"sln-dgm-viewer-table-scroll\">\n      <div class=\"sln-dgm-viewer-table-wrap\">\n        <form #tableForm=\"ngForm\">\n          <table class=\"sln-dgm-viewer-table\">\n            <thead>\n              <tr>\n                @for (header of headers; track trackByIndex($index)) {\n                  <th [style.background]=\"header.background\">{{ header.headerText }}</th>\n                }\n                <th class=\"sln-dgm-viewer-table-actions-header\"></th>\n              </tr>\n            </thead>\n            <tbody>\n              @for (row of rows; track trackByIndex(rowIndex); let rowIndex = $index) {\n                <tr>\n                  @for (cell of row.cells; track trackByIndex(cellIndex); let cellIndex = $index) {\n                    <td [style.background]=\"cell.background\">\n                      <core-field-string [(ngModel)]=\"cell.data\" name=\"cell_{{rowIndex}}_{{cellIndex}}\" fieldName=\"cell_{{rowIndex}}_{{cellIndex}}\"\n                        class=\"sln-max-width\" [settings]=\"{ rightHintHide: true }\"></core-field-string>\n                    </td>\n                  }\n                  <td class=\"sln-dgm-viewer-table-actions\">\n                    <button type=\"button\" class=\"sln-bg-none sln-btn-full-s\" matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443\" (click)=\"removeRow(rowIndex)\">\n                      <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n                    </button>\n                  </td>\n                </tr>\n              }\n            </tbody>\n          </table>\n        </form>\n      </div>\n    </ng-scrollbar>\n  </div>\n  <div footer class=\"sln-dgm-viewer-table-footer\">\n    <button type=\"button\" class=\"btn-default\" (click)=\"addRow()\">\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443</button>\n    <button class=\"btn-primary\" type=\"button\" (click)=\"accept()\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n  </div>\n</core-dialog>\n", styles: [".sln-dgm-viewer-table-scroll{height:55vh;max-height:55vh}.sln-dgm-viewer-table-wrap{width:100%;max-width:100%;min-width:0}.sln-dgm-viewer-table{width:100%;border-collapse:collapse;table-layout:fixed}.sln-dgm-viewer-table th,.sln-dgm-viewer-table td{box-sizing:border-box;border:1px solid #e0e0e0;padding:8px 10px;text-align:left;vertical-align:top;white-space:normal;overflow-wrap:break-word;word-break:break-word}.sln-dgm-viewer-table th{font-weight:600;line-height:1.3;position:sticky;top:0;z-index:1;background-color:#fff}.sln-dgm-viewer-table tbody td{vertical-align:middle}.sln-dgm-viewer-table td core-field-string{display:block;width:100%;min-width:0}.sln-dgm-viewer-table-actions-header{width:48px;min-width:48px}.sln-dgm-viewer-table-actions{text-align:center}.sln-dgm-viewer-table-actions button{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}.sln-dgm-viewer-table-footer{display:flex;justify-content:space-between;align-items:center;width:100%}\n"], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i1$1.CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: i1$1.CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmViewerTableParameterDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"{{ title }}\" width=\"900\">\n  <div body>\n    <ng-scrollbar class=\"sln-dgm-viewer-table-scroll\">\n      <div class=\"sln-dgm-viewer-table-wrap\">\n        <form #tableForm=\"ngForm\">\n          <table class=\"sln-dgm-viewer-table\">\n            <thead>\n              <tr>\n                @for (header of headers; track trackByIndex($index)) {\n                  <th [style.background]=\"header.background\">{{ header.headerText }}</th>\n                }\n                <th class=\"sln-dgm-viewer-table-actions-header\"></th>\n              </tr>\n            </thead>\n            <tbody>\n              @for (row of rows; track trackByIndex(rowIndex); let rowIndex = $index) {\n                <tr>\n                  @for (cell of row.cells; track trackByIndex(cellIndex); let cellIndex = $index) {\n                    <td [style.background]=\"cell.background\">\n                      <core-field-string [(ngModel)]=\"cell.data\" name=\"cell_{{rowIndex}}_{{cellIndex}}\" fieldName=\"cell_{{rowIndex}}_{{cellIndex}}\"\n                        class=\"sln-max-width\" [settings]=\"{ rightHintHide: true }\"></core-field-string>\n                    </td>\n                  }\n                  <td class=\"sln-dgm-viewer-table-actions\">\n                    <button type=\"button\" class=\"sln-bg-none sln-btn-full-s\" matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443\" (click)=\"removeRow(rowIndex)\">\n                      <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n                    </button>\n                  </td>\n                </tr>\n              }\n            </tbody>\n          </table>\n        </form>\n      </div>\n    </ng-scrollbar>\n  </div>\n  <div footer class=\"sln-dgm-viewer-table-footer\">\n    <button type=\"button\" class=\"btn-default\" (click)=\"addRow()\">\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443</button>\n    <button class=\"btn-primary\" type=\"button\" (click)=\"accept()\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n  </div>\n</core-dialog>\n", styles: [".sln-dgm-viewer-table-scroll{height:55vh;max-height:55vh}.sln-dgm-viewer-table-wrap{width:100%;max-width:100%;min-width:0}.sln-dgm-viewer-table{width:100%;border-collapse:collapse;table-layout:fixed}.sln-dgm-viewer-table th,.sln-dgm-viewer-table td{box-sizing:border-box;border:1px solid #e0e0e0;padding:8px 10px;text-align:left;vertical-align:top;white-space:normal;overflow-wrap:break-word;word-break:break-word}.sln-dgm-viewer-table th{font-weight:600;line-height:1.3;position:sticky;top:0;z-index:1;background-color:#fff}.sln-dgm-viewer-table tbody td{vertical-align:middle}.sln-dgm-viewer-table td core-field-string{display:block;width:100%;min-width:0}.sln-dgm-viewer-table-actions-header{width:48px;min-width:48px}.sln-dgm-viewer-table-actions{text-align:center}.sln-dgm-viewer-table-actions button{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}.sln-dgm-viewer-table-footer{display:flex;justify-content:space-between;align-items:center;width:100%}\n"] }]
        }], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class GenerationService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    generateBin(context) {
        const url = this._startUp.apiRoot('generate/binary', 'dgm');
        return this._ajaxM.post({ url: url, data: context });
    }
    generateLink(context) {
        const url = this._startUp.apiRoot('generate/link', 'dgm');
        return this._ajaxM.post({ url: url, data: context });
    }
    generateView(context) {
        const url = this._startUp.apiRoot('generate/view', 'dgm');
        return this._ajaxM.post({ url: url, data: context });
    }
    refreshView(context, result) {
        const url = this._startUp.apiRoot('generate/view/refresh', 'dgm');
        return this._ajaxM.post({ url: url, data: { context: context, parameters: result.parameters } });
    }
    saveView(context, result) {
        const url = this._startUp.apiRoot('generate/view/save', 'dgm');
        return this._ajaxM.post({ url: url, data: { context: context, parameters: result.parameters } });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GenerationService, deps: [{ token: i1$1.Startup }, { token: i1$1.AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GenerationService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GenerationService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1$1.Startup }, { type: i1$1.AjaxService }] });

class ParameterFilterPipe {
    constructor() {
        this._filtered = false;
    }
    static { this.EDITABLE_TYPES = ['TextBlock', 'Table']; }
    transform(items, filter) {
        if (Utility.isEmpty(filter) && this._filtered === true) {
            this._filtered = false;
            return [];
        }
        if (!items || !filter) {
            return items?.filter(item => ParameterFilterPipe.EDITABLE_TYPES.includes(item.value.viewerParameterType));
        }
        this._filtered = true;
        const f = filter.toLowerCase();
        return items.filter(item => ParameterFilterPipe.EDITABLE_TYPES.includes(item.value.viewerParameterType))
            .filter(item => item.name.toLowerCase().includes(f) === true || item.description.toLowerCase().includes(f) === true || item.key.toLowerCase().includes(f) === true);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ParameterFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: ParameterFilterPipe, isStandalone: false, name: "parameterFilter", pure: false }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ParameterFilterPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'parameterFilter',
                    pure: false,
                    standalone: false
                }]
        }] });

class DgmViewerDialogWindow extends CoreBaseDestroyComponent {
    get editableParams() {
        return this.result?.parameters?.filter(x => x.isEditable === true);
    }
    constructor(data, _dialogRef, _service, _popup, _ajaxM) {
        super();
        this._dialogRef = _dialogRef;
        this._service = _service;
        this._popup = _popup;
        this._ajaxM = _ajaxM;
        this.contentLoaded = false;
        this.context = data;
    }
    ngOnInit() {
        this._service
            .generateView(this.context)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.result = entity;
                this.fillURL(this.result.document.fileUrl);
            }
        }));
    }
    trackByIndex(index, obj) {
        return index;
    }
    trimPlaceholder(text) {
        return text.length > 20 ? text.substring(0, 20) + '...' : text;
    }
    openTableParameter(item) {
        CoreDialog.window(DgmViewerTableParameterDialogWindow, { parameter: item }, (result) => {
            if (result) {
                item.value = result;
            }
        });
    }
    getURL() {
        return this.url;
    }
    fillURL(fileUrl) {
        this._ajaxM
            .get({ url: fileUrl, httpOptions: { responseType: 'blob' } })
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => {
            const file = new Blob([response], { type: 'application/pdf' });
            this.url = URL.createObjectURL(file);
            this.contentLoaded = true;
        });
    }
    attach() {
        this._service
            .saveView(this.context, this.result)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this._dialogRef.close(entity);
            }
        }));
    }
    refresh() {
        this._service
            .refreshView(this.context, this.result)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.result = entity;
                this.fillURL(this.result.document.fileUrl);
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmViewerDialogWindow, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: GenerationService }, { token: i1$1.PopupResults }, { token: i1$1.AjaxService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: DgmViewerDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u0424\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\" fullScreen=\"true\" class=\"sln-dgm-viewer-modal\">\n  <div body>\n    <div class=\"row\">\n      @if (editableParams?.length > 0) {\n        <div class=\"col-md-3 sln-dgm-viewer-fields\">\n          <form #newForm=\"ngForm\" novalidate>\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"searchKey\" name=\"searchKey\" fieldName=\"searchKey\" placeholder=\"\u041F\u043E\u0438\u0441\u043A \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\"\n              class=\"sln-max-width\" [settings]=\"{ rightHintHide: true }\"></core-field-string>\n            </div>\n            <ng-scrollbar style=\"height:68vh;\">\n              @for (item of editableParams | parameterFilter: searchKey; track trackByIndex(i, item); let i = $index) {\n                <div class=\"form-group\">\n                  <div>\n                    @switch (item.value.viewerParameterType) {\n                      @case ('TextBlock') {\n                        <div style=\"display: flex;\">\n                          <core-field-string [(ngModel)]=\"item.value.text\" name=\"value_{{i}}_text\" fieldName=\"value_{{i}}_text\" [placeholder]=\"trimPlaceholder(item.name)\"\n                            class=\"sln-max-width\" [settings]=\"{ useInformer: item.name.length > 20, informerText: item.name, rightHintHide: true }\"\n                          labelClass=\"{{ item.isFail === true ? 'sln-dgm-viewer-label-error':'' }}\" cmpClass=\"{{ item.isFail === true ? 'sln-dgm-viewer-field-error':'' }}\"></core-field-string>\n                        </div>\n                      }\n                      @case ('Table') {\n                        <button type=\"button\" class=\"btn-default sln-max-width sln-dgm-viewer-table-button\"\n                          [class.sln-dgm-viewer-table-button-error]=\"item.isFail === true\"\n                          [matTooltip]=\"item.name.length > 20 ? item.name : null\"\n                          (click)=\"openTableParameter(item)\">\n                          {{ trimPlaceholder(item.name) }}\n                        </button>\n                      }\n                    }\n                  </div>\n                </div>\n              }\n            </ng-scrollbar>\n          </form>\n        </div>\n      }\n      <div class=\"col-md-{{ editableParams?.length > 0 ? '9' : '12' }} sln-dgm-viewer\">\n        <div class=\"sln-dgm-viewer-preview\">\n          @if (contentLoaded === false) {\n            <div class=\"sln-dgm-viwer-loading\">\n              <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n            </div>\n          }\n          @if (contentLoaded === true) {\n            <iframe [src]='getURL() | safe' type=\"application/pdf\" frameBorder=\"0\" scrolling=\"auto\"></iframe>\n          }\n        </div>\n      </div>\n    </div>\n  </div>\n  <div footer>\n    <button class=\"btn-primary\" (click)=\"attach()\">\u041F\u0440\u0438\u043A\u0440\u0435\u043F\u0438\u0442\u044C</button>\n    <button class=\"btn-default sln-dgm-viwer-button\" (click)=\"refresh()\">\u041F\u0435\u0440\u0435\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C</button>\n  </div>\n</core-dialog>\n\n", styles: [".sln-field-filter-button{padding:0;min-width:0px;height:var(--INPUT-HEIGHT);width:20px;margin-top:5px;margin-left:3px}.form-group,.sln-field-layout{padding-right:10px}.sln-dgm-viwer-loading{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.sln-dgm-viwer-loading mat-progress-bar{width:50%;--mdc-linear-progress-track-height: 8px;--mdc-linear-progress-active-indicator-height: 8px;--mdc-linear-progress-track-shape: 4px}.sln-dgm-viwer-button{margin-left:5px}.sln-dgm-viewer-fields{padding:0}.sln-dgm-viewer-label-error{color:var(--DANGER)!important}.sln-dgm-viewer-field-error input{border-color:var(--DANGER)!important}.sln-dgm-viewer-table-button{width:100%;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sln-dgm-viewer-table-button-error{border-color:var(--DANGER)!important;color:var(--DANGER)!important}.sln-dgm-viewer{padding-right:0}.sln-dgm-viewer-preview{width:100%;height:75vh;background:var(--LIGHT-GRAY)}.sln-dgm-viewer iframe{width:100%;height:100%;display:block}\n"], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "component", type: i6.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i1$1.CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: i1$1.CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "pipe", type: i1$1.SafePipe, name: "safe" }, { kind: "pipe", type: ParameterFilterPipe, name: "parameterFilter" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmViewerDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0424\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\" fullScreen=\"true\" class=\"sln-dgm-viewer-modal\">\n  <div body>\n    <div class=\"row\">\n      @if (editableParams?.length > 0) {\n        <div class=\"col-md-3 sln-dgm-viewer-fields\">\n          <form #newForm=\"ngForm\" novalidate>\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"searchKey\" name=\"searchKey\" fieldName=\"searchKey\" placeholder=\"\u041F\u043E\u0438\u0441\u043A \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\"\n              class=\"sln-max-width\" [settings]=\"{ rightHintHide: true }\"></core-field-string>\n            </div>\n            <ng-scrollbar style=\"height:68vh;\">\n              @for (item of editableParams | parameterFilter: searchKey; track trackByIndex(i, item); let i = $index) {\n                <div class=\"form-group\">\n                  <div>\n                    @switch (item.value.viewerParameterType) {\n                      @case ('TextBlock') {\n                        <div style=\"display: flex;\">\n                          <core-field-string [(ngModel)]=\"item.value.text\" name=\"value_{{i}}_text\" fieldName=\"value_{{i}}_text\" [placeholder]=\"trimPlaceholder(item.name)\"\n                            class=\"sln-max-width\" [settings]=\"{ useInformer: item.name.length > 20, informerText: item.name, rightHintHide: true }\"\n                          labelClass=\"{{ item.isFail === true ? 'sln-dgm-viewer-label-error':'' }}\" cmpClass=\"{{ item.isFail === true ? 'sln-dgm-viewer-field-error':'' }}\"></core-field-string>\n                        </div>\n                      }\n                      @case ('Table') {\n                        <button type=\"button\" class=\"btn-default sln-max-width sln-dgm-viewer-table-button\"\n                          [class.sln-dgm-viewer-table-button-error]=\"item.isFail === true\"\n                          [matTooltip]=\"item.name.length > 20 ? item.name : null\"\n                          (click)=\"openTableParameter(item)\">\n                          {{ trimPlaceholder(item.name) }}\n                        </button>\n                      }\n                    }\n                  </div>\n                </div>\n              }\n            </ng-scrollbar>\n          </form>\n        </div>\n      }\n      <div class=\"col-md-{{ editableParams?.length > 0 ? '9' : '12' }} sln-dgm-viewer\">\n        <div class=\"sln-dgm-viewer-preview\">\n          @if (contentLoaded === false) {\n            <div class=\"sln-dgm-viwer-loading\">\n              <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n            </div>\n          }\n          @if (contentLoaded === true) {\n            <iframe [src]='getURL() | safe' type=\"application/pdf\" frameBorder=\"0\" scrolling=\"auto\"></iframe>\n          }\n        </div>\n      </div>\n    </div>\n  </div>\n  <div footer>\n    <button class=\"btn-primary\" (click)=\"attach()\">\u041F\u0440\u0438\u043A\u0440\u0435\u043F\u0438\u0442\u044C</button>\n    <button class=\"btn-default sln-dgm-viwer-button\" (click)=\"refresh()\">\u041F\u0435\u0440\u0435\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C</button>\n  </div>\n</core-dialog>\n\n", styles: [".sln-field-filter-button{padding:0;min-width:0px;height:var(--INPUT-HEIGHT);width:20px;margin-top:5px;margin-left:3px}.form-group,.sln-field-layout{padding-right:10px}.sln-dgm-viwer-loading{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.sln-dgm-viwer-loading mat-progress-bar{width:50%;--mdc-linear-progress-track-height: 8px;--mdc-linear-progress-active-indicator-height: 8px;--mdc-linear-progress-track-shape: 4px}.sln-dgm-viwer-button{margin-left:5px}.sln-dgm-viewer-fields{padding:0}.sln-dgm-viewer-label-error{color:var(--DANGER)!important}.sln-dgm-viewer-field-error input{border-color:var(--DANGER)!important}.sln-dgm-viewer-table-button{width:100%;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sln-dgm-viewer-table-button-error{border-color:var(--DANGER)!important;color:var(--DANGER)!important}.sln-dgm-viewer{padding-right:0}.sln-dgm-viewer-preview{width:100%;height:75vh;background:var(--LIGHT-GRAY)}.sln-dgm-viewer iframe{width:100%;height:100%;display:block}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: i1.MatDialogRef }, { type: GenerationService }, { type: i1$1.PopupResults }, { type: i1$1.AjaxService }] });

// тип источника данных
var EntityTypeEnum;
(function (EntityTypeEnum) {
    // Общий параметр, доступный для любого источника данных
    EntityTypeEnum[EntityTypeEnum["Common"] = 0] = "Common";
    // Заявка
    EntityTypeEnum[EntityTypeEnum["Request"] = 1] = "Request";
    // Распределение
    EntityTypeEnum[EntityTypeEnum["Distribution"] = 2] = "Distribution";
    // Организация
    EntityTypeEnum[EntityTypeEnum["Organization"] = 3] = "Organization";
    // Опросный лист клиента
    EntityTypeEnum[EntityTypeEnum["Profile"] = 4] = "Profile";
    // Финансовая отчетность
    EntityTypeEnum[EntityTypeEnum["Financial"] = 5] = "Financial";
    // Отчеты проверки документов
    EntityTypeEnum[EntityTypeEnum["Mra"] = 6] = "Mra";
    // Отчеты проверки документов
    EntityTypeEnum[EntityTypeEnum["RefreshRequest"] = 7] = "RefreshRequest";
    // МИДЛ: Карточка контракта
    EntityTypeEnum[EntityTypeEnum["MIDLContract"] = 100] = "MIDLContract";
    // МИДЛ: Карточка реестра
    EntityTypeEnum[EntityTypeEnum["MIDLRegistry"] = 101] = "MIDLRegistry";
})(EntityTypeEnum || (EntityTypeEnum = {}));
class IContextItem {
}

var ViewerParameterTypeEnum;
(function (ViewerParameterTypeEnum) {
    ViewerParameterTypeEnum["TextBlock"] = "TextBlock";
    ViewerParameterTypeEnum["CheckboxBlock"] = "CheckboxBlock";
    ViewerParameterTypeEnum["BoolBlock"] = "BoolBlock";
    ViewerParameterTypeEnum["Table"] = "Table";
    ViewerParameterTypeEnum["Link"] = "Link";
})(ViewerParameterTypeEnum || (ViewerParameterTypeEnum = {}));

class DgmComboboxUriDescriptionService {
    constructor(_startUp) {
        this._startUp = _startUp;
    }
    getUri(code) {
        const urls = [
            { code: 'DgmObjectTypes', url: () => this._startUp.apiRoot('generate/combobox/object-type', 'dgm') },
            { code: 'BpmFields', url: () => this._startUp.apiRoot('step-fields/combobox/process', 'bpm') }
        ];
        const url = urls.filter(x => x.code === code)[0]?.url();
        return url;
    }
    getLocalSourse(code, filters) {
        switch (code) {
            default: {
                return of({ isSuccess: true, message: '', entity: [] });
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmComboboxUriDescriptionService, deps: [{ token: i1$1.Startup }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmComboboxUriDescriptionService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmComboboxUriDescriptionService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1$1.Startup }] });

class ParameterInfoService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    getUsageInfo(key) {
        let url = this._startUp.apiRoot('parameters/usage/' + key, 'dgm');
        return this._ajaxM.get({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ParameterInfoService, deps: [{ token: i1$1.Startup }, { token: i1$1.AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ParameterInfoService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ParameterInfoService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1$1.Startup }, { type: i1$1.AjaxService }] });

class DgmModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: DgmModule, declarations: [
            // directive
            // pages & components
            // dialogs
            DgmViewerDialogWindow,
            DgmViewerTableParameterDialogWindow,
            // pipes
            ParameterFilterPipe], imports: [CoreBaseModule,
            CoreMatModule,
            CoreControlModule,
            CoreDialogModule,
            CorePipeModule,
            CoreNotificationModule,
            NgScrollbarModule], exports: [
            // directive
            // pages & components
            // dialogs
            DgmViewerDialogWindow
            // pipes
        ] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmModule, providers: [
            // business services
            GenerationService,
            ParameterInfoService,
        ], imports: [CoreBaseModule,
            CoreMatModule,
            CoreControlModule,
            CoreDialogModule,
            CorePipeModule,
            CoreNotificationModule,
            NgScrollbarModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DgmModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreControlModule,
                        CoreDialogModule,
                        CorePipeModule,
                        CoreNotificationModule,
                        NgScrollbarModule
                    ],
                    declarations: [
                        // directive
                        // pages & components
                        // dialogs
                        DgmViewerDialogWindow,
                        DgmViewerTableParameterDialogWindow,
                        // pipes
                        ParameterFilterPipe
                    ],
                    providers: [
                        // business services
                        GenerationService,
                        ParameterInfoService,
                    ],
                    exports: [
                        // directive
                        // pages & components
                        // dialogs
                        DgmViewerDialogWindow
                        // pipes
                    ]
                }]
        }] });

/*
 * Public API Surface of sellan-dgm
 */
//components

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

export { DgmComboboxUriDescriptionService, DgmModule, DgmViewerDialogWindow, EntityTypeEnum, GenerationService, IContextItem, ParameterInfoService, ViewerParameterTypeEnum };
//# sourceMappingURL=sellan-dgm.mjs.map
