import * as i0 from '@angular/core';
import { Injectable, EventEmitter, isDevMode, HostListener, Output, HostBinding, Input, ViewChild, Optional, Inject, ChangeDetectionStrategy, Component, Directive, NgModule, InjectionToken, inject, LOCALE_ID, SkipSelf, DOCUMENT, ViewEncapsulation, ContentChild, Attribute, forwardRef, TemplateRef, Pipe, ElementRef, Injector, createComponent, PLATFORM_ID, ViewContainerRef, ChangeDetectorRef, NgZone, ViewChildren } from '@angular/core';
import * as i1 from '@angular/platform-browser';
import { HAMMER_LOADER } from '@angular/platform-browser';
import { merge, fromEvent, takeUntil, first, Subject, debounceTime, take, BehaviorSubject, Subscription, filter, of, ReplaySubject, tap, catchError, map, throwError, finalize, distinctUntilChanged, debounce, timer, from, Observable } from 'rxjs';
import * as i4$1 from '@angular/forms';
import { NgForm, ControlContainer, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators, UntypedFormControl } from '@angular/forms';
import * as i11 from '@angular/cdk/table';
import { CdkTableModule } from '@angular/cdk/table';
import * as i1$1 from '@angular/common';
import { CommonModule, DatePipe, isPlatformBrowser } from '@angular/common';
import * as i1$5 from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi, HttpParams, HttpHeaders, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
import * as i1$7 from '@angular/router';
import { RouterModule, DefaultUrlSerializer, Router, NavigationStart, NavigationEnd } from '@angular/router';
import * as i3$4 from 'ngx-scrollbar';
import { NgScrollbarModule } from 'ngx-scrollbar';
import * as i4$5 from 'ngx-scrollbar/reached-event';
import { NgScrollReached } from 'ngx-scrollbar/reached-event';
import * as i2$3 from '@angular/material/autocomplete';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatBadgeModule } from '@angular/material/badge';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import * as i2 from '@angular/material/button';
import { MatButtonModule, MAT_FAB_DEFAULT_OPTIONS } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import * as i2$5 from '@angular/material/card';
import { MatCardModule } from '@angular/material/card';
import * as i3$2 from '@angular/material/checkbox';
import { MatCheckboxModule } from '@angular/material/checkbox';
import * as i4$4 from '@angular/material/chips';
import { MatChipsModule } from '@angular/material/chips';
import * as i1$2 from '@angular/material/core';
import { MatRippleModule, MatNativeDateModule, NativeDateAdapter, DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
import * as i1$6 from '@angular/material/datepicker';
import { MatDatepickerModule, MatDatepickerIntl } from '@angular/material/datepicker';
import * as i1$8 from '@angular/material/dialog';
import { MatDialogModule, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
import * as i2$1 from '@angular/material/divider';
import { MatDividerModule } from '@angular/material/divider';
import * as i3 from '@angular/material/expansion';
import { MatExpansionModule, MatAccordion } from '@angular/material/expansion';
import { MatGridListModule } from '@angular/material/grid-list';
import * as i5$1 from '@angular/material/icon';
import { MatIconModule } from '@angular/material/icon';
import * as i1$3 from '@angular/material/input';
import { MAT_INPUT_VALUE_ACCESSOR, MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import * as i4$6 from '@angular/material/menu';
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
import * as i5$2 from '@angular/material/paginator';
import { MatPaginatorModule, MatPaginator } from '@angular/material/paginator';
import * as i6$1 from '@angular/material/progress-bar';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import * as i3$3 from '@angular/material/radio';
import { MatRadioModule } from '@angular/material/radio';
import * as i4$3 from '@angular/material/select';
import { MatSelectModule, MatSelect, MAT_SELECT_SCROLL_STRATEGY } from '@angular/material/select';
import { MatSidenavModule } from '@angular/material/sidenav';
import * as i4$2 from '@angular/material/slide-toggle';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatSliderModule } from '@angular/material/slider';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatSortModule, MatSort } from '@angular/material/sort';
import { MatStepperModule } from '@angular/material/stepper';
import * as i7 from '@angular/material/table';
import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar';
import * as i3$1 from '@angular/material/tooltip';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTreeModule } from '@angular/material/tree';
import * as i1$4 from '@angular/cdk/overlay';
import { Overlay, FlexibleConnectedPositionStrategy, OverlayConfig, OverlayModule, ConnectionPositionPair } from '@angular/cdk/overlay';
import * as i4 from '@angular/cdk/portal';
import { ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
import { CdkScrollableModule } from '@angular/cdk/scrolling';
import * as i5 from '@angular/cdk/a11y';
import { A11yModule } from '@angular/cdk/a11y';
import * as i2$2 from '@angular/material/form-field';
import { MAT_FORM_FIELD, MatFormFieldModule } from '@angular/material/form-field';
import { coerceNumberProperty, coerceBooleanProperty } from '@angular/cdk/coercion';
import { PlatformModule, _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
import { DOWN_ARROW, UP_ARROW, PAGE_UP, PAGE_DOWN, hasModifierKey, ESCAPE } from '@angular/cdk/keycodes';
import * as i6 from 'ngx-mask';
import { NgxMaskDirective, NgxMaskPipe, provideNgxMask } from 'ngx-mask';
import * as i2$4 from '@angular/cdk/drag-drop';
import { DragDropModule, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop';
import { loadRemoteModule } from '@angular-architects/native-federation';
import { SelectionModel } from '@angular/cdk/collections';
import * as i2$6 from '@angular/cdk/text-field';
import { take as take$1, mergeMap, shareReplay, finalize as finalize$1 } from 'rxjs/operators';
import { CryptoModule } from '@sellan/crypto';

class CropperSettings {
    constructor() {
        // From options
        this.format = 'png';
        this.output = 'blob';
        this.maintainAspectRatio = true;
        this.transform = {};
        this.aspectRatio = 1;
        this.resetCropOnAspectRatioChange = true;
        this.resizeToWidth = 0;
        this.resizeToHeight = 0;
        this.cropperMinWidth = 0;
        this.cropperMinHeight = 0;
        this.cropperMaxHeight = 0;
        this.cropperMaxWidth = 0;
        this.cropperStaticWidth = 0;
        this.cropperStaticHeight = 0;
        this.canvasRotation = 0;
        this.initialStepSize = 3;
        this.roundCropper = false;
        this.onlyScaleDown = false;
        this.imageQuality = 92;
        this.autoCrop = true;
        this.backgroundColor = null;
        this.containWithinAspectRatio = false;
        this.hideResizeSquares = false;
        this.alignImage = 'center';
        this.cropperFrameAriaLabel = 'Crop photo';
        // Internal
        this.cropperScaledMinWidth = 20;
        this.cropperScaledMinHeight = 20;
        this.cropperScaledMaxWidth = 20;
        this.cropperScaledMaxHeight = 20;
        this.stepSize = this.initialStepSize;
    }
    setOptions(options) {
        Object.keys(options)
            .filter((k) => k in this)
            .forEach((k) => this[k] = options[k]);
        this.validateOptions();
    }
    setOptionsFromChanges(changes) {
        Object.keys(changes)
            .filter((k) => k in this)
            .forEach((k) => this[k] = changes[k].currentValue);
        this.validateOptions();
    }
    validateOptions() {
        if (this.maintainAspectRatio && !this.aspectRatio) {
            throw new Error('`aspectRatio` should > 0 when `maintainAspectRatio` is enabled');
        }
    }
}

var MoveTypes;
(function (MoveTypes) {
    MoveTypes["Drag"] = "drag";
    MoveTypes["Move"] = "move";
    MoveTypes["Resize"] = "resize";
    MoveTypes["Pinch"] = "pinch";
})(MoveTypes || (MoveTypes = {}));

/*
 * Hermite resize - fast image resize/resample using Hermite filter.
 * https://github.com/viliusle/Hermite-resize
 */
function resizeCanvas(canvas, width, height) {
    const width_source = canvas.width;
    const height_source = canvas.height;
    width = Math.round(width);
    height = Math.round(height);
    const ratio_w = width_source / width;
    const ratio_h = height_source / height;
    const ratio_w_half = Math.ceil(ratio_w / 2);
    const ratio_h_half = Math.ceil(ratio_h / 2);
    const ctx = canvas.getContext('2d');
    if (ctx) {
        const img = ctx.getImageData(0, 0, width_source, height_source);
        const img2 = ctx.createImageData(width, height);
        const data = img.data;
        const data2 = img2.data;
        for (let j = 0; j < height; j++) {
            for (let i = 0; i < width; i++) {
                const x2 = (i + j * width) * 4;
                const center_y = j * ratio_h;
                let weight = 0;
                let weights = 0;
                let weights_alpha = 0;
                let gx_r = 0;
                let gx_g = 0;
                let gx_b = 0;
                let gx_a = 0;
                const xx_start = Math.floor(i * ratio_w);
                const yy_start = Math.floor(j * ratio_h);
                let xx_stop = Math.ceil((i + 1) * ratio_w);
                let yy_stop = Math.ceil((j + 1) * ratio_h);
                xx_stop = Math.min(xx_stop, width_source);
                yy_stop = Math.min(yy_stop, height_source);
                for (let yy = yy_start; yy < yy_stop; yy++) {
                    const dy = Math.abs(center_y - yy) / ratio_h_half;
                    const center_x = i * ratio_w;
                    const w0 = dy * dy; //pre-calc part of w
                    for (let xx = xx_start; xx < xx_stop; xx++) {
                        const dx = Math.abs(center_x - xx) / ratio_w_half;
                        const w = Math.sqrt(w0 + dx * dx);
                        if (w >= 1) {
                            //pixel too far
                            continue;
                        }
                        //hermite filter
                        weight = 2 * w * w * w - 3 * w * w + 1;
                        const pos_x = 4 * (xx + yy * width_source);
                        //alpha
                        gx_a += weight * data[pos_x + 3];
                        weights_alpha += weight;
                        //colors
                        if (data[pos_x + 3] < 255)
                            weight = weight * data[pos_x + 3] / 250;
                        gx_r += weight * data[pos_x];
                        gx_g += weight * data[pos_x + 1];
                        gx_b += weight * data[pos_x + 2];
                        weights += weight;
                    }
                }
                data2[x2] = gx_r / weights;
                data2[x2 + 1] = gx_g / weights;
                data2[x2 + 2] = gx_b / weights;
                data2[x2 + 3] = gx_a / weights_alpha;
            }
        }
        canvas.width = width;
        canvas.height = height;
        //draw
        ctx.putImageData(img2, 0, 0);
    }
}

function percentage(percent, totalValue) {
    return (percent / 100) * totalValue;
}

class CropService {
    crop(loadedImage, cropper, settings, output, maxSize) {
        const imagePosition = this.getImagePosition(loadedImage, cropper, settings, maxSize);
        const width = imagePosition.x2 - imagePosition.x1;
        const height = imagePosition.y2 - imagePosition.y1;
        const cropCanvas = document.createElement('canvas');
        cropCanvas.width = width;
        cropCanvas.height = height;
        const ctx = cropCanvas.getContext('2d');
        if (!ctx) {
            return null;
        }
        if (settings.backgroundColor != null) {
            ctx.fillStyle = settings.backgroundColor;
            ctx.fillRect(0, 0, width, height);
        }
        const scaleX = (settings.transform.scale || 1) * (settings.transform.flipH ? -1 : 1);
        const scaleY = (settings.transform.scale || 1) * (settings.transform.flipV ? -1 : 1);
        const { translateH, translateV } = this.getCanvasTranslate(loadedImage, settings, maxSize);
        const transformedImage = loadedImage.transformed;
        ctx.setTransform(scaleX, 0, 0, scaleY, transformedImage.size.width / 2 + translateH, transformedImage.size.height / 2 + translateV);
        ctx.translate(-imagePosition.x1 / scaleX, -imagePosition.y1 / scaleY);
        ctx.rotate((settings.transform.rotate || 0) * Math.PI / 180);
        ctx.drawImage(transformedImage.image, -transformedImage.size.width / 2, -transformedImage.size.height / 2);
        const result = {
            width, height,
            imagePosition,
            cropperPosition: { ...cropper }
        };
        if (settings.containWithinAspectRatio) {
            result.offsetImagePosition = this.getOffsetImagePosition(loadedImage, cropper, settings, maxSize);
        }
        const resizeRatio = this.getResizeRatio(width, height, settings);
        if (resizeRatio !== 1) {
            result.width = Math.round(width * resizeRatio);
            result.height = settings.maintainAspectRatio
                ? Math.round(result.width / settings.aspectRatio)
                : Math.round(height * resizeRatio);
            resizeCanvas(cropCanvas, result.width, result.height);
        }
        if (output === 'blob') {
            return this.cropToBlob(result, cropCanvas, settings);
        }
        else {
            result.base64 = cropCanvas.toDataURL('image/' + settings.format, this.getQuality(settings));
            return result;
        }
    }
    async cropToBlob(output, cropCanvas, settings) {
        output.blob = await new Promise(resolve => cropCanvas.toBlob(resolve, 'image/' + settings.format, this.getQuality(settings)));
        if (output.blob) {
            output.objectUrl = URL.createObjectURL(output.blob);
        }
        return output;
    }
    getCanvasTranslate(loadedImage, settings, maxSize) {
        if (settings.transform.translateUnit === 'px') {
            const ratio = this.getRatio(loadedImage, maxSize);
            return {
                translateH: (settings.transform.translateH || 0) * ratio,
                translateV: (settings.transform.translateV || 0) * ratio
            };
        }
        else {
            return {
                translateH: settings.transform.translateH ? percentage(settings.transform.translateH, loadedImage.transformed.size.width) : 0,
                translateV: settings.transform.translateV ? percentage(settings.transform.translateV, loadedImage.transformed.size.height) : 0
            };
        }
    }
    getRatio(loadedImage, maxSize) {
        return loadedImage.transformed.size.width / maxSize.width;
    }
    getImagePosition(loadedImage, cropper, settings, maxSize) {
        const ratio = this.getRatio(loadedImage, maxSize);
        const out = {
            x1: Math.round(cropper.x1 * ratio),
            y1: Math.round(cropper.y1 * ratio),
            x2: Math.round(cropper.x2 * ratio),
            y2: Math.round(cropper.y2 * ratio)
        };
        if (!settings.containWithinAspectRatio) {
            out.x1 = Math.max(out.x1, 0);
            out.y1 = Math.max(out.y1, 0);
            out.x2 = Math.min(out.x2, loadedImage.transformed.size.width);
            out.y2 = Math.min(out.y2, loadedImage.transformed.size.height);
        }
        return out;
    }
    getOffsetImagePosition(loadedImage, cropper, settings, maxSize) {
        const canvasRotation = settings.canvasRotation + loadedImage.exifTransform.rotate;
        const ratio = this.getRatio(loadedImage, maxSize);
        let offsetX;
        let offsetY;
        if (canvasRotation % 2) {
            offsetX = (loadedImage.transformed.size.width - loadedImage.original.size.height) / 2;
            offsetY = (loadedImage.transformed.size.height - loadedImage.original.size.width) / 2;
        }
        else {
            offsetX = (loadedImage.transformed.size.width - loadedImage.original.size.width) / 2;
            offsetY = (loadedImage.transformed.size.height - loadedImage.original.size.height) / 2;
        }
        const out = {
            x1: Math.round(cropper.x1 * ratio) - offsetX,
            y1: Math.round(cropper.y1 * ratio) - offsetY,
            x2: Math.round(cropper.x2 * ratio) - offsetX,
            y2: Math.round(cropper.y2 * ratio) - offsetY
        };
        if (!settings.containWithinAspectRatio) {
            out.x1 = Math.max(out.x1, 0);
            out.y1 = Math.max(out.y1, 0);
            out.x2 = Math.min(out.x2, loadedImage.transformed.size.width);
            out.y2 = Math.min(out.y2, loadedImage.transformed.size.height);
        }
        return out;
    }
    getResizeRatio(width, height, settings) {
        const ratioWidth = settings.resizeToWidth / width;
        const ratioHeight = settings.resizeToHeight / height;
        const ratios = new Array();
        if (settings.resizeToWidth > 0) {
            ratios.push(ratioWidth);
        }
        if (settings.resizeToHeight > 0) {
            ratios.push(ratioHeight);
        }
        const result = ratios.length === 0 ? 1 : Math.min(...ratios);
        if (result > 1 && !settings.onlyScaleDown) {
            return result;
        }
        return Math.min(result, 1);
    }
    getQuality(settings) {
        return Math.min(1, Math.max(0, settings.imageQuality / 100));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CropService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CropService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CropService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

class CropperPositionService {
    resetCropperPosition(sourceImage, cropperPosition, settings, maxSize) {
        if (!sourceImage?.nativeElement) {
            return;
        }
        if (settings.cropperStaticHeight && settings.cropperStaticWidth) {
            cropperPosition.x1 = 0;
            cropperPosition.x2 = maxSize.width > settings.cropperStaticWidth ?
                settings.cropperStaticWidth : maxSize.width;
            cropperPosition.y1 = 0;
            cropperPosition.y2 = maxSize.height > settings.cropperStaticHeight ?
                settings.cropperStaticHeight : maxSize.height;
        }
        else {
            const cropperWidth = Math.min(settings.cropperScaledMaxWidth, maxSize.width);
            const cropperHeight = Math.min(settings.cropperScaledMaxHeight, maxSize.height);
            if (!settings.maintainAspectRatio) {
                cropperPosition.x1 = 0;
                cropperPosition.x2 = cropperWidth;
                cropperPosition.y1 = 0;
                cropperPosition.y2 = cropperHeight;
            }
            else if (maxSize.width / settings.aspectRatio < maxSize.height) {
                cropperPosition.x1 = 0;
                cropperPosition.x2 = cropperWidth;
                const cropperHeightWithAspectRatio = cropperWidth / settings.aspectRatio;
                cropperPosition.y1 = (maxSize.height - cropperHeightWithAspectRatio) / 2;
                cropperPosition.y2 = cropperPosition.y1 + cropperHeightWithAspectRatio;
            }
            else {
                cropperPosition.y1 = 0;
                cropperPosition.y2 = cropperHeight;
                const cropperWidthWithAspectRatio = cropperHeight * settings.aspectRatio;
                cropperPosition.x1 = (maxSize.width - cropperWidthWithAspectRatio) / 2;
                cropperPosition.x2 = cropperPosition.x1 + cropperWidthWithAspectRatio;
            }
        }
    }
    move(event, moveStart, cropperPosition) {
        const diffX = this.getClientX(event) - moveStart.clientX;
        const diffY = this.getClientY(event) - moveStart.clientY;
        cropperPosition.x1 = moveStart.x1 + diffX;
        cropperPosition.y1 = moveStart.y1 + diffY;
        cropperPosition.x2 = moveStart.x2 + diffX;
        cropperPosition.y2 = moveStart.y2 + diffY;
    }
    resize(event, moveStart, cropperPosition, maxSize, settings) {
        const moveX = this.getClientX(event) - moveStart.clientX;
        const moveY = this.getClientY(event) - moveStart.clientY;
        switch (moveStart.position) {
            case 'left':
                cropperPosition.x1 = Math.min(Math.max(moveStart.x1 + moveX, cropperPosition.x2 - settings.cropperScaledMaxWidth), cropperPosition.x2 - settings.cropperScaledMinWidth);
                break;
            case 'topleft':
                cropperPosition.x1 = Math.min(Math.max(moveStart.x1 + moveX, cropperPosition.x2 - settings.cropperScaledMaxWidth), cropperPosition.x2 - settings.cropperScaledMinWidth);
                cropperPosition.y1 = Math.min(Math.max(moveStart.y1 + moveY, cropperPosition.y2 - settings.cropperScaledMaxHeight), cropperPosition.y2 - settings.cropperScaledMinHeight);
                break;
            case 'top':
                cropperPosition.y1 = Math.min(Math.max(moveStart.y1 + moveY, cropperPosition.y2 - settings.cropperScaledMaxHeight), cropperPosition.y2 - settings.cropperScaledMinHeight);
                break;
            case 'topright':
                cropperPosition.x2 = Math.max(Math.min(moveStart.x2 + moveX, cropperPosition.x1 + settings.cropperScaledMaxWidth), cropperPosition.x1 + settings.cropperScaledMinWidth);
                cropperPosition.y1 = Math.min(Math.max(moveStart.y1 + moveY, cropperPosition.y2 - settings.cropperScaledMaxHeight), cropperPosition.y2 - settings.cropperScaledMinHeight);
                break;
            case 'right':
                cropperPosition.x2 = Math.max(Math.min(moveStart.x2 + moveX, cropperPosition.x1 + settings.cropperScaledMaxWidth), cropperPosition.x1 + settings.cropperScaledMinWidth);
                break;
            case 'bottomright':
                cropperPosition.x2 = Math.max(Math.min(moveStart.x2 + moveX, cropperPosition.x1 + settings.cropperScaledMaxWidth), cropperPosition.x1 + settings.cropperScaledMinWidth);
                cropperPosition.y2 = Math.max(Math.min(moveStart.y2 + moveY, cropperPosition.y1 + settings.cropperScaledMaxHeight), cropperPosition.y1 + settings.cropperScaledMinHeight);
                break;
            case 'bottom':
                cropperPosition.y2 = Math.max(Math.min(moveStart.y2 + moveY, cropperPosition.y1 + settings.cropperScaledMaxHeight), cropperPosition.y1 + settings.cropperScaledMinHeight);
                break;
            case 'bottomleft':
                cropperPosition.x1 = Math.min(Math.max(moveStart.x1 + moveX, cropperPosition.x2 - settings.cropperScaledMaxWidth), cropperPosition.x2 - settings.cropperScaledMinWidth);
                cropperPosition.y2 = Math.max(Math.min(moveStart.y2 + moveY, cropperPosition.y1 + settings.cropperScaledMaxHeight), cropperPosition.y1 + settings.cropperScaledMinHeight);
                break;
            case 'center':
                const scale = 'scale' in event ? event.scale : 1;
                const newWidth = Math.min(Math.max(settings.cropperScaledMinWidth, (Math.abs(moveStart.x2 - moveStart.x1)) * scale), settings.cropperScaledMaxWidth);
                const newHeight = Math.min(Math.max(settings.cropperScaledMinHeight, (Math.abs(moveStart.y2 - moveStart.y1)) * scale), settings.cropperScaledMaxHeight);
                cropperPosition.x1 = moveStart.clientX - newWidth / 2;
                cropperPosition.x2 = moveStart.clientX + newWidth / 2;
                cropperPosition.y1 = moveStart.clientY - newHeight / 2;
                cropperPosition.y2 = moveStart.clientY + newHeight / 2;
                if (cropperPosition.x1 < 0) {
                    cropperPosition.x2 -= cropperPosition.x1;
                    cropperPosition.x1 = 0;
                }
                else if (cropperPosition.x2 > maxSize.width) {
                    cropperPosition.x1 -= (cropperPosition.x2 - maxSize.width);
                    cropperPosition.x2 = maxSize.width;
                }
                if (cropperPosition.y1 < 0) {
                    cropperPosition.y2 -= cropperPosition.y1;
                    cropperPosition.y1 = 0;
                }
                else if (cropperPosition.y2 > maxSize.height) {
                    cropperPosition.y1 -= (cropperPosition.y2 - maxSize.height);
                    cropperPosition.y2 = maxSize.height;
                }
                break;
        }
        if (settings.maintainAspectRatio) {
            this.checkAspectRatio(moveStart.position, cropperPosition, maxSize, settings);
        }
    }
    checkAspectRatio(position, cropperPosition, maxSize, settings) {
        let overflowX = 0;
        let overflowY = 0;
        switch (position) {
            case 'top':
                cropperPosition.x2 = cropperPosition.x1 + (cropperPosition.y2 - cropperPosition.y1) * settings.aspectRatio;
                overflowX = Math.max(cropperPosition.x2 - maxSize.width, 0);
                overflowY = Math.max(0 - cropperPosition.y1, 0);
                if (overflowX > 0 || overflowY > 0) {
                    cropperPosition.x2 -= (overflowY * settings.aspectRatio) > overflowX ? (overflowY * settings.aspectRatio) : overflowX;
                    cropperPosition.y1 += (overflowY * settings.aspectRatio) > overflowX ? overflowY : overflowX / settings.aspectRatio;
                }
                break;
            case 'bottom':
                cropperPosition.x2 = cropperPosition.x1 + (cropperPosition.y2 - cropperPosition.y1) * settings.aspectRatio;
                overflowX = Math.max(cropperPosition.x2 - maxSize.width, 0);
                overflowY = Math.max(cropperPosition.y2 - maxSize.height, 0);
                if (overflowX > 0 || overflowY > 0) {
                    cropperPosition.x2 -= (overflowY * settings.aspectRatio) > overflowX ? (overflowY * settings.aspectRatio) : overflowX;
                    cropperPosition.y2 -= (overflowY * settings.aspectRatio) > overflowX ? overflowY : (overflowX / settings.aspectRatio);
                }
                break;
            case 'topleft':
                cropperPosition.y1 = cropperPosition.y2 - (cropperPosition.x2 - cropperPosition.x1) / settings.aspectRatio;
                overflowX = Math.max(0 - cropperPosition.x1, 0);
                overflowY = Math.max(0 - cropperPosition.y1, 0);
                if (overflowX > 0 || overflowY > 0) {
                    cropperPosition.x1 += (overflowY * settings.aspectRatio) > overflowX ? (overflowY * settings.aspectRatio) : overflowX;
                    cropperPosition.y1 += (overflowY * settings.aspectRatio) > overflowX ? overflowY : overflowX / settings.aspectRatio;
                }
                break;
            case 'topright':
                cropperPosition.y1 = cropperPosition.y2 - (cropperPosition.x2 - cropperPosition.x1) / settings.aspectRatio;
                overflowX = Math.max(cropperPosition.x2 - maxSize.width, 0);
                overflowY = Math.max(0 - cropperPosition.y1, 0);
                if (overflowX > 0 || overflowY > 0) {
                    cropperPosition.x2 -= (overflowY * settings.aspectRatio) > overflowX ? (overflowY * settings.aspectRatio) : overflowX;
                    cropperPosition.y1 += (overflowY * settings.aspectRatio) > overflowX ? overflowY : overflowX / settings.aspectRatio;
                }
                break;
            case 'right':
            case 'bottomright':
                cropperPosition.y2 = cropperPosition.y1 + (cropperPosition.x2 - cropperPosition.x1) / settings.aspectRatio;
                overflowX = Math.max(cropperPosition.x2 - maxSize.width, 0);
                overflowY = Math.max(cropperPosition.y2 - maxSize.height, 0);
                if (overflowX > 0 || overflowY > 0) {
                    cropperPosition.x2 -= (overflowY * settings.aspectRatio) > overflowX ? (overflowY * settings.aspectRatio) : overflowX;
                    cropperPosition.y2 -= (overflowY * settings.aspectRatio) > overflowX ? overflowY : overflowX / settings.aspectRatio;
                }
                break;
            case 'left':
            case 'bottomleft':
                cropperPosition.y2 = cropperPosition.y1 + (cropperPosition.x2 - cropperPosition.x1) / settings.aspectRatio;
                overflowX = Math.max(0 - cropperPosition.x1, 0);
                overflowY = Math.max(cropperPosition.y2 - maxSize.height, 0);
                if (overflowX > 0 || overflowY > 0) {
                    cropperPosition.x1 += (overflowY * settings.aspectRatio) > overflowX ? (overflowY * settings.aspectRatio) : overflowX;
                    cropperPosition.y2 -= (overflowY * settings.aspectRatio) > overflowX ? overflowY : overflowX / settings.aspectRatio;
                }
                break;
            case 'center':
                cropperPosition.x2 = cropperPosition.x1 + (cropperPosition.y2 - cropperPosition.y1) * settings.aspectRatio;
                cropperPosition.y2 = cropperPosition.y1 + (cropperPosition.x2 - cropperPosition.x1) / settings.aspectRatio;
                const overflowX1 = Math.max(0 - cropperPosition.x1, 0);
                const overflowX2 = Math.max(cropperPosition.x2 - maxSize.width, 0);
                const overflowY1 = Math.max(cropperPosition.y2 - maxSize.height, 0);
                const overflowY2 = Math.max(0 - cropperPosition.y1, 0);
                if (overflowX1 > 0 || overflowX2 > 0 || overflowY1 > 0 || overflowY2 > 0) {
                    cropperPosition.x1 += (overflowY1 * settings.aspectRatio) > overflowX1 ? (overflowY1 * settings.aspectRatio) : overflowX1;
                    cropperPosition.x2 -= (overflowY2 * settings.aspectRatio) > overflowX2 ? (overflowY2 * settings.aspectRatio) : overflowX2;
                    cropperPosition.y1 += (overflowY2 * settings.aspectRatio) > overflowX2 ? overflowY2 : overflowX2 / settings.aspectRatio;
                    cropperPosition.y2 -= (overflowY1 * settings.aspectRatio) > overflowX1 ? overflowY1 : overflowX1 / settings.aspectRatio;
                }
                break;
        }
    }
    getClientX(event) {
        if ('touches' in event && event.touches[0])
            return event.touches[0].clientX;
        else if ('clientX' in event) {
            return event.clientX;
        }
        return 0;
    }
    getClientY(event) {
        if ('touches' in event && event.touches[0])
            return event.touches[0].clientY;
        else if ('clientX' in event) {
            return event.clientY;
        }
        return 0;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CropperPositionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CropperPositionService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CropperPositionService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

// Black 2x1 JPEG, with the following meta information set:
// - EXIF Orientation: 6 (Rotated 90° CCW)
// Source: https://github.com/blueimp/JavaScript-Load-Image
const testAutoOrientationImageURL = 'data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAA' +
    'AAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA' +
    'QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE' +
    'BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/x' +
    'ABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAA' +
    'AAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==';
function supportsAutomaticRotation() {
    return new Promise((resolve) => {
        const img = new Image();
        img.onload = () => {
            // Check if browser supports automatic image orientation:
            const supported = img.width === 1 && img.height === 2;
            resolve(supported);
        };
        img.src = testAutoOrientationImageURL;
    });
}
function getTransformationsFromExifData(exifRotationOrArrayBuffer) {
    if (typeof exifRotationOrArrayBuffer === 'object') {
        exifRotationOrArrayBuffer = getExifRotation(exifRotationOrArrayBuffer);
    }
    switch (exifRotationOrArrayBuffer) {
        case 2:
            return { rotate: 0, flip: true };
        case 3:
            return { rotate: 2, flip: false };
        case 4:
            return { rotate: 2, flip: true };
        case 5:
            return { rotate: 1, flip: true };
        case 6:
            return { rotate: 1, flip: false };
        case 7:
            return { rotate: 3, flip: true };
        case 8:
            return { rotate: 3, flip: false };
        default:
            return { rotate: 0, flip: false };
    }
}
function getExifRotation(arrayBuffer) {
    const view = new DataView(arrayBuffer);
    if (view.getUint16(0, false) !== 0xFFD8) {
        return -2;
    }
    const length = view.byteLength;
    let offset = 2;
    while (offset < length) {
        if (view.getUint16(offset + 2, false) <= 8)
            return -1;
        const marker = view.getUint16(offset, false);
        offset += 2;
        if (marker == 0xFFE1) {
            if (view.getUint32(offset += 2, false) !== 0x45786966) {
                return -1;
            }
            const little = view.getUint16(offset += 6, false) == 0x4949;
            offset += view.getUint32(offset + 4, little);
            const tags = view.getUint16(offset, little);
            offset += 2;
            for (let i = 0; i < tags; i++) {
                if (view.getUint16(offset + (i * 12), little) == 0x0112) {
                    return view.getUint16(offset + (i * 12) + 8, little);
                }
            }
        }
        else if ((marker & 0xFF00) !== 0xFF00) {
            break;
        }
        else {
            offset += view.getUint16(offset, false);
        }
    }
    return -1;
}

class LoadImageService {
    constructor() {
        this.autoRotateSupported = supportsAutomaticRotation();
    }
    async loadImageFile(file, cropperSettings) {
        const arrayBuffer = await file.arrayBuffer();
        return await this.checkImageTypeAndLoadImageFromArrayBuffer(arrayBuffer, file.type, cropperSettings);
    }
    checkImageTypeAndLoadImageFromArrayBuffer(arrayBuffer, imageType, cropperSettings) {
        if (!this.isValidImageType(imageType)) {
            return Promise.reject(new Error('Invalid image type'));
        }
        return this.loadImageFromArrayBuffer(arrayBuffer, cropperSettings, imageType);
    }
    isValidImageType(type) {
        return /image\/(png|jpg|jpeg|bmp|gif|tiff|svg|webp|x-icon|vnd.microsoft.icon)/.test(type);
    }
    async loadImageFromURL(url, cropperSettings) {
        const res = await fetch(url);
        const blob = await res.blob();
        const buffer = await blob.arrayBuffer();
        return await this.loadImageFromArrayBuffer(buffer, cropperSettings, blob.type);
    }
    loadBase64Image(imageBase64, cropperSettings) {
        const arrayBuffer = this.base64ToArrayBuffer(imageBase64);
        return this.loadImageFromArrayBuffer(arrayBuffer, cropperSettings);
    }
    base64ToArrayBuffer(imageBase64) {
        imageBase64 = imageBase64.replace(/^data:([^;]+);base64,/gmi, '');
        const binaryString = atob(imageBase64);
        const len = binaryString.length;
        const bytes = new Uint8Array(len);
        for (let i = 0; i < len; i++) {
            bytes[i] = binaryString.charCodeAt(i);
        }
        return bytes.buffer;
    }
    async loadImageFromArrayBuffer(arrayBuffer, cropperSettings, imageType) {
        const res = await new Promise(async (resolve, reject) => {
            try {
                const blob = new Blob([arrayBuffer], imageType ? { type: imageType } : undefined);
                const objectUrl = URL.createObjectURL(blob);
                const originalImage = new Image();
                const isSvg = imageType === 'image/svg+xml';
                const originalImageSize = isSvg ? await this.getSvgImageSize(blob) : undefined;
                originalImage.onload = () => resolve({
                    originalImage,
                    originalImageSize,
                    originalObjectUrl: objectUrl,
                    originalArrayBuffer: arrayBuffer
                });
                originalImage.onerror = reject;
                originalImage.src = objectUrl;
            }
            catch (e) {
                reject(e);
            }
        });
        return await this.transformImageFromArrayBuffer(res, cropperSettings, res.originalImageSize != null);
    }
    async getSvgImageSize(blob) {
        const parser = new DOMParser();
        const doc = parser.parseFromString(await blob.text(), 'image/svg+xml');
        const svgElement = doc.querySelector('svg');
        if (!svgElement) {
            throw Error('Failed to parse SVG image');
        }
        const widthAttr = svgElement.getAttribute('width');
        const heightAttr = svgElement.getAttribute('height');
        if (widthAttr && heightAttr) {
            return null;
        }
        const viewBoxAttr = svgElement.getAttribute('viewBox')
            || svgElement.getAttribute('viewbox');
        if (viewBoxAttr) {
            const viewBox = viewBoxAttr.split(' ');
            return {
                width: +viewBox[2],
                height: +viewBox[3]
            };
        }
        throw Error('Failed to load SVG image. SVG must have width + height or viewBox definition.');
    }
    async transformImageFromArrayBuffer(res, cropperSettings, forceTransform = false) {
        const autoRotate = await this.autoRotateSupported;
        const exifTransform = getTransformationsFromExifData(autoRotate ? -1 : res.originalArrayBuffer);
        if (!res.originalImage || !res.originalImage.complete) {
            return Promise.reject(new Error('No image loaded'));
        }
        const loadedImage = {
            original: {
                objectUrl: res.originalObjectUrl,
                image: res.originalImage,
                size: res.originalImageSize ?? {
                    width: res.originalImage.naturalWidth,
                    height: res.originalImage.naturalHeight
                }
            },
            exifTransform
        };
        return this.transformLoadedImage(loadedImage, cropperSettings, forceTransform);
    }
    async transformLoadedImage(loadedImage, cropperSettings, forceTransform = false) {
        const canvasRotation = cropperSettings.canvasRotation + loadedImage.exifTransform.rotate;
        const originalSize = loadedImage.original.size;
        if (!forceTransform && canvasRotation === 0 && !loadedImage.exifTransform.flip && !cropperSettings.containWithinAspectRatio) {
            return {
                original: {
                    objectUrl: loadedImage.original.objectUrl,
                    image: loadedImage.original.image,
                    size: { ...originalSize }
                },
                transformed: {
                    objectUrl: loadedImage.original.objectUrl,
                    image: loadedImage.original.image,
                    size: { ...originalSize }
                },
                exifTransform: loadedImage.exifTransform
            };
        }
        const transformedSize = this.getTransformedSize(originalSize, loadedImage.exifTransform, cropperSettings);
        const canvas = document.createElement('canvas');
        canvas.width = transformedSize.width;
        canvas.height = transformedSize.height;
        const ctx = canvas.getContext('2d');
        ctx?.setTransform(loadedImage.exifTransform.flip ? -1 : 1, 0, 0, 1, canvas.width / 2, canvas.height / 2);
        ctx?.rotate(Math.PI * (canvasRotation / 2));
        ctx?.drawImage(loadedImage.original.image, -originalSize.width / 2, -originalSize.height / 2);
        const blob = await new Promise(resolve => canvas.toBlob(resolve, cropperSettings.format));
        if (!blob) {
            throw new Error('Failed to get Blob for transformed image.');
        }
        const objectUrl = URL.createObjectURL(blob);
        const transformedImage = await this.loadImageFromObjectUrl(objectUrl);
        return {
            original: {
                objectUrl: loadedImage.original.objectUrl,
                image: loadedImage.original.image,
                size: { ...originalSize }
            },
            transformed: {
                objectUrl: objectUrl,
                image: transformedImage,
                size: {
                    width: transformedImage.width,
                    height: transformedImage.height
                }
            },
            exifTransform: loadedImage.exifTransform
        };
    }
    loadImageFromObjectUrl(objectUrl) {
        return new Promise(((resolve, reject) => {
            const image = new Image();
            image.onload = () => resolve(image);
            image.onerror = reject;
            image.src = objectUrl;
        }));
    }
    getTransformedSize(originalSize, exifTransform, cropperSettings) {
        const canvasRotation = cropperSettings.canvasRotation + exifTransform.rotate;
        if (cropperSettings.containWithinAspectRatio) {
            if (canvasRotation % 2) {
                const minWidthToContain = originalSize.width * cropperSettings.aspectRatio;
                const minHeightToContain = originalSize.height / cropperSettings.aspectRatio;
                return {
                    width: Math.max(originalSize.height, minWidthToContain),
                    height: Math.max(originalSize.width, minHeightToContain)
                };
            }
            else {
                const minWidthToContain = originalSize.height * cropperSettings.aspectRatio;
                const minHeightToContain = originalSize.width / cropperSettings.aspectRatio;
                return {
                    width: Math.max(originalSize.width, minWidthToContain),
                    height: Math.max(originalSize.height, minHeightToContain)
                };
            }
        }
        if (canvasRotation % 2) {
            return {
                height: originalSize.width,
                width: originalSize.height
            };
        }
        return {
            width: originalSize.width,
            height: originalSize.height
        };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LoadImageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LoadImageService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LoadImageService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

function getPositionForKey(key) {
    switch (key) {
        case 'ArrowUp':
            return 'top';
        case 'ArrowRight':
            return 'right';
        case 'ArrowDown':
            return 'bottom';
        case 'ArrowLeft':
        default:
            return 'left';
    }
}
function getInvertedPositionForKey(key) {
    switch (key) {
        case 'ArrowUp':
            return 'bottom';
        case 'ArrowRight':
            return 'left';
        case 'ArrowDown':
            return 'top';
        case 'ArrowLeft':
        default:
            return 'right';
    }
}
function getEventForKey(key, stepSize) {
    switch (key) {
        case 'ArrowUp':
            return { clientX: 0, clientY: stepSize * -1 };
        case 'ArrowRight':
            return { clientX: stepSize, clientY: 0 };
        case 'ArrowDown':
            return { clientX: 0, clientY: stepSize };
        case 'ArrowLeft':
        default:
            return { clientX: stepSize * -1, clientY: 0 };
    }
}

const GUID_EMPTY = '00000000-0000-0000-0000-000000000000';
const GUID_FORMAT = /\{?([a-z0-9]{8}(?:-[a-z0-9]{4}){3}-[a-z0-9]{12})\}?/i;
/**
 * A unique identifier.
 */
class Guid {
    /**
     * Returns an empty GUID.
     */
    static empty() {
        return new Guid(GUID_EMPTY);
    }
    /**
     * Creates a new GUID.
     */
    static newGuid() {
        return new Guid(`${Guid.s4()}${Guid.s4()}-${Guid.s4()}-${Guid.s4()}-${Guid.s4()}-${Guid.s4()}${Guid.s4()}${Guid.s4()}`);
    }
    static parse(val) {
        return val ? new Guid(val) : null;
    }
    static s4() {
        return Math
            .floor((1 + Math.random()) * 0x10000)
            .toString(16)
            .substring(1);
    }
    /**
     * Creates a new GUID from a string or clones existing guid.
     */
    constructor(id) {
        if (id instanceof Guid) {
            this._id = id.valueOf();
            return;
        }
        if (GUID_FORMAT.test(id)) {
            this._id = GUID_FORMAT.exec(id.toLowerCase())[1];
            return;
        }
        throw new Error(`Invalid GUID ${id}`);
    }
    /**
     * Compares if two GUID's are equal.
     */
    equals(value) {
        try {
            return this._id === (new Guid(value)).valueOf();
        }
        catch (err) {
            return false;
        }
    }
    /**
     * Converts the GUID to a formatted string.
     *
     * Formats:
     *   n = 00000000000000000000000000000000
     *   d = 00000000-0000-0000-0000-000000000000 (default)
     *   b = {00000000-0000-0000-0000-000000000000}
     */
    toString(format = 'd') {
        switch (format.toLowerCase()) {
            case 'n':
                return this._id.replace('-', '');
            case 'b':
                return `{${this._id}}`;
            default:
                return this._id;
        }
    }
    /**
     * Returns the underlying value.
     */
    valueOf() {
        return this._id;
    }
}

class ImageCropperComponent {
    constructor(cropService, cropperPositionService, loadImageService, sanitizer, cd, zone, hammerLoader) {
        this.cropService = cropService;
        this.cropperPositionService = cropperPositionService;
        this.loadImageService = loadImageService;
        this.sanitizer = sanitizer;
        this.cd = cd;
        this.zone = zone;
        this.hammerLoader = hammerLoader;
        this.hostID = Guid.newGuid().toString();
        this.settings = new CropperSettings();
        this.setImageMaxSizeRetries = 0;
        this.resizedWhileHidden = false;
        this.marginLeft = '0px';
        this.maxSize = {
            width: 0,
            height: 0
        };
        this.moveTypes = MoveTypes;
        this.imageVisible = false;
        this.cropperFrameAriaLabel = this.settings.cropperFrameAriaLabel;
        this.output = this.settings.output;
        this.format = this.settings.format;
        this.transform = {};
        this.maintainAspectRatio = this.settings.maintainAspectRatio;
        this.aspectRatio = this.settings.aspectRatio;
        this.resetCropOnAspectRatioChange = this.settings.resetCropOnAspectRatioChange;
        this.resizeToWidth = this.settings.resizeToWidth;
        this.resizeToHeight = this.settings.resizeToHeight;
        this.cropperMinWidth = this.settings.cropperMinWidth;
        this.cropperMinHeight = this.settings.cropperMinHeight;
        this.cropperMaxHeight = this.settings.cropperMaxHeight;
        this.cropperMaxWidth = this.settings.cropperMaxWidth;
        this.cropperStaticWidth = this.settings.cropperStaticWidth;
        this.cropperStaticHeight = this.settings.cropperStaticHeight;
        this.canvasRotation = this.settings.canvasRotation;
        this.initialStepSize = this.settings.initialStepSize;
        this.roundCropper = this.settings.roundCropper;
        this.onlyScaleDown = this.settings.onlyScaleDown;
        this.imageQuality = this.settings.imageQuality;
        this.autoCrop = this.settings.autoCrop;
        this.backgroundColor = this.settings.backgroundColor;
        this.containWithinAspectRatio = this.settings.containWithinAspectRatio;
        this.hideResizeSquares = this.settings.hideResizeSquares;
        this.allowMoveImage = false;
        this.cropper = {
            x1: -100,
            y1: -100,
            x2: 10000,
            y2: 10000
        };
        this.alignImage = this.settings.alignImage;
        this.disabled = false;
        this.hidden = false;
        this.imageCropped = new EventEmitter();
        this.startCropImage = new EventEmitter();
        this.imageLoaded = new EventEmitter();
        this.cropperReady = new EventEmitter();
        this.loadImageFailed = new EventEmitter();
        this.transformChange = new EventEmitter();
        this.reset();
    }
    ngOnChanges(changes) {
        this.onChangesUpdateSettings(changes);
        this.onChangesInputImage(changes);
        if (this.loadedImage?.original.image.complete && (changes['containWithinAspectRatio'] || changes['canvasRotation'])) {
            this.loadImageService
                .transformLoadedImage(this.loadedImage, this.settings)
                .then((res) => this.setLoadedImage(res))
                .catch((err) => this.loadImageError(err));
        }
        if (changes['cropper'] || changes['maintainAspectRatio'] || changes['aspectRatio']) {
            this.setMaxSize();
            this.setCropperScaledMinSize();
            this.setCropperScaledMaxSize();
            if (this.maintainAspectRatio &&
                (this.resetCropOnAspectRatioChange || !this.aspectRatioIsCorrect()) &&
                (changes['maintainAspectRatio'] || changes['aspectRatio'])) {
                this.resetCropperPosition();
            }
            else if (changes['cropper']) {
                this.checkCropperPosition(false);
                this.doAutoCrop();
            }
        }
        if (changes['transform']) {
            this.transform = this.transform || {};
            this.setCssTransform();
            this.doAutoCrop();
        }
        if (changes['hidden'] && this.resizedWhileHidden && !this.hidden) {
            setTimeout(() => {
                this.onResize();
                this.resizedWhileHidden = false;
            });
        }
    }
    onChangesUpdateSettings(changes) {
        this.settings.setOptionsFromChanges(changes);
        if (this.settings.cropperStaticHeight && this.settings.cropperStaticWidth) {
            this.hideResizeSquares = true;
            this.settings.setOptions({
                hideResizeSquares: true,
                cropperMinWidth: this.settings.cropperStaticWidth,
                cropperMinHeight: this.settings.cropperStaticHeight,
                cropperMaxHeight: this.settings.cropperStaticHeight,
                cropperMaxWidth: this.settings.cropperStaticWidth,
                maintainAspectRatio: false
            });
        }
    }
    onChangesInputImage(changes) {
        if (changes['imageChangedEvent'] || changes['imageURL'] || changes['imageBase64'] || changes['imageFile']) {
            this.reset();
        }
        if (changes['imageChangedEvent'] && this.isValidImageChangedEvent()) {
            this.loadImageFile(this.imageChangedEvent.target.files[0]);
        }
        if (changes['imageURL'] && this.imageURL) {
            this.loadImageFromURL(this.imageURL);
        }
        if (changes['imageBase64'] && this.imageBase64) {
            this.loadBase64Image(this.imageBase64);
        }
        if (changes['imageFile'] && this.imageFile) {
            this.loadImageFile(this.imageFile);
        }
    }
    isValidImageChangedEvent() {
        const files = this.imageChangedEvent?.target?.files;
        return files instanceof FileList && files.length > 0;
    }
    setCssTransform() {
        const translateUnit = this.transform?.translateUnit || '%';
        this.safeTransformStyle = this.sanitizer.bypassSecurityTrustStyle(`translate(${this.transform.translateH || 0}${translateUnit}, ${this.transform.translateV || 0}${translateUnit})` +
            ' scaleX(' + (this.transform.scale || 1) * (this.transform.flipH ? -1 : 1) + ')' +
            ' scaleY(' + (this.transform.scale || 1) * (this.transform.flipV ? -1 : 1) + ')' +
            ' rotate(' + (this.transform.rotate || 0) + 'deg)');
    }
    ngOnInit() {
        this.settings.stepSize = this.initialStepSize;
        this.activatePinchGesture();
    }
    reset() {
        this.imageVisible = false;
        this.loadedImage = undefined;
        this.safeImgDataUrl = 'data:image/png;base64,iVBORw0KGg'
            + 'oAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAU'
            + 'AAarVyFEAAAAASUVORK5CYII=';
        this.moveStart = {
            active: false,
            type: null,
            position: null,
            x1: 0,
            y1: 0,
            x2: 0,
            y2: 0,
            clientX: 0,
            clientY: 0
        };
        this.maxSize = {
            width: 0,
            height: 0
        };
        this.cropper.x1 = -100;
        this.cropper.y1 = -100;
        this.cropper.x2 = 10000;
        this.cropper.y2 = 10000;
    }
    loadImageFile(file) {
        this.loadImageService
            .loadImageFile(file, this.settings)
            .then((res) => this.setLoadedImage(res))
            .catch((err) => this.loadImageError(err));
    }
    loadBase64Image(imageBase64) {
        this.loadImageService
            .loadBase64Image(imageBase64, this.settings)
            .then((res) => this.setLoadedImage(res))
            .catch((err) => this.loadImageError(err));
    }
    loadImageFromURL(url) {
        this.loadImageService
            .loadImageFromURL(url, this.settings)
            .then((res) => this.setLoadedImage(res))
            .catch((err) => this.loadImageError(err));
    }
    setLoadedImage(loadedImage) {
        this.loadedImage = loadedImage;
        this.safeImgDataUrl = this.sanitizer.bypassSecurityTrustResourceUrl(loadedImage.transformed.objectUrl);
        this.cd.markForCheck();
    }
    loadImageError(error) {
        console.error(error);
        this.loadImageFailed.emit();
    }
    imageLoadedInView() {
        if (this.loadedImage != null) {
            this.imageLoaded.emit(this.loadedImage);
            this.setImageMaxSizeRetries = 0;
            setTimeout(() => this.checkImageMaxSizeRecursively());
        }
    }
    checkImageMaxSizeRecursively() {
        if (this.setImageMaxSizeRetries > 40) {
            this.loadImageFailed.emit();
        }
        else if (this.sourceImageLoaded()) {
            this.setMaxSize();
            this.setCropperScaledMinSize();
            this.setCropperScaledMaxSize();
            this.resetCropperPosition();
            this.cropperReady.emit({ ...this.maxSize });
            this.cd.markForCheck();
        }
        else {
            this.setImageMaxSizeRetries++;
            setTimeout(() => this.checkImageMaxSizeRecursively(), 50);
        }
    }
    sourceImageLoaded() {
        return this.sourceImage?.nativeElement?.offsetWidth > 0;
    }
    onResize() {
        if (!this.loadedImage) {
            return;
        }
        if (this.hidden) {
            this.resizedWhileHidden = true;
        }
        else {
            const oldMaxSize = { ...this.maxSize };
            this.setMaxSize();
            this.resizeCropperPosition(oldMaxSize);
            this.setCropperScaledMinSize();
            this.setCropperScaledMaxSize();
        }
    }
    async activatePinchGesture() {
        // Loads HammerJS via angular APIs if configured
        await this.hammerLoader?.();
        const Hammer = window?.['Hammer'] || null;
        if (Hammer) {
            const hammer = new Hammer(this.wrapper.nativeElement);
            hammer.get('pinch').set({ enable: true });
            hammer.on('pinchmove', this.onPinch.bind(this));
            hammer.on('pinchend', this.pinchStop.bind(this));
            hammer.on('pinchstart', this.startPinch.bind(this));
        }
        else if (isDevMode()) {
            console.warn('[NgxImageCropper] Could not find HammerJS - Pinch Gesture won\'t work');
        }
    }
    resizeCropperPosition(oldMaxSize) {
        if (oldMaxSize.width !== this.maxSize.width || oldMaxSize.height !== this.maxSize.height) {
            this.cropper.x1 = this.cropper.x1 * this.maxSize.width / oldMaxSize.width;
            this.cropper.x2 = this.cropper.x2 * this.maxSize.width / oldMaxSize.width;
            this.cropper.y1 = this.cropper.y1 * this.maxSize.height / oldMaxSize.height;
            this.cropper.y2 = this.cropper.y2 * this.maxSize.height / oldMaxSize.height;
        }
    }
    resetCropperPosition() {
        this.cropperPositionService.resetCropperPosition(this.sourceImage, this.cropper, this.settings, this.maxSize);
        this.doAutoCrop();
        this.imageVisible = true;
    }
    keyboardAccess(event) {
        this.changeKeyboardStepSize(event);
        this.keyboardMoveCropper(event);
    }
    changeKeyboardStepSize(event) {
        const key = +event.key;
        if (key >= 1 && key <= 9) {
            this.settings.stepSize = key;
        }
    }
    keyboardMoveCropper(event) {
        const keyboardWhiteList = ['ArrowUp', 'ArrowDown', 'ArrowRight', 'ArrowLeft'];
        if (!(keyboardWhiteList.includes(event.key))) {
            return;
        }
        const moveType = event.shiftKey ? MoveTypes.Resize : MoveTypes.Move;
        const position = event.altKey ? getInvertedPositionForKey(event.key) : getPositionForKey(event.key);
        const moveEvent = getEventForKey(event.key, this.settings.stepSize);
        event.preventDefault();
        event.stopPropagation();
        this.startMove({ clientX: 0, clientY: 0 }, moveType, position);
        this.handleMouseMove(moveEvent);
        this.handleMouseUp();
    }
    startMove(event, moveType, position = null) {
        if (this.disabled
            || this.moveStart?.active && this.moveStart?.type === MoveTypes.Pinch
            || moveType === MoveTypes.Drag && !this.allowMoveImage) {
            return;
        }
        if ('preventDefault' in event) {
            event.preventDefault();
        }
        this.moveStart = {
            active: true,
            type: moveType,
            position,
            transform: { ...this.transform },
            clientX: this.cropperPositionService.getClientX(event),
            clientY: this.cropperPositionService.getClientY(event),
            ...this.cropper
        };
        this.initMouseMove();
    }
    initMouseMove() {
        merge(fromEvent(document, 'mousemove'), fromEvent(document, 'touchmove')).pipe(takeUntil(merge(fromEvent(document, 'mouseup'), fromEvent(document, 'touchend')).pipe(first())))
            .subscribe({
            next: (event) => this.zone.run(() => {
                this.handleMouseMove(event);
                this.cd.markForCheck();
            }),
            complete: () => this.zone.run(() => {
                this.handleMouseUp();
                this.cd.markForCheck();
            })
        });
    }
    startPinch(event) {
        if (!this.safeImgDataUrl) {
            return;
        }
        if (event.preventDefault) {
            event.preventDefault();
        }
        this.moveStart = {
            active: true,
            type: MoveTypes.Pinch,
            position: 'center',
            clientX: this.cropper.x1 + (this.cropper.x2 - this.cropper.x1) / 2,
            clientY: this.cropper.y1 + (this.cropper.y2 - this.cropper.y1) / 2,
            ...this.cropper
        };
    }
    handleMouseMove(event) {
        if (this.moveStart.active) {
            if ('stopPropagation' in event) {
                event.stopPropagation();
            }
            if ('preventDefault' in event) {
                event.preventDefault();
            }
            if (this.moveStart.type === MoveTypes.Move) {
                this.cropperPositionService.move(event, this.moveStart, this.cropper);
                this.checkCropperPosition(true);
            }
            else if (this.moveStart.type === MoveTypes.Resize) {
                if (!this.cropperStaticWidth && !this.cropperStaticHeight) {
                    this.cropperPositionService.resize(event, this.moveStart, this.cropper, this.maxSize, this.settings);
                }
                this.checkCropperPosition(false);
            }
            else if (this.moveStart.type === MoveTypes.Drag) {
                const diffX = this.cropperPositionService.getClientX(event) - this.moveStart.clientX;
                const diffY = this.cropperPositionService.getClientY(event) - this.moveStart.clientY;
                this.transform = {
                    ...this.transform,
                    translateH: (this.moveStart.transform?.translateH || 0) + diffX,
                    translateV: (this.moveStart.transform?.translateV || 0) + diffY
                };
                this.setCssTransform();
            }
        }
    }
    onPinch(event) {
        if (this.moveStart.active) {
            if (event.preventDefault) {
                event.preventDefault();
            }
            if (this.moveStart.type === MoveTypes.Pinch) {
                this.cropperPositionService.resize(event, this.moveStart, this.cropper, this.maxSize, this.settings);
                this.checkCropperPosition(false);
            }
            this.cd.markForCheck();
        }
    }
    setMaxSize() {
        if (this.sourceImage) {
            const sourceImageStyle = getComputedStyle(this.sourceImage.nativeElement);
            this.maxSize.width = parseFloat(sourceImageStyle.width);
            this.maxSize.height = parseFloat(sourceImageStyle.height);
            this.marginLeft = this.sanitizer.bypassSecurityTrustStyle('calc(50% - ' + this.maxSize.width / 2 + 'px)');
        }
    }
    setCropperScaledMinSize() {
        if (this.loadedImage?.transformed?.image) {
            this.setCropperScaledMinWidth();
            this.setCropperScaledMinHeight();
        }
        else {
            this.settings.cropperScaledMinWidth = 20;
            this.settings.cropperScaledMinHeight = 20;
        }
    }
    setCropperScaledMinWidth() {
        this.settings.cropperScaledMinWidth = this.cropperMinWidth > 0
            ? Math.max(20, this.cropperMinWidth / this.loadedImage.transformed.image.width * this.maxSize.width)
            : 20;
    }
    setCropperScaledMinHeight() {
        if (this.maintainAspectRatio) {
            this.settings.cropperScaledMinHeight = Math.max(20, this.settings.cropperScaledMinWidth / this.aspectRatio);
        }
        else if (this.cropperMinHeight > 0) {
            this.settings.cropperScaledMinHeight = Math.max(20, this.cropperMinHeight / this.loadedImage.transformed.image.height * this.maxSize.height);
        }
        else {
            this.settings.cropperScaledMinHeight = 20;
        }
    }
    setCropperScaledMaxSize() {
        if (this.loadedImage?.transformed?.image) {
            const ratio = this.loadedImage.transformed.size.width / this.maxSize.width;
            this.settings.cropperScaledMaxWidth = this.cropperMaxWidth > 20 ? this.cropperMaxWidth / ratio : this.maxSize.width;
            this.settings.cropperScaledMaxHeight = this.cropperMaxHeight > 20 ? this.cropperMaxHeight / ratio : this.maxSize.height;
            if (this.maintainAspectRatio) {
                if (this.settings.cropperScaledMaxWidth > this.settings.cropperScaledMaxHeight * this.aspectRatio) {
                    this.settings.cropperScaledMaxWidth = this.settings.cropperScaledMaxHeight * this.aspectRatio;
                }
                else if (this.settings.cropperScaledMaxWidth < this.settings.cropperScaledMaxHeight * this.aspectRatio) {
                    this.settings.cropperScaledMaxHeight = this.settings.cropperScaledMaxWidth / this.aspectRatio;
                }
            }
        }
        else {
            this.settings.cropperScaledMaxWidth = this.maxSize.width;
            this.settings.cropperScaledMaxHeight = this.maxSize.height;
        }
    }
    checkCropperPosition(maintainSize = false) {
        if (this.cropper.x1 < 0) {
            this.cropper.x2 -= maintainSize ? this.cropper.x1 : 0;
            this.cropper.x1 = 0;
        }
        if (this.cropper.y1 < 0) {
            this.cropper.y2 -= maintainSize ? this.cropper.y1 : 0;
            this.cropper.y1 = 0;
        }
        if (this.cropper.x2 > this.maxSize.width) {
            this.cropper.x1 -= maintainSize ? (this.cropper.x2 - this.maxSize.width) : 0;
            this.cropper.x2 = this.maxSize.width;
        }
        if (this.cropper.y2 > this.maxSize.height) {
            this.cropper.y1 -= maintainSize ? (this.cropper.y2 - this.maxSize.height) : 0;
            this.cropper.y2 = this.maxSize.height;
        }
    }
    handleMouseUp() {
        if (this.moveStart.active) {
            this.moveStart.active = false;
            if (this.moveStart?.type === MoveTypes.Drag) {
                this.transformChange.emit(this.transform);
            }
            else {
                this.doAutoCrop();
            }
        }
    }
    pinchStop() {
        if (this.moveStart.active) {
            this.moveStart.active = false;
            this.doAutoCrop();
        }
    }
    doAutoCrop() {
        if (this.autoCrop) {
            void this.crop();
        }
    }
    crop(output = this.settings.output) {
        if (this.loadedImage?.transformed?.image != null) {
            this.startCropImage.emit();
            if (output === 'blob') {
                return this.cropToBlob();
            }
            else if (output === 'base64') {
                return this.cropToBase64();
            }
        }
        return null;
    }
    cropToBlob() {
        return new Promise((resolve, reject) => this.zone.run(async () => {
            const result = await this.cropService.crop(this.loadedImage, this.cropper, this.settings, 'blob', this.maxSize);
            if (result) {
                this.imageCropped.emit(result);
                resolve(result);
            }
            else {
                reject('Crop image failed');
            }
        }));
    }
    cropToBase64() {
        const result = this.cropService.crop(this.loadedImage, this.cropper, this.settings, 'base64', this.maxSize);
        if (result) {
            this.imageCropped.emit(result);
            return result;
        }
        return null;
    }
    aspectRatioIsCorrect() {
        const currentCropAspectRatio = (this.cropper.x2 - this.cropper.x1) / (this.cropper.y2 - this.cropper.y1);
        return currentCropAspectRatio === this.aspectRatio;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ImageCropperComponent, deps: [{ token: CropService }, { token: CropperPositionService }, { token: LoadImageService }, { token: i1.DomSanitizer }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: HAMMER_LOADER, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: ImageCropperComponent, isStandalone: false, selector: "core-cropper", inputs: { imageChangedEvent: "imageChangedEvent", imageURL: "imageURL", imageBase64: "imageBase64", imageFile: "imageFile", imageAltText: "imageAltText", cropperFrameAriaLabel: "cropperFrameAriaLabel", output: "output", format: "format", transform: "transform", maintainAspectRatio: "maintainAspectRatio", aspectRatio: "aspectRatio", resetCropOnAspectRatioChange: "resetCropOnAspectRatioChange", resizeToWidth: "resizeToWidth", resizeToHeight: "resizeToHeight", cropperMinWidth: "cropperMinWidth", cropperMinHeight: "cropperMinHeight", cropperMaxHeight: "cropperMaxHeight", cropperMaxWidth: "cropperMaxWidth", cropperStaticWidth: "cropperStaticWidth", cropperStaticHeight: "cropperStaticHeight", canvasRotation: "canvasRotation", initialStepSize: "initialStepSize", roundCropper: "roundCropper", onlyScaleDown: "onlyScaleDown", imageQuality: "imageQuality", autoCrop: "autoCrop", backgroundColor: "backgroundColor", containWithinAspectRatio: "containWithinAspectRatio", hideResizeSquares: "hideResizeSquares", allowMoveImage: "allowMoveImage", cropper: "cropper", alignImage: "alignImage", disabled: "disabled", hidden: "hidden" }, outputs: { imageCropped: "imageCropped", startCropImage: "startCropImage", imageLoaded: "imageLoaded", cropperReady: "cropperReady", loadImageFailed: "loadImageFailed", transformChange: "transformChange" }, host: { listeners: { "window:resize": "onResize()" }, properties: { "hostID": "this.hostID", "style.text-align": "this.alignImage", "class.disabled": "this.disabled", "class.ngx-ix-hidden": "this.hidden" } }, viewQueries: [{ propertyName: "wrapper", first: true, predicate: ["wrapper"], descendants: true, static: true }, { propertyName: "sourceImage", first: true, predicate: ["sourceImage"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n  [style.background]=\"imageVisible && backgroundColor\"\n  #wrapper\n  >\n  @if (safeImgDataUrl) {\n    <img\n      #sourceImage\n      class=\"ngx-ic-source-image\"\n      role=\"presentation\"\n      [src]=\"safeImgDataUrl\"\n      [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n      [style.transform]=\"safeTransformStyle\"\n      [class.ngx-ic-draggable]=\"!disabled && allowMoveImage\"\n      [attr.alt]=\"imageAltText\"\n      (load)=\"imageLoadedInView()\"\n      (mousedown)=\"startMove($event, moveTypes.Drag)\"\n      (touchstart)=\"startMove($event, moveTypes.Drag)\"\n      (error)=\"loadImageError($event)\"\n      >\n  }\n  <div\n    class=\"ngx-ic-overlay\"\n    [style.width.px]=\"maxSize.width\"\n    [style.height.px]=\"maxSize.height\"\n    [style.margin-left]=\"alignImage === 'center' ? marginLeft : null\"\n  ></div>\n  @if (imageVisible) {\n    <div class=\"ngx-ic-cropper\"\n      [class.ngx-ic-round]=\"roundCropper\"\n      [attr.aria-label]=\"cropperFrameAriaLabel\"\n      [style.top.px]=\"cropper.y1\"\n      [style.left.px]=\"cropper.x1\"\n      [style.width.px]=\"cropper.x2 - cropper.x1\"\n      [style.height.px]=\"cropper.y2 - cropper.y1\"\n      [style.margin-left]=\"alignImage === 'center' ? marginLeft : null\"\n      [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n      (keydown)=\"keyboardAccess($event)\"\n      tabindex=\"0\"\n      >\n      <div\n        (mousedown)=\"startMove($event, moveTypes.Move)\"\n        (touchstart)=\"startMove($event, moveTypes.Move)\"\n        class=\"ngx-ic-move\"\n        role=\"presentation\">\n      </div>\n      @if (!hideResizeSquares) {\n        <span class=\"ngx-ic-resize ngx-ic-topleft\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'topleft')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'topleft')\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-top\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-topright\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'topright')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'topright')\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-right\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-bottomright\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomright')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomright')\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-bottom\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-bottomleft\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomleft')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomleft')\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-left\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize-bar ngx-ic-top\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'top')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'top')\">\n        </span>\n        <span class=\"ngx-ic-resize-bar ngx-ic-right\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'right')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'right')\">\n        </span>\n        <span class=\"ngx-ic-resize-bar ngx-ic-bottom\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'bottom')\">\n        </span>\n        <span class=\"ngx-ic-resize-bar ngx-ic-left\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'left')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'left')\">\n        </span>\n      }\n    </div>\n  }\n</div>\n", styles: [":host{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}:host>div{width:100%;position:relative}:host>div img.ngx-ic-source-image{max-width:100%;max-height:100%;transform-origin:center}:host>div img.ngx-ic-source-image.ngx-ic-draggable{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}:host .ngx-ic-overlay{position:absolute;pointer-events:none;touch-action:none;outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}:host .ngx-ic-cropper{position:absolute;display:flex;color:#53535c;background:transparent;outline:rgba(255,255,255,.3) solid 100vw;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media(orientation:portrait){:host .ngx-ic-cropper{outline-width:100vh}}:host .ngx-ic-cropper:after{position:absolute;content:\"\";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}:host .ngx-ic-cropper .ngx-ic-move{width:100%;cursor:move;border:1px solid rgba(255,255,255,.5)}:host .ngx-ic-cropper:focus .ngx-ic-move{border-color:#1e90ff;border-width:2px}:host .ngx-ic-cropper .ngx-ic-resize{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize .ngx-ic-square{display:inline-block;background:#53535c;width:6px;height:6px;border:1px solid rgba(255,255,255,.5);box-sizing:content-box}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topleft{top:-12px;left:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-top{top:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topright{top:-12px;right:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-right{top:calc(50% - 12px);right:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomright{bottom:-12px;right:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottom{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomleft{bottom:-12px;left:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-left{top:calc(50% - 12px);left:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar{position:absolute;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-top{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-right{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-bottom{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-left{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper.ngx-ic-round{outline-color:transparent}:host .ngx-ic-cropper.ngx-ic-round:after{border-radius:100%;box-shadow:0 0 0 100vw #ffffff4d;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media(orientation:portrait){:host .ngx-ic-cropper.ngx-ic-round:after{box-shadow:0 0 0 100vh #ffffff4d;box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}:host .ngx-ic-cropper.ngx-ic-round .ngx-ic-move{border-radius:100%}:host.disabled .ngx-ic-cropper .ngx-ic-resize,:host.disabled .ngx-ic-cropper .ngx-ic-resize-bar,:host.disabled .ngx-ic-cropper .ngx-ic-move{display:none}:host.ngx-ix-hidden{display:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ImageCropperComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-cropper', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div\n  [style.background]=\"imageVisible && backgroundColor\"\n  #wrapper\n  >\n  @if (safeImgDataUrl) {\n    <img\n      #sourceImage\n      class=\"ngx-ic-source-image\"\n      role=\"presentation\"\n      [src]=\"safeImgDataUrl\"\n      [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n      [style.transform]=\"safeTransformStyle\"\n      [class.ngx-ic-draggable]=\"!disabled && allowMoveImage\"\n      [attr.alt]=\"imageAltText\"\n      (load)=\"imageLoadedInView()\"\n      (mousedown)=\"startMove($event, moveTypes.Drag)\"\n      (touchstart)=\"startMove($event, moveTypes.Drag)\"\n      (error)=\"loadImageError($event)\"\n      >\n  }\n  <div\n    class=\"ngx-ic-overlay\"\n    [style.width.px]=\"maxSize.width\"\n    [style.height.px]=\"maxSize.height\"\n    [style.margin-left]=\"alignImage === 'center' ? marginLeft : null\"\n  ></div>\n  @if (imageVisible) {\n    <div class=\"ngx-ic-cropper\"\n      [class.ngx-ic-round]=\"roundCropper\"\n      [attr.aria-label]=\"cropperFrameAriaLabel\"\n      [style.top.px]=\"cropper.y1\"\n      [style.left.px]=\"cropper.x1\"\n      [style.width.px]=\"cropper.x2 - cropper.x1\"\n      [style.height.px]=\"cropper.y2 - cropper.y1\"\n      [style.margin-left]=\"alignImage === 'center' ? marginLeft : null\"\n      [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n      (keydown)=\"keyboardAccess($event)\"\n      tabindex=\"0\"\n      >\n      <div\n        (mousedown)=\"startMove($event, moveTypes.Move)\"\n        (touchstart)=\"startMove($event, moveTypes.Move)\"\n        class=\"ngx-ic-move\"\n        role=\"presentation\">\n      </div>\n      @if (!hideResizeSquares) {\n        <span class=\"ngx-ic-resize ngx-ic-topleft\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'topleft')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'topleft')\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-top\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-topright\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'topright')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'topright')\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-right\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-bottomright\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomright')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomright')\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-bottom\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-bottomleft\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomleft')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomleft')\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize ngx-ic-left\">\n          <span class=\"ngx-ic-square\"></span>\n        </span>\n        <span class=\"ngx-ic-resize-bar ngx-ic-top\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'top')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'top')\">\n        </span>\n        <span class=\"ngx-ic-resize-bar ngx-ic-right\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'right')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'right')\">\n        </span>\n        <span class=\"ngx-ic-resize-bar ngx-ic-bottom\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'bottom')\">\n        </span>\n        <span class=\"ngx-ic-resize-bar ngx-ic-left\"\n          role=\"presentation\"\n          (mousedown)=\"startMove($event, moveTypes.Resize, 'left')\"\n          (touchstart)=\"startMove($event, moveTypes.Resize, 'left')\">\n        </span>\n      }\n    </div>\n  }\n</div>\n", styles: [":host{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}:host>div{width:100%;position:relative}:host>div img.ngx-ic-source-image{max-width:100%;max-height:100%;transform-origin:center}:host>div img.ngx-ic-source-image.ngx-ic-draggable{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}:host .ngx-ic-overlay{position:absolute;pointer-events:none;touch-action:none;outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}:host .ngx-ic-cropper{position:absolute;display:flex;color:#53535c;background:transparent;outline:rgba(255,255,255,.3) solid 100vw;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media(orientation:portrait){:host .ngx-ic-cropper{outline-width:100vh}}:host .ngx-ic-cropper:after{position:absolute;content:\"\";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}:host .ngx-ic-cropper .ngx-ic-move{width:100%;cursor:move;border:1px solid rgba(255,255,255,.5)}:host .ngx-ic-cropper:focus .ngx-ic-move{border-color:#1e90ff;border-width:2px}:host .ngx-ic-cropper .ngx-ic-resize{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize .ngx-ic-square{display:inline-block;background:#53535c;width:6px;height:6px;border:1px solid rgba(255,255,255,.5);box-sizing:content-box}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topleft{top:-12px;left:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-top{top:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topright{top:-12px;right:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-right{top:calc(50% - 12px);right:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomright{bottom:-12px;right:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottom{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomleft{bottom:-12px;left:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-left{top:calc(50% - 12px);left:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar{position:absolute;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-top{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-right{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-bottom{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-left{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper.ngx-ic-round{outline-color:transparent}:host .ngx-ic-cropper.ngx-ic-round:after{border-radius:100%;box-shadow:0 0 0 100vw #ffffff4d;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media(orientation:portrait){:host .ngx-ic-cropper.ngx-ic-round:after{box-shadow:0 0 0 100vh #ffffff4d;box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}:host .ngx-ic-cropper.ngx-ic-round .ngx-ic-move{border-radius:100%}:host.disabled .ngx-ic-cropper .ngx-ic-resize,:host.disabled .ngx-ic-cropper .ngx-ic-resize-bar,:host.disabled .ngx-ic-cropper .ngx-ic-move{display:none}:host.ngx-ix-hidden{display:none}\n"] }]
        }], ctorParameters: () => [{ type: CropService }, { type: CropperPositionService }, { type: LoadImageService }, { type: i1.DomSanitizer }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
                    type: Optional
                }, {
                    type: Inject,
                    args: [HAMMER_LOADER]
                }] }], propDecorators: { hostID: [{
                type: HostBinding,
                args: ['hostID']
            }], wrapper: [{
                type: ViewChild,
                args: ['wrapper', { static: true }]
            }], sourceImage: [{
                type: ViewChild,
                args: ['sourceImage', { static: false }]
            }], imageChangedEvent: [{
                type: Input
            }], imageURL: [{
                type: Input
            }], imageBase64: [{
                type: Input
            }], imageFile: [{
                type: Input
            }], imageAltText: [{
                type: Input
            }], cropperFrameAriaLabel: [{
                type: Input
            }], output: [{
                type: Input
            }], format: [{
                type: Input
            }], transform: [{
                type: Input
            }], maintainAspectRatio: [{
                type: Input
            }], aspectRatio: [{
                type: Input
            }], resetCropOnAspectRatioChange: [{
                type: Input
            }], resizeToWidth: [{
                type: Input
            }], resizeToHeight: [{
                type: Input
            }], cropperMinWidth: [{
                type: Input
            }], cropperMinHeight: [{
                type: Input
            }], cropperMaxHeight: [{
                type: Input
            }], cropperMaxWidth: [{
                type: Input
            }], cropperStaticWidth: [{
                type: Input
            }], cropperStaticHeight: [{
                type: Input
            }], canvasRotation: [{
                type: Input
            }], initialStepSize: [{
                type: Input
            }], roundCropper: [{
                type: Input
            }], onlyScaleDown: [{
                type: Input
            }], imageQuality: [{
                type: Input
            }], autoCrop: [{
                type: Input
            }], backgroundColor: [{
                type: Input
            }], containWithinAspectRatio: [{
                type: Input
            }], hideResizeSquares: [{
                type: Input
            }], allowMoveImage: [{
                type: Input
            }], cropper: [{
                type: Input
            }], alignImage: [{
                type: HostBinding,
                args: ['style.text-align']
            }, {
                type: Input
            }], disabled: [{
                type: HostBinding,
                args: ['class.disabled']
            }, {
                type: Input
            }], hidden: [{
                type: HostBinding,
                args: ['class.ngx-ix-hidden']
            }, {
                type: Input
            }], imageCropped: [{
                type: Output
            }], startCropImage: [{
                type: Output
            }], imageLoaded: [{
                type: Output
            }], cropperReady: [{
                type: Output
            }], loadImageFailed: [{
                type: Output
            }], transformChange: [{
                type: Output
            }], onResize: [{
                type: HostListener,
                args: ['window:resize']
            }] } });

function provideParentForm(form) {
    return form;
}
class ProvideParentFormDirective {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ProvideParentFormDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: ProvideParentFormDirective, isStandalone: false, selector: "[provideParentForm]", providers: [{ provide: ControlContainer, useFactory: provideParentForm, deps: [NgForm] }], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ProvideParentFormDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[provideParentForm]',
                    providers: [{ provide: ControlContainer, useFactory: provideParentForm, deps: [NgForm] }],
                    standalone: false
                }]
        }] });

class CoreBaseModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreBaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreBaseModule, declarations: [ProvideParentFormDirective], imports: [CommonModule,
            FormsModule,
            ReactiveFormsModule,
            RouterModule,
            NgScrollbarModule,
            NgScrollReached,
            CdkTableModule], exports: [CommonModule,
            FormsModule,
            ReactiveFormsModule,
            RouterModule,
            NgScrollbarModule,
            NgScrollReached,
            CdkTableModule,
            ProvideParentFormDirective] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreBaseModule, providers: [
            provideHttpClient(withInterceptorsFromDi())
        ], imports: [CommonModule,
            FormsModule,
            ReactiveFormsModule,
            RouterModule,
            NgScrollbarModule,
            CdkTableModule, CommonModule,
            FormsModule,
            ReactiveFormsModule,
            RouterModule,
            NgScrollbarModule,
            CdkTableModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreBaseModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        ProvideParentFormDirective
                    ],
                    exports: [
                        CommonModule,
                        FormsModule,
                        ReactiveFormsModule,
                        RouterModule,
                        NgScrollbarModule,
                        NgScrollReached,
                        CdkTableModule,
                        ProvideParentFormDirective
                    ],
                    imports: [
                        CommonModule,
                        FormsModule,
                        ReactiveFormsModule,
                        RouterModule,
                        NgScrollbarModule,
                        NgScrollReached,
                        CdkTableModule
                    ],
                    providers: [
                        provideHttpClient(withInterceptorsFromDi())
                    ]
                }]
        }] });

/** Injection token that determines the scroll handling while the timepicker is open. */
const MAT_TIMEPICKER_SCROLL_STRATEGY = new InjectionToken('mat-timepicker-scroll-strategy');
/** Timepicker scroll strategy factory. */
function MAT_TIMEPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
    return () => overlay.scrollStrategies.reposition();
}
/** Timepicker scroll strategy provider. */
const MAT_TIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
    provide: MAT_TIMEPICKER_SCROLL_STRATEGY,
    deps: [Overlay],
    useFactory: MAT_TIMEPICKER_SCROLL_STRATEGY_FACTORY,
};

/** InjectionToken for timepicker that can be used to override default locale code. */
const MAT_TIME_LOCALE = new InjectionToken('MAT_TIME_LOCALE', {
    providedIn: 'root',
    factory: MAT_DATE_TIME_LOCALE_FACTORY,
});
function MAT_DATE_TIME_LOCALE_FACTORY() {
    return inject(LOCALE_ID);
}
/**
 * No longer needed since MAT_TIME_LOCALE has been changed to a scoped injectable.
 * If you are importing and providing this in your code you can simply remove it.
 * @deprecated
 * @breaking-change 18.0.0
 */
const MAT_TIME_LOCALE_PROVIDER = {
    provide: MAT_TIME_LOCALE,
    useExisting: LOCALE_ID,
};
class TimeAdapter {
    /**
     * Given a potential time object, returns that same time object if it is
     * a valid time, or `null` if it's not a valid time.
     * @param obj The object to check.
     * @returns A time or `null`.
     */
    getValidTimeOrNull(obj) {
        return this.isTimeInstance(obj) && this.isValid(obj)
            ? obj
            : null;
    }
    /**
     * Attempts to deserialize a value to a valid time object. The `<mat-timepicker>` will call this
     * method on all of its `@Input()` properties that accept time. It is therefore possible to
     * support passing values from your backend directly to these properties by overriding this method
     * to also deserialize the format used by your backend.
     * @param value The value to be deserialized into a time object.
     * @returns The deserialized time object, either a valid time, null if the value can be
     *     deserialized into a null time (e.g. the empty string), or an invalid date.
     */
    deserialize(value) {
        if (value == null || (this.isTimeInstance(value) && this.isValid(value))) {
            return value;
        }
        return this.invalid();
    }
    /**
     * Sets the locale used for all time.
     * @param locale The new locale.
     */
    setLocale(locale) {
        this.locale = locale;
    }
    /**
     * Checks if two time are equal.
     * @param first The first time to check.
     * @param second The second time to check.
     * @returns Whether the two time are equal.
     *     Null time are considered equal to other null time.
     */
    sameTime(first, second) {
        if (first && second) {
            let firstValid = this.isValid(first);
            let secondValid = this.isValid(second);
            if (firstValid && secondValid) {
                return !this.compareTime(first, second);
            }
            return firstValid == secondValid;
        }
        return first == second;
    }
    /**
     * Clamp the given time between min and max time.
     * @param time The time to clamp.
     * @param min The minimum value to allow. If null or omitted no min is enforced.
     * @param max The maximum value to allow. If null or omitted no max is enforced.
     * @returns `min` if `time` is less than `min`, `max` if time is greater than `max`,
     *     otherwise `time`.
     */
    clampTime(time, min, max) {
        if (min && this.compareTime(time, min) < 0) {
            return min;
        }
        if (max && this.compareTime(time, max) > 0) {
            return max;
        }
        return time;
    }
}

/**
 * Matches strings that have the form of a valid RFC 3339 string
 * (https://tools.ietf.org/html/rfc3339). Note that the string may not actually be a valid date
 * because the regex will match strings an with out of bounds month, date, etc.
 */
const ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
/** Adapts the native JS Date for components that work with time. */
class NativeDateTimeAdapter extends TimeAdapter {
    constructor(matTimeLocale) {
        super();
        this._matTimeLocale = inject(MAT_TIME_LOCALE, { optional: true });
        if (matTimeLocale !== undefined) {
            this._matTimeLocale = matTimeLocale;
        }
        super.setLocale(this._matTimeLocale);
    }
    now() {
        return new Date();
    }
    parse(value, parseFormat) {
        // We have no way using the native JS Date to set the parse format or locale, so we ignore these
        // parameters.
        if (typeof value == 'number') {
            return new Date(value);
        }
        const { hour, minute, meridiem } = this.parseTime(value);
        // hour should be in 24h format
        // so, if meridiem is 'pm' and hour is less than 12, add 12 to hour
        const correctedHour = meridiem === 'pm' && hour < 12 ? hour + 12 : hour;
        const date = new Date();
        date.setHours(correctedHour);
        date.setMinutes(minute);
        return value ? new Date(date) : null;
    }
    parseTime(value) {
        const time = value.replace(/(\sam|\spm|\sAM|\sPM|am|pm|AM|PM)/g, '');
        const meridiem = value.replace(time, '').trim().toLowerCase();
        const [hour, minute] = time.split(':');
        return { hour: Number(hour), minute: Number(minute), meridiem };
    }
    getHour(date) {
        return date.getHours();
    }
    getMinute(date) {
        return date.getMinutes();
    }
    updateHour(date, hour) {
        const copy = new Date(date.getTime());
        copy.setHours(hour);
        return copy;
    }
    updateMinute(date, minute) {
        const copy = new Date(date.getTime());
        copy.setMinutes(minute);
        return copy;
    }
    getPeriod(date) {
        return date.getHours() < 12 ? 'am' : 'pm';
    }
    format(date, displayFormat) {
        if (!this.isValid(date)) {
            throw Error('NativeDateTimeAdapter: Cannot format invalid date.');
        }
        const dtf = new Intl.DateTimeFormat(this.locale, {
            ...displayFormat,
            timeZone: 'utc',
        });
        return this._format(dtf, date);
    }
    /**
     * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
     * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
     * invalid date for all other values.
     */
    deserialize(value) {
        if (typeof value === 'string') {
            if (!value) {
                return null;
            }
            // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the
            // string is the right format first.
            if (ISO_8601_REGEX.test(value)) {
                const date = new Date(value);
                if (this.isValid(date)) {
                    return date;
                }
            }
        }
        return super.deserialize(value);
    }
    isTimeInstance(obj) {
        return obj instanceof Date;
    }
    isValid(date) {
        return !isNaN(date.getTime());
    }
    invalid() {
        return new Date(NaN);
    }
    compareTime(first, second) {
        return (first.getHours() - second.getHours() ||
            first.getMinutes() - second.getMinutes());
    }
    /**
     * When converting Date object to string, javascript built-in functions may return wrong
     * results because it applies its internal DST rules. The DST rules around the world change
     * very frequently, and the current valid rule is not always valid in previous years though.
     * We work around this problem building a new Date object which has its internal UTC
     * representation with the local date and time.
     * @param dtf Intl.DateTimeFormat object, containing the desired string format. It must have
     *    timeZone set to 'utc' to work fine.
     * @param date Date from which we want to get the string representation according to dtf
     * @returns A Date object with its UTC representation based on the passed in date info
     */
    _format(dtf, date) {
        // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.
        // To work around this we use `setUTCFullYear` and `setUTCHours` instead.
        const d = new Date();
        d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());
        d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
        return dtf.format(d);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NativeDateTimeAdapter, deps: [{ token: MAT_TIME_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NativeDateTimeAdapter }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NativeDateTimeAdapter, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Optional
                }, {
                    type: Inject,
                    args: [MAT_TIME_LOCALE]
                }] }] });

class NativeDateTimeModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NativeDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: NativeDateTimeModule, imports: [PlatformModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NativeDateTimeModule, providers: [{ provide: TimeAdapter, useClass: NativeDateTimeAdapter }], imports: [PlatformModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NativeDateTimeModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [PlatformModule],
                    providers: [{ provide: TimeAdapter, useClass: NativeDateTimeAdapter }],
                }]
        }] });
class MatNativeDateTimeModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatNativeDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: MatNativeDateTimeModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatNativeDateTimeModule, providers: [provideNativeDateTimeAdapter()] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatNativeDateTimeModule, decorators: [{
            type: NgModule,
            args: [{
                    providers: [provideNativeDateTimeAdapter()],
                }]
        }] });
function provideNativeDateTimeAdapter() {
    return { provide: TimeAdapter, useClass: NativeDateTimeAdapter };
}

/**
 * A selection model containing a time selection.
 */
class MatTimeSelectionModel {
    /**
     * Updates the current selection in the model.
     * @param value New selection that should be assigned.
     * @param source Object that triggered the selection change.
     */
    updateSelection(value, source) {
        const oldValue = this.selection;
        this.selection = value;
        this._selectionChanged.next({ selection: value, source, oldValue });
    }
    constructor(_adapter) {
        this._adapter = _adapter;
        this._selectionChanged = new Subject();
        /** Emits when the selection has changed. */
        this.selectionChanged = this._selectionChanged;
        // this.selection = selection;
    }
    ngOnDestroy() {
        this._selectionChanged.complete();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeSelectionModel, deps: [{ token: TimeAdapter }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeSelectionModel }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeSelectionModel, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: TimeAdapter }] });
/**
 * A selection model that contains a single time.
 */
class MatSingleTimeSelectionModel extends MatTimeSelectionModel {
    constructor(adapter) {
        super(adapter);
    }
    /**
     * Adds a time to the current selection. In the case of a single time selection, the added time
     * simply overwrites the previous selection
     */
    add(time) {
        super.updateSelection(time, this);
    }
    /** Clones the selection model. */
    clone() {
        const clone = new MatSingleTimeSelectionModel(this._adapter);
        clone.updateSelection(this.selection, this);
        return clone;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatSingleTimeSelectionModel, deps: [{ token: TimeAdapter }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatSingleTimeSelectionModel }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatSingleTimeSelectionModel, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: TimeAdapter }] });
function MAT_SINGLE_TIME_SELECTION_MODEL_FACTORY(parent, adapter) {
    return parent || new MatSingleTimeSelectionModel(adapter);
}
/**
 * Used to provide a single selection model to a component.
 */
const MAT_SINGLE_TIME_SELECTION_MODEL_PROVIDER = {
    provide: MatTimeSelectionModel,
    deps: [
        [new Optional(), new SkipSelf(), MatSingleTimeSelectionModel],
        TimeAdapter,
    ],
    useFactory: MAT_SINGLE_TIME_SELECTION_MODEL_FACTORY,
};

class MatTimepickerIntl {
    constructor() {
        /** A label for inputs title. */
        this.inputsTitle = 'Указать время';
        /** A label for dials title. */
        this.dialsTitle = 'Выбрать время';
        /** A label for hour input hint. */
        this.hourInputHint = 'Часы';
        /** A label for minute input hint. */
        this.minuteInputHint = 'Минуты';
        /** Label for the button used to open the timepicker popup (used by screen readers). */
        this.openTimepickerLabel = 'Open timepicker';
        /** Label for the button used to close the timepicker popup (used by screen readers). */
        this.closeTimepickerLabel = 'Close timepicker';
        /** A label for OK button to apply time. */
        this.okButton = 'Выбрать';
        /** A label for cancel button to close timepicker. */
        this.cancelButton = 'Отмена';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerIntl, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerIntl, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

const ALL_MINUTES = Array(60)
    .fill(null)
    .map((_, i) => i);
const CLOCK_RADIUS$1 = 128;
const CLOCK_TICK_RADIUS$1 = 16;
const CLOCK_CORRECTED_RADIUS$1 = CLOCK_RADIUS$1 - CLOCK_TICK_RADIUS$1;
const CLOCK_OUTER_RADIUS$1 = 100;
class MatMinutesClockDial {
    /** Selected minute. */
    get selectedMinute() {
        return this._selectedMinute;
    }
    set selectedMinute(value) {
        this._selectedMinute = value;
    }
    /** Step over minutes. */
    get interval() {
        return this._interval;
    }
    set interval(value) {
        this._interval = coerceNumberProperty(value) || 1;
    }
    get availableMinutes() {
        return this._availableMinutes;
    }
    set availableMinutes(value) {
        this._availableMinutes = value;
        this._initMinutes();
    }
    get disabled() {
        return !this.availableMinutes.includes(this.selectedMinute);
    }
    get isMinutePoint() {
        return !!this.minutes.find((hour) => hour.value === this.selectedMinute);
    }
    constructor(_element, _cdr, _document, _window) {
        this._element = _element;
        this._cdr = _cdr;
        this._document = _document;
        this._window = _window;
        this._selectedMinute = 0;
        this._interval = 1;
        this._availableMinutes = [];
        /** Emits selected minute. */
        this.selectedChange = new EventEmitter();
        this.minutes = [];
    }
    ngOnInit() {
        this._initMinutes();
    }
    /** Hand styles based on selected minute. */
    _handStyles() {
        const deg = Math.round(this._selectedMinute * (360 / 60));
        const height = CLOCK_OUTER_RADIUS$1;
        const marginTop = CLOCK_RADIUS$1 - CLOCK_OUTER_RADIUS$1;
        return {
            transform: `rotate(${deg}deg)`,
            height: `${height}px`,
            'margin-top': `${marginTop}px`,
        };
    }
    /** Handles mouse and touch events on dial and document. */
    _onUserAction(event) {
        if (event.cancelable) {
            event.preventDefault();
        }
        this._setMinute(event);
        const eventsSubscription = merge(fromEvent(this._document, 'mousemove'), fromEvent(this._document, 'touchmove'))
            .pipe(debounceTime(0))
            .subscribe({
            next: (event) => {
                event.preventDefault();
                this._setMinute(event);
            },
        });
        merge(fromEvent(this._document, 'mouseup'), fromEvent(this._document, 'touchend'))
            .pipe(take(1))
            .subscribe({
            next: () => {
                eventsSubscription.unsubscribe();
            },
        });
    }
    _isActiveCell(minute) {
        return this.selectedMinute === minute;
    }
    _trackBy(index, cell) {
        return cell.value;
    }
    _setMinute(event) {
        const element = this._element.nativeElement;
        const elementRect = element.getBoundingClientRect();
        const width = element.offsetWidth;
        const height = element.offsetHeight;
        const pageX = event instanceof MouseEvent ? event.pageX : event.touches[0].pageX;
        const pageY = event instanceof MouseEvent ? event.pageY : event.touches[0].pageY;
        const x = width / 2 - (pageX - elementRect.left - this._window.scrollX);
        const y = height / 2 - (pageY - elementRect.top - this._window.scrollY);
        const unit = Math.PI / (30 / this.interval);
        const atan2 = Math.atan2(-x, y);
        const radian = atan2 < 0 ? Math.PI * 2 + atan2 : atan2;
        const initialValue = Math.round(radian / unit) * this.interval;
        const value = initialValue === 60 ? 0 : initialValue;
        if (this.availableMinutes.includes(value) &&
            this.availableMinutes.includes(value)) {
            this.selectedMinute = value;
            this.selectedChange.emit(this.selectedMinute);
        }
        this._cdr.detectChanges();
    }
    /** Creates list of minutes. */
    _initMinutes() {
        this.minutes = ALL_MINUTES.filter((minute) => minute % 5 === 0).map((minute) => {
            const radian = (minute / 30) * Math.PI;
            const displayValue = minute === 0 ? '00' : String(minute);
            return {
                value: minute,
                displayValue,
                left: CLOCK_CORRECTED_RADIUS$1 + Math.sin(radian) * CLOCK_OUTER_RADIUS$1,
                top: CLOCK_CORRECTED_RADIUS$1 - Math.cos(radian) * CLOCK_OUTER_RADIUS$1,
                disabled: !this.availableMinutes.includes(minute),
            };
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatMinutesClockDial, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }, { token: Window }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: MatMinutesClockDial, isStandalone: false, selector: "mat-minutes-clock-dial", inputs: { selectedMinute: "selectedMinute", interval: "interval", availableMinutes: "availableMinutes", color: "color" }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "mousedown": "_onUserAction($event)", "touchstart": "_onUserAction($event)" }, classAttribute: "mat-clock-dial mat-clock-dial-minutes" }, exportAs: ["matMinutesClockDial"], ngImport: i0, template: "<div\n  class=\"mat-clock-dial-hand\"\n  [class.mat-clock-dial-hand-pointless]=\"isMinutePoint\"\n  [class.mat-clock-dial-hand-disabled]=\"disabled\"\n  [ngStyle]=\"_handStyles()\"\n  >\n  <div class=\"mat-clock-dial-hand-point\" tabindex=\"0\"></div>\n</div>\n@for (minute of minutes; track _trackBy($index, minute)) {\n  <button\n    class=\"mat-clock-dial-cell\"\n    mat-mini-fab\n    disableRipple\n    [tabIndex]=\"_isActiveCell(minute.value) ? 0 : -1\"\n    [style.left.px]=\"minute.left\"\n    [style.top.px]=\"minute.top\"\n    [class.mat-clock-dial-cell-active]=\"_isActiveCell(minute.value)\"\n    [class.mat-clock-dial-cell-disabled]=\"minute.disabled\"\n    [color]=\"_isActiveCell(minute.value) ? color : undefined\"\n    [attr.aria-disabled]=\"minute.disabled || null\"\n    >\n    {{ minute.displayValue }}\n  </button>\n}\n", styles: [".mat-clock-dial{position:relative;display:block;width:16rem;height:16rem;margin:0 auto;border-radius:50%;background:#f8f9fb}.mat-clock-dial:before{position:absolute;top:50%;left:50%;width:.4375rem;height:.4375rem;border-radius:50%;transform:translate(-50%,-50%);content:\"\"}[mat-mini-fab].mat-clock-dial-cell{position:absolute;display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:50%;box-shadow:none}[mat-mini-fab].mat-clock-dial-cell:disabled{pointer-events:none}[mat-mini-fab].mat-clock-dial-cell:focus,[mat-mini-fab].mat-clock-dial-cell:hover,[mat-mini-fab].mat-clock-dial-cell:active,[mat-mini-fab].mat-clock-dial-cell:focus:active{box-shadow:none}.mat-clock-dial-hand{position:absolute;inset:0;width:2px;margin:0 auto;transform-origin:bottom}.mat-clock-dial-hand:before{position:absolute;top:-.25rem;left:-.25rem;width:calc(.5rem + 1px);height:calc(.5rem + 1px);border-radius:50%;content:\"\"}.mat-clock-dial-hand.mat-clock-dial-hand-pointless:before{content:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2.MatMiniFabButton, selector: "button[mat-mini-fab], a[mat-mini-fab], button[matMiniFab], a[matMiniFab]", exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatMinutesClockDial, decorators: [{
            type: Component,
            args: [{ selector: 'mat-minutes-clock-dial', exportAs: 'matMinutesClockDial', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'mat-clock-dial mat-clock-dial-minutes',
                        '(mousedown)': '_onUserAction($event)',
                        '(touchstart)': '_onUserAction($event)',
                    }, standalone: false, template: "<div\n  class=\"mat-clock-dial-hand\"\n  [class.mat-clock-dial-hand-pointless]=\"isMinutePoint\"\n  [class.mat-clock-dial-hand-disabled]=\"disabled\"\n  [ngStyle]=\"_handStyles()\"\n  >\n  <div class=\"mat-clock-dial-hand-point\" tabindex=\"0\"></div>\n</div>\n@for (minute of minutes; track _trackBy($index, minute)) {\n  <button\n    class=\"mat-clock-dial-cell\"\n    mat-mini-fab\n    disableRipple\n    [tabIndex]=\"_isActiveCell(minute.value) ? 0 : -1\"\n    [style.left.px]=\"minute.left\"\n    [style.top.px]=\"minute.top\"\n    [class.mat-clock-dial-cell-active]=\"_isActiveCell(minute.value)\"\n    [class.mat-clock-dial-cell-disabled]=\"minute.disabled\"\n    [color]=\"_isActiveCell(minute.value) ? color : undefined\"\n    [attr.aria-disabled]=\"minute.disabled || null\"\n    >\n    {{ minute.displayValue }}\n  </button>\n}\n", styles: [".mat-clock-dial{position:relative;display:block;width:16rem;height:16rem;margin:0 auto;border-radius:50%;background:#f8f9fb}.mat-clock-dial:before{position:absolute;top:50%;left:50%;width:.4375rem;height:.4375rem;border-radius:50%;transform:translate(-50%,-50%);content:\"\"}[mat-mini-fab].mat-clock-dial-cell{position:absolute;display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:50%;box-shadow:none}[mat-mini-fab].mat-clock-dial-cell:disabled{pointer-events:none}[mat-mini-fab].mat-clock-dial-cell:focus,[mat-mini-fab].mat-clock-dial-cell:hover,[mat-mini-fab].mat-clock-dial-cell:active,[mat-mini-fab].mat-clock-dial-cell:focus:active{box-shadow:none}.mat-clock-dial-hand{position:absolute;inset:0;width:2px;margin:0 auto;transform-origin:bottom}.mat-clock-dial-hand:before{position:absolute;top:-.25rem;left:-.25rem;width:calc(.5rem + 1px);height:calc(.5rem + 1px);border-radius:50%;content:\"\"}.mat-clock-dial-hand.mat-clock-dial-hand-pointless:before{content:none}\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: Document, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }, { type: Window, decorators: [{
                    type: Inject,
                    args: [Window]
                }] }], propDecorators: { selectedMinute: [{
                type: Input
            }], interval: [{
                type: Input
            }], availableMinutes: [{
                type: Input
            }], color: [{
                type: Input
            }], selectedChange: [{
                type: Output
            }] } });

const ALL_HOURS = Array(24)
    .fill(null)
    .map((_, i) => i);
const CLOCK_RADIUS = 128;
const CLOCK_TICK_RADIUS = 16;
const CLOCK_CORRECTED_RADIUS = CLOCK_RADIUS - CLOCK_TICK_RADIUS;
const CLOCK_OUTER_RADIUS = 100;
const CLOCK_INNER_RADIUS = CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS * 2;
class MatHoursClockDial {
    /** Selected hour. */
    get selectedHour() {
        return this._selectedHour;
    }
    set selectedHour(value) {
        this._selectedHour = value;
    }
    /** Whether the clock uses 12 hour format. */
    get isMeridiem() {
        return this._isMeridiem;
    }
    set isMeridiem(value) {
        this._isMeridiem = value;
    }
    get availableHours() {
        return this._availableHours;
    }
    set availableHours(value) {
        this._availableHours = value;
        this._initHours();
    }
    get disabledHand() {
        return !this.availableHours.includes(this.selectedHour);
    }
    get isHour() {
        return !!this.hours.find((hour) => hour.value === this.selectedHour);
    }
    constructor(_element, _cdr, _document, _window) {
        this._element = _element;
        this._cdr = _cdr;
        this._document = _document;
        this._window = _window;
        this._availableHours = [];
        /** Emits selected hour. */
        this.selectedChange = new EventEmitter();
        this.hours = [];
    }
    ngOnInit() {
        this._initHours();
    }
    /** Hand styles based on selected hour. */
    _handStyles() {
        const deg = Math.round(this.selectedHour * (360 / (24 / 2)));
        const radius = this._getRadius(this.selectedHour);
        const height = radius;
        const marginTop = CLOCK_RADIUS - radius;
        return {
            transform: `rotate(${deg}deg)`,
            height: `${height}px`,
            'margin-top': `${marginTop}px`,
        };
    }
    /** Handles mouse and touch events on dial and document. */
    _onUserAction(event) {
        if (event.cancelable) {
            event.preventDefault();
        }
        this._setHour(event);
        const eventsSubscription = merge(fromEvent(this._document, 'mousemove'), fromEvent(this._document, 'touchmove'))
            .pipe(debounceTime(0))
            .subscribe({
            next: (event) => {
                event.preventDefault();
                this._setHour(event);
            },
        });
        merge(fromEvent(this._document, 'mouseup'), fromEvent(this._document, 'touchend'))
            .pipe(take(1))
            .subscribe({
            next: () => {
                eventsSubscription.unsubscribe();
                this.selectedChange.emit({
                    hour: this.selectedHour,
                    changeView: true,
                });
            },
        });
    }
    _isActiveCell(hour) {
        return this.selectedHour === hour;
    }
    _trackBy(index, cell) {
        return cell.value;
    }
    /** Changes selected hour based on coordinates. */
    _setHour(event) {
        const element = this._element.nativeElement;
        const elementRect = element.getBoundingClientRect();
        const width = element.offsetWidth;
        const height = element.offsetHeight;
        const pageX = event instanceof MouseEvent ? event.pageX : event.touches[0].pageX;
        const pageY = event instanceof MouseEvent ? event.pageY : event.touches[0].pageY;
        const x = width / 2 - (pageX - elementRect.left - this._window.scrollX);
        const y = height / 2 - (pageY - elementRect.top - this._window.scrollY);
        const unit = Math.PI / 6;
        const atan2 = Math.atan2(-x, y);
        const radian = atan2 < 0 ? Math.PI * 2 + atan2 : atan2;
        const initialValue = Math.round(radian / unit);
        const z = Math.sqrt(x * x + y * y);
        const outer = z > CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS;
        const value = this._getHourValue(initialValue, outer);
        if (this.availableHours.includes(value)) {
            this.selectedHour = value;
            this.selectedChange.emit({
                hour: this.selectedHour,
            });
        }
        this._cdr.detectChanges();
    }
    /** Return value of hour. */
    _getHourValue(value, outer) {
        const edgeValue = value === 0 || value === 12;
        if (this.isMeridiem) {
            return edgeValue ? 12 : value;
        }
        if (outer) {
            return edgeValue ? 0 : value;
        }
        return edgeValue ? 12 : value + 12;
    }
    /** Creates list of hours. */
    _initHours() {
        const initialHours = this.isMeridiem ? ALL_HOURS.slice(1, 13) : ALL_HOURS;
        this.hours = initialHours.map((hour) => {
            const radian = (hour / 6) * Math.PI;
            const radius = this._getRadius(hour);
            return {
                value: hour,
                displayValue: hour === 0 ? '00' : String(hour),
                left: CLOCK_CORRECTED_RADIUS + Math.sin(radian) * radius,
                top: CLOCK_CORRECTED_RADIUS - Math.cos(radian) * radius,
                disabled: !this.availableHours.includes(hour),
            };
        });
    }
    /** Returns radius based on hour */
    _getRadius(hour) {
        if (this.isMeridiem) {
            return CLOCK_OUTER_RADIUS;
        }
        const outer = hour >= 0 && hour < 12;
        const radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
        return radius;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatHoursClockDial, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }, { token: Window }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: MatHoursClockDial, isStandalone: false, selector: "mat-hours-clock-dial", inputs: { selectedHour: "selectedHour", isMeridiem: "isMeridiem", availableHours: "availableHours", color: "color" }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "mousedown": "_onUserAction($event)", "touchstart": "_onUserAction($event)" }, classAttribute: "mat-clock-dial mat-clock-dial-hours" }, exportAs: ["matHoursClockDial"], ngImport: i0, template: "<div\n  class=\"mat-clock-dial-hand\"\n  [class.mat-clock-dial-hand-pointless]=\"isHour\"\n  [class.mat-clock-dial-hand-disabled]=\"disabledHand\"\n  [ngStyle]=\"_handStyles()\"\n></div>\n@for (hour of hours; track _trackBy($index, hour)) {\n  <button\n    class=\"mat-clock-dial-cell\"\n    mat-mini-fab\n    disableRipple\n    [tabIndex]=\"_isActiveCell(hour.value) ? 0 : -1\"\n    [style.left.px]=\"hour.left\"\n    [style.top.px]=\"hour.top\"\n    [class.mat-clock-dial-cell-active]=\"_isActiveCell(hour.value)\"\n    [class.mat-clock-dial-cell-disabled]=\"hour.disabled\"\n    [color]=\"_isActiveCell(hour.value) ? color : undefined\"\n    [attr.aria-disabled]=\"hour.disabled || null\"\n    >\n    {{ hour.displayValue }}\n  </button>\n}\n", styles: [".mat-clock-dial{position:relative;display:block;width:16rem;height:16rem;margin:0 auto;border-radius:50%;background:#f8f9fb}.mat-clock-dial:before{position:absolute;top:50%;left:50%;width:.4375rem;height:.4375rem;border-radius:50%;transform:translate(-50%,-50%);content:\"\"}[mat-mini-fab].mat-clock-dial-cell{position:absolute;display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:50%;box-shadow:none}[mat-mini-fab].mat-clock-dial-cell:disabled{pointer-events:none}[mat-mini-fab].mat-clock-dial-cell:focus,[mat-mini-fab].mat-clock-dial-cell:hover,[mat-mini-fab].mat-clock-dial-cell:active,[mat-mini-fab].mat-clock-dial-cell:focus:active{box-shadow:none}.mat-clock-dial-hand{position:absolute;inset:0;width:2px;margin:0 auto;transform-origin:bottom}.mat-clock-dial-hand:before{position:absolute;top:-.25rem;left:-.25rem;width:calc(.5rem + 1px);height:calc(.5rem + 1px);border-radius:50%;content:\"\"}.mat-clock-dial-hand.mat-clock-dial-hand-pointless:before{content:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2.MatMiniFabButton, selector: "button[mat-mini-fab], a[mat-mini-fab], button[matMiniFab], a[matMiniFab]", exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatHoursClockDial, decorators: [{
            type: Component,
            args: [{ selector: 'mat-hours-clock-dial', exportAs: 'matHoursClockDial', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'mat-clock-dial mat-clock-dial-hours',
                        '(mousedown)': '_onUserAction($event)',
                        '(touchstart)': '_onUserAction($event)',
                    }, standalone: false, template: "<div\n  class=\"mat-clock-dial-hand\"\n  [class.mat-clock-dial-hand-pointless]=\"isHour\"\n  [class.mat-clock-dial-hand-disabled]=\"disabledHand\"\n  [ngStyle]=\"_handStyles()\"\n></div>\n@for (hour of hours; track _trackBy($index, hour)) {\n  <button\n    class=\"mat-clock-dial-cell\"\n    mat-mini-fab\n    disableRipple\n    [tabIndex]=\"_isActiveCell(hour.value) ? 0 : -1\"\n    [style.left.px]=\"hour.left\"\n    [style.top.px]=\"hour.top\"\n    [class.mat-clock-dial-cell-active]=\"_isActiveCell(hour.value)\"\n    [class.mat-clock-dial-cell-disabled]=\"hour.disabled\"\n    [color]=\"_isActiveCell(hour.value) ? color : undefined\"\n    [attr.aria-disabled]=\"hour.disabled || null\"\n    >\n    {{ hour.displayValue }}\n  </button>\n}\n", styles: [".mat-clock-dial{position:relative;display:block;width:16rem;height:16rem;margin:0 auto;border-radius:50%;background:#f8f9fb}.mat-clock-dial:before{position:absolute;top:50%;left:50%;width:.4375rem;height:.4375rem;border-radius:50%;transform:translate(-50%,-50%);content:\"\"}[mat-mini-fab].mat-clock-dial-cell{position:absolute;display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:50%;box-shadow:none}[mat-mini-fab].mat-clock-dial-cell:disabled{pointer-events:none}[mat-mini-fab].mat-clock-dial-cell:focus,[mat-mini-fab].mat-clock-dial-cell:hover,[mat-mini-fab].mat-clock-dial-cell:active,[mat-mini-fab].mat-clock-dial-cell:focus:active{box-shadow:none}.mat-clock-dial-hand{position:absolute;inset:0;width:2px;margin:0 auto;transform-origin:bottom}.mat-clock-dial-hand:before{position:absolute;top:-.25rem;left:-.25rem;width:calc(.5rem + 1px);height:calc(.5rem + 1px);border-radius:50%;content:\"\"}.mat-clock-dial-hand.mat-clock-dial-hand-pointless:before{content:none}\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: Document, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }, { type: Window, decorators: [{
                    type: Inject,
                    args: [Window]
                }] }], propDecorators: { selectedHour: [{
                type: Input
            }], isMeridiem: [{
                type: Input
            }], availableHours: [{
                type: Input
            }], color: [{
                type: Input
            }], selectedChange: [{
                type: Output
            }] } });

class MatTimeFaceBase {
    /** The currently selected time. */
    get selected() {
        return this._selected;
    }
    set selected(value) {
        this._selected = this._timeAdapter.getValidTimeOrNull(this._timeAdapter.deserialize(value));
        if (!this._selected) {
            return;
        }
        const hour = this._timeAdapter.getHour(this._selected);
        this.selectedHour = hour > 12 && this.isMeridiem ? hour - 12 : hour;
        if (hour === 0 && this.isMeridiem) {
            this.selectedHour = 12;
        }
        this.selectedMinute = this._timeAdapter.getMinute(this._selected);
        this.availableHours = ALL_HOURS;
        if (this.isMeridiem) {
            this.period = this._timeAdapter.getPeriod(this._selected);
        }
        this.availableMinutes = ALL_MINUTES;
        this._setMinHour();
        this._setMaxHour();
        this._setMinMinute();
        this._setMaxMinute();
        this._moveFocusOnNextTick = this.isMeridiem;
    }
    /** The minimum selectable time. */
    get minTime() {
        return this._minTime;
    }
    set minTime(value) {
        this._minTime = this._timeAdapter.getValidTimeOrNull(this._timeAdapter.deserialize(value));
        if (value) {
            this._setMinHour();
            this._setMinMinute();
            this._setDisabledPeriod();
        }
    }
    /** The maximum selectable time. */
    get maxTime() {
        return this._maxTime;
    }
    set maxTime(value) {
        this._maxTime = this._timeAdapter.getValidTimeOrNull(this._timeAdapter.deserialize(value));
        if (value) {
            this._setMaxHour();
            this._setMaxMinute();
            this._setDisabledPeriod();
        }
    }
    /** Step over minutes. */
    get minuteInterval() {
        return this._minuteInterval;
    }
    set minuteInterval(value) {
        this._minuteInterval = coerceNumberProperty(value) || 1;
    }
    constructor(_timeAdapter) {
        this._timeAdapter = _timeAdapter;
        this._minuteInterval = 1;
        /** Color palette. */
        this.color = 'primary';
        /** Emits when any hour, minute or period is selected. */
        this._userSelection = new EventEmitter();
        this.selectedChange = new EventEmitter();
        this.selectedHour = 0;
        this.selectedMinute = 0;
        this.disabledPeriod = null;
        this.availableMinutes = ALL_MINUTES;
        this.availableHours = ALL_HOURS;
        /**
         * Used for scheduling that focus should be moved to the active cell on the next tick.
         * We need to schedule it, rather than do it immediately, because we have to wait
         * for Angular to re-evaluate the view children.
         */
        this._moveFocusOnNextTick = false;
    }
    ngAfterContentInit() {
        if (!this.selected) {
            this.selected = this._timeAdapter.clampTime(this._timeAdapter.now(), this.minTime, this.maxTime);
            this._userSelection.emit(this.selected);
        }
    }
    ngAfterViewChecked() {
        if (this._moveFocusOnNextTick) {
            this._moveFocusOnNextTick = false;
            this.focusActiveCell();
        }
    }
    /** Handles hour selection. */
    _onHourSelected(hour) {
        this.selectedHour = hour;
        const selected = this._timeAdapter.updateHour(this.selected, this._getHourBasedOnPeriod(hour));
        this._timeSelected(selected);
    }
    /** Handles minute selection. */
    _onMinuteSelected(minute) {
        this.selectedMinute = minute;
        const selected = this._timeAdapter.updateMinute(this.selected, minute);
        this._timeSelected(selected);
    }
    /** Handles period changing. */
    _onPeriodChanged(period) {
        this.period = period;
        const selected = this._timeAdapter.updateHour(this.selected, this._getHourBasedOnPeriod(this.selectedHour));
        this._timeSelected(selected);
    }
    _getAvailableHours() {
        if (this.isMeridiem) {
            return this.availableHours
                .filter((h) => {
                if (this.period === 'am') {
                    return h < 12;
                }
                if (this.period === 'pm') {
                    return h >= 12;
                }
                return h;
            })
                .map((h) => {
                if (h > 12) {
                    return h - 12;
                }
                if (h === 0) {
                    return 12;
                }
                return h;
            });
        }
        return this.availableHours;
    }
    _onKeydown(event, view) {
        switch (view) {
            case 'hour':
                this._handleHourKeydown(event);
                break;
            case 'minute':
                this._handleMinuteKeydown(event);
                break;
        }
    }
    _handleHourKeydown(event) {
        const hours = this._getAvailableHours();
        const selectedHourIndex = hours.findIndex((hour) => hour === this.selectedHour);
        if (!hours.length) {
            return;
        }
        switch (event.keyCode) {
            case UP_ARROW:
                if (selectedHourIndex + 1 >= hours.length || selectedHourIndex < 0) {
                    this._onHourSelected(hours[0]);
                }
                else {
                    this._onHourSelected(hours[selectedHourIndex + 1]);
                }
                break;
            case DOWN_ARROW:
                if (selectedHourIndex - 1 < 0 || selectedHourIndex < 0) {
                    this._onHourSelected(hours[hours.length - 1]);
                }
                else {
                    this._onHourSelected(hours[selectedHourIndex - 1]);
                }
                break;
            default:
                break;
        }
    }
    _handleMinuteKeydown(event) {
        const minutes = this.availableMinutes;
        const selectedMinuteIndex = minutes.findIndex((minute) => minute === this.selectedMinute);
        if (!minutes.length) {
            return;
        }
        switch (event.keyCode) {
            case UP_ARROW:
                if (selectedMinuteIndex + this.minuteInterval >= minutes.length ||
                    selectedMinuteIndex < 0) {
                    const difference = 60 - this.selectedMinute + Math.min(...this.availableMinutes);
                    const count = Math.ceil(difference / this.minuteInterval);
                    const differenceForValid = count * this.minuteInterval;
                    const nextValidValue = this.selectedMinute + differenceForValid;
                    const correctIndex = minutes.findIndex((minute) => minute === nextValidValue - 60 // amount of mins
                    );
                    this._onMinuteSelected(minutes[correctIndex]);
                }
                else {
                    this._onMinuteSelected(minutes[selectedMinuteIndex + this.minuteInterval]);
                }
                break;
            case DOWN_ARROW:
                if (selectedMinuteIndex - this.minuteInterval < 0 ||
                    selectedMinuteIndex < 0) {
                    const difference = 60 + this.selectedMinute - Math.max(...this.availableMinutes);
                    const count = Math.ceil(difference / this.minuteInterval);
                    const differenceForValid = count * this.minuteInterval;
                    const nextValidValue = this.selectedMinute - differenceForValid;
                    const correctIndex = minutes.findIndex((minute) => minute === nextValidValue + 60 // amount of mins
                    );
                    this._onMinuteSelected(minutes[correctIndex]);
                }
                else {
                    this._onMinuteSelected(minutes[selectedMinuteIndex - this.minuteInterval]);
                }
                break;
            default:
                break;
        }
    }
    /** Gets a correct hours based on meridiem and period. */
    _getHourBasedOnPeriod(hour) {
        const afterNoon = this.isMeridiem && this.period === 'pm';
        const beforeNoon = this.isMeridiem && this.period === 'am';
        if (afterNoon) {
            return hour === 12 ? hour : hour + 12;
        }
        if (beforeNoon) {
            return hour === 12 ? 0 : hour;
        }
        return hour;
    }
    _timeSelected(value) {
        if (value && !this._timeAdapter.sameTime(value, this.selected)) {
            this.selectedChange.emit(value);
        }
        this._userSelection.emit(value);
    }
    /** Sets min hour. */
    _setMinHour() {
        if (!this.minTime) {
            return;
        }
        const minHour = this._timeAdapter.getHour(this.minTime);
        this.availableHours = this.availableHours.filter((h) => h >= minHour);
    }
    /** Sets max hour. */
    _setMaxHour() {
        if (!this.maxTime) {
            return;
        }
        const maxHour = this._timeAdapter.getHour(this.maxTime);
        this.availableHours = this.availableHours.filter((h) => h <= maxHour);
    }
    /** Sets min minute. */
    _setMinMinute() {
        if (!this.selected || !this.minTime) {
            return;
        }
        const selectedHour = this._timeAdapter.getHour(this.selected);
        const minHour = this._timeAdapter.getHour(this.minTime);
        const minMinute = selectedHour > minHour ? 0 : this._timeAdapter.getMinute(this.minTime);
        this.availableMinutes = this.availableMinutes.filter((minute) => minute >= minMinute);
        if (selectedHour < minHour) {
            this.availableMinutes = [];
        }
    }
    /** Sets max minute. */
    _setMaxMinute() {
        if (!this.selected || !this.maxTime) {
            return;
        }
        const selectedHour = this._timeAdapter.getHour(this.selected);
        const maxHour = this._timeAdapter.getHour(this.maxTime);
        const maxMinute = selectedHour < maxHour ? 59 : this._timeAdapter.getMinute(this.maxTime);
        this.availableMinutes = this.availableMinutes.filter((minute) => minute <= maxMinute);
        if (selectedHour > maxHour) {
            this.availableMinutes = [];
        }
    }
    /** Sets disabled period. */
    _setDisabledPeriod() {
        if (this.minTime) {
            const minHour = this._timeAdapter.getHour(this.minTime);
            if (minHour >= 12) {
                this.disabledPeriod = 'am';
            }
        }
        if (this.maxTime) {
            const maxHour = this._timeAdapter.getHour(this.maxTime);
            const maxMinute = this._timeAdapter.getHour(this.maxTime);
            if (maxHour < 12 || (maxHour === 12 && maxMinute === 0)) {
                this.disabledPeriod = 'pm';
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeFaceBase, deps: [{ token: TimeAdapter, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatTimeFaceBase, isStandalone: true, inputs: { selected: "selected", minTime: "minTime", maxTime: "maxTime", minuteInterval: "minuteInterval", isMeridiem: "isMeridiem", color: "color" }, outputs: { _userSelection: "_userSelection", selectedChange: "selectedChange" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeFaceBase, decorators: [{
            type: Directive
        }], ctorParameters: () => [{ type: TimeAdapter, decorators: [{
                    type: Optional
                }] }], propDecorators: { selected: [{
                type: Input
            }], minTime: [{
                type: Input
            }], maxTime: [{
                type: Input
            }], minuteInterval: [{
                type: Input
            }], isMeridiem: [{
                type: Input
            }], color: [{
                type: Input
            }], _userSelection: [{
                type: Output
            }], selectedChange: [{
                type: Output
            }] } });

function withZeroPrefix(value) {
    return value < 10 ? `0${value}` : `${value}`;
}
function withZeroPrefixMeridiem(value, isMeridiem) {
    const newValue = isMeridiem && value === 0 ? 12 : value;
    return withZeroPrefix(newValue);
}
const DIGIT_KEYS = Array.from({ length: 10 }, (_, i) => `${i}`);
const SPECIAL_KEYS = ['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab'];
class MatTimeInputBase {
    get value() {
        return this._value;
    }
    set value(value) {
        this._value = value;
        if (!this.hasFocus) {
            this.setInputValue(this._value);
        }
        // we need timeout here to set placeholder first time
        setTimeout(() => {
            this.setInputPlaceholder(this._value);
        }, 0);
    }
    _keydown(event) {
        const isAllow = (DIGIT_KEYS.includes(event.key) && !event.shiftKey) ||
            SPECIAL_KEYS.includes(event.code);
        if (!isAllow) {
            event.preventDefault();
        }
    }
    get inputElement() {
        return this.element.nativeElement;
    }
    get hasFocus() {
        return this.element?.nativeElement === this._document.activeElement;
    }
    constructor(element, _cdr, _document) {
        this.element = element;
        this._cdr = _cdr;
        this._document = _document;
        this.timeChanged = new EventEmitter();
    }
    focus() {
        this.setInputValue(null);
    }
    blur() {
        const isNumber = !isNaN(Number(this.inputElement.value));
        const value = this._formatValue(isNumber ? Number(this.inputElement.value || this._value) : this.value);
        this.setInputValue(value);
        this.setInputPlaceholder(value);
        this.timeChanged.emit(value);
    }
    setInputValue(value) {
        if (value !== null) {
            this.inputElement.value = this._withZeroPrefix(value);
        }
        else {
            this.inputElement.value = '';
        }
        this._cdr.markForCheck();
    }
    setInputPlaceholder(value) {
        this.inputElement.placeholder = this._withZeroPrefix(value);
        this._cdr.markForCheck();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeInputBase, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatTimeInputBase, isStandalone: true, inputs: { value: "value" }, outputs: { timeChanged: "timeChanged" }, host: { listeners: { "keydown": "_keydown($event)" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeInputBase, decorators: [{
            type: Directive
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: Document, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }], propDecorators: { value: [{
                type: Input
            }], timeChanged: [{
                type: Output
            }], _keydown: [{
                type: HostListener,
                args: ['keydown', ['$event']]
            }] } });

class MatTimepickerContentLayout {
    constructor() {
        /** Layout orientation. */
        this.orientation = 'vertical';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerContentLayout, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerContentLayout, isStandalone: false, selector: "mat-timepicker-content-layout", inputs: { title: "title", orientation: "orientation" }, host: { properties: { "class.mat-timepicker-content-layout-horizontal": "orientation === \"horizontal\"", "class.mat-timepicker-content-layout-vertical": "orientation === \"vertical\"" }, classAttribute: "mat-timepicker-content-layout" }, exportAs: ["matTimepickerContent"], ngImport: i0, template: "<span class=\"mat-timepicker-content-layout-title sln-h6\">{{ title }}</span>\n\n<div class=\"mat-timepicker-content-layout-container\">\n  <div class=\"mat-timepicker-content-layout-values\">\n    <div class=\"mat-timepicker-content-layout-hours\">\n      <ng-content select=\"[hours]\"></ng-content>\n    </div>\n    <span class=\"mat-timepicker-content-layout-separator\">&#58;</span>\n    <div class=\"mat-timepicker-content-layout-minutes\">\n      <ng-content select=\"[minutes]\"></ng-content>\n    </div>\n\n    <ng-content select=\"[mat-time-period]\"></ng-content>\n  </div>\n\n  <ng-content></ng-content>\n</div>\n", styles: ["h6.mat-timepicker-content-layout-title{margin-top:0rem;letter-spacing:.05rem;padding:10px;text-align:center}.mat-timepicker-content-layout-title{margin:10px;display:block}.mat-timepicker-content-layout-values{display:flex;justify-content:center;flex-wrap:wrap;background:#f8f9fb;margin-bottom:1rem;margin-top:1rem}.mat-time-period{margin-left:.75rem}.mat-timepicker-content-layout-horizontal h6.mat-timepicker-content-layout-title{margin-bottom:0}.mat-timepicker-content-layout-horizontal .mat-timepicker-content-layout-container{display:flex;gap:4rem;align-items:center}.mat-timepicker-content-layout-horizontal .mat-time-period{margin-top:.75rem;margin-left:0}.mat-timepicker-content-layout-hours,.mat-timepicker-content-layout-minutes{width:6rem;font-size:30px}.mat-timepicker-content-layout-separator{width:10px;font-size:30px;margin-top:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerContentLayout, decorators: [{
            type: Component,
            args: [{ selector: 'mat-timepicker-content-layout', exportAs: 'matTimepickerContent', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'mat-timepicker-content-layout',
                        '[class.mat-timepicker-content-layout-horizontal]': 'orientation === "horizontal"',
                        '[class.mat-timepicker-content-layout-vertical]': 'orientation === "vertical"',
                    }, standalone: false, template: "<span class=\"mat-timepicker-content-layout-title sln-h6\">{{ title }}</span>\n\n<div class=\"mat-timepicker-content-layout-container\">\n  <div class=\"mat-timepicker-content-layout-values\">\n    <div class=\"mat-timepicker-content-layout-hours\">\n      <ng-content select=\"[hours]\"></ng-content>\n    </div>\n    <span class=\"mat-timepicker-content-layout-separator\">&#58;</span>\n    <div class=\"mat-timepicker-content-layout-minutes\">\n      <ng-content select=\"[minutes]\"></ng-content>\n    </div>\n\n    <ng-content select=\"[mat-time-period]\"></ng-content>\n  </div>\n\n  <ng-content></ng-content>\n</div>\n", styles: ["h6.mat-timepicker-content-layout-title{margin-top:0rem;letter-spacing:.05rem;padding:10px;text-align:center}.mat-timepicker-content-layout-title{margin:10px;display:block}.mat-timepicker-content-layout-values{display:flex;justify-content:center;flex-wrap:wrap;background:#f8f9fb;margin-bottom:1rem;margin-top:1rem}.mat-time-period{margin-left:.75rem}.mat-timepicker-content-layout-horizontal h6.mat-timepicker-content-layout-title{margin-bottom:0}.mat-timepicker-content-layout-horizontal .mat-timepicker-content-layout-container{display:flex;gap:4rem;align-items:center}.mat-timepicker-content-layout-horizontal .mat-time-period{margin-top:.75rem;margin-left:0}.mat-timepicker-content-layout-hours,.mat-timepicker-content-layout-minutes{width:6rem;font-size:30px}.mat-timepicker-content-layout-separator{width:10px;font-size:30px;margin-top:5px}\n"] }]
        }], propDecorators: { title: [{
                type: Input
            }], orientation: [{
                type: Input
            }] } });

class MatTimePeriod {
    constructor() {
        this._vertical = true;
        this._period = 'am';
        this._disabledPeriod = null;
        this.periodChanged = new EventEmitter();
    }
    /** Whether the time period is vertically aligned. */
    get vertical() {
        return this._vertical;
    }
    set vertical(value) {
        this._vertical = coerceBooleanProperty(value);
    }
    get period() {
        return this._period;
    }
    set period(value) {
        this._period = value || 'am';
    }
    get disabledPeriod() {
        return this._disabledPeriod;
    }
    set disabledPeriod(value) {
        this._disabledPeriod = value;
    }
    setPeriod(event, period) {
        event.preventDefault();
        this.period = period;
        this.periodChanged.emit(period);
    }
    _isPeriodDisabled(period) {
        if (!this.disabledPeriod) {
            return false;
        }
        return this.disabledPeriod === period;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimePeriod, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: MatTimePeriod, isStandalone: false, selector: "mat-time-period", inputs: { vertical: "vertical", period: "period", disabledPeriod: "disabledPeriod" }, outputs: { periodChanged: "periodChanged" }, host: { properties: { "class.mat-time-period-vertical": "vertical", "class.mat-time-period-horizontal": "!vertical", "attr.aria-orientation": "vertical ? \"vertical\" : \"horizontal\"" }, classAttribute: "mat-time-period" }, ngImport: i0, template: "<div\n  tabindex=\"0\"\n  class=\"mat-time-period-item\"\n  matRipple\n  [class.mat-time-period-item-active]=\"period === 'am'\"\n  [class.mat-time-period-item-disabled]=\"_isPeriodDisabled('am')\"\n  (click)=\"setPeriod($event,'am')\"\n  (keydown.space)=\"setPeriod($event, 'am')\"\n>\n  AM\n</div>\n<mat-divider [vertical]=\"!vertical\"></mat-divider>\n<div\n  tabindex=\"0\"\n  class=\"mat-time-period-item\"\n  matRipple\n  [class.mat-time-period-item-active]=\"period === 'pm'\"\n  [class.mat-time-period-item-disabled]=\"_isPeriodDisabled('pm')\"\n  (click)=\"setPeriod($event,'pm')\"\n  (keydown.space)=\"setPeriod($event, 'pm')\"\n>\n  PM\n</div>\n", styles: [".mat-time-period{display:flex;text-align:center;border-width:1px;border-style:solid;border-radius:.25rem;box-sizing:border-box}.mat-time-period-vertical{flex-direction:column;width:3.25rem;height:4.5rem}.mat-time-period-horizontal{flex-direction:row;max-width:13.5rem;width:100%;height:2.5rem}.mat-time-period-item{display:flex;flex-direction:column;justify-content:center;flex-grow:1;height:100%;font-size:.875rem;font-weight:500;cursor:pointer}.mat-time-period-item-disabled{pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1$2.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "component", type: i2$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimePeriod, decorators: [{
            type: Component,
            args: [{ selector: 'mat-time-period', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'mat-time-period',
                        '[class.mat-time-period-vertical]': 'vertical',
                        '[class.mat-time-period-horizontal]': '!vertical',
                        '[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
                    }, standalone: false, template: "<div\n  tabindex=\"0\"\n  class=\"mat-time-period-item\"\n  matRipple\n  [class.mat-time-period-item-active]=\"period === 'am'\"\n  [class.mat-time-period-item-disabled]=\"_isPeriodDisabled('am')\"\n  (click)=\"setPeriod($event,'am')\"\n  (keydown.space)=\"setPeriod($event, 'am')\"\n>\n  AM\n</div>\n<mat-divider [vertical]=\"!vertical\"></mat-divider>\n<div\n  tabindex=\"0\"\n  class=\"mat-time-period-item\"\n  matRipple\n  [class.mat-time-period-item-active]=\"period === 'pm'\"\n  [class.mat-time-period-item-disabled]=\"_isPeriodDisabled('pm')\"\n  (click)=\"setPeriod($event,'pm')\"\n  (keydown.space)=\"setPeriod($event, 'pm')\"\n>\n  PM\n</div>\n", styles: [".mat-time-period{display:flex;text-align:center;border-width:1px;border-style:solid;border-radius:.25rem;box-sizing:border-box}.mat-time-period-vertical{flex-direction:column;width:3.25rem;height:4.5rem}.mat-time-period-horizontal{flex-direction:row;max-width:13.5rem;width:100%;height:2.5rem}.mat-time-period-item{display:flex;flex-direction:column;justify-content:center;flex-grow:1;height:100%;font-size:.875rem;font-weight:500;cursor:pointer}.mat-time-period-item-disabled{pointer-events:none}\n"] }]
        }], propDecorators: { vertical: [{
                type: Input
            }], period: [{
                type: Input
            }], disabledPeriod: [{
                type: Input
            }], periodChanged: [{
                type: Output
            }] } });

class MatClockDials extends MatTimeFaceBase {
    constructor(_intl, _timeAdapter, _ngZone, _elementRef, _cdr) {
        super(_timeAdapter);
        this._intl = _intl;
        this._ngZone = _ngZone;
        this._elementRef = _elementRef;
        this._cdr = _cdr;
        this.isHoursView = true;
        /** Specifies the view of clock dial. */
        this._view = new BehaviorSubject('hours');
        this._viewSubscription = Subscription.EMPTY;
    }
    ngOnInit() {
        this._viewSubscription = this._view.subscribe((view) => (this.isHoursView = view === 'hours'));
    }
    ngOnDestroy() {
        this._viewSubscription?.unsubscribe();
        this._viewSubscription = null;
    }
    /** Changes clock dial view. */
    onViewChange(event, view) {
        event.preventDefault();
        this._view.next(view);
    }
    focusActiveCell() {
        this._ngZone.runOutsideAngular(() => {
            this._ngZone.onStable.pipe(take(1)).subscribe(() => {
                const activeCell = this._elementRef.nativeElement.querySelector('.mat-timepicker-content .mat-clock-dial-cell-active');
                if (activeCell) {
                    activeCell.focus();
                    return;
                }
                const activePoint = this._elementRef.nativeElement.querySelector('.mat-timepicker-content .mat-clock-dial-hand-point');
                if (activePoint) {
                    // if no active cell we need to focus a small dot
                    activePoint.focus();
                }
            });
        });
    }
    _withZeroPrefix(value) {
        if (value === 0) {
            return '00';
        }
        return withZeroPrefixMeridiem(value, this.isMeridiem);
    }
    _onMinuteSelected(minute) {
        super._onMinuteSelected(minute);
        this._cdr.detectChanges();
    }
    /** Handles hour selection. */
    _onHourChanged({ hour, changeView = false, }) {
        if (changeView) {
            this._view.next('minutes');
        }
        this._onHourSelected(hour);
        this._cdr.detectChanges();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatClockDials, deps: [{ token: MatTimepickerIntl }, { token: TimeAdapter, optional: true }, { token: i0.NgZone }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: MatClockDials, isStandalone: false, selector: "mat-clock-dials", inputs: { orientation: "orientation" }, host: { attributes: { "role": "dial" }, classAttribute: "mat-clock-dials" }, exportAs: ["matClockDials"], usesInheritance: true, ngImport: i0, template: "<mat-timepicker-content-layout\n  [title]=\"_intl.dialsTitle\"\n  [orientation]=\"orientation\"\n  >\n  <div\n    tabindex=\"0\"\n    class=\"mat-clock-dial-value\"\n    hours\n    [class.mat-clock-dial-value-active]=\"isHoursView\"\n    (click)=\"onViewChange($event,'hours')\"\n    (keydown.space)=\"onViewChange($event, 'hours')\"\n    >\n    {{ _withZeroPrefix(selectedHour) }}\n  </div>\n  <div\n    tabindex=\"0\"\n    class=\"mat-clock-dial-value\"\n    minutes\n    [class.mat-clock-dial-value-active]=\"!isHoursView\"\n    (click)=\"onViewChange($event,'minutes')\"\n    (keydown.space)=\"onViewChange($event,'minutes')\"\n    >\n    {{ _withZeroPrefix(selectedMinute) }}\n  </div>\n\n  @if (isMeridiem) {\n    <ng-template mat-time-period>\n      <mat-time-period\n        [period]=\"period\"\n        [disabledPeriod]=\"disabledPeriod\"\n        [vertical]=\"orientation === 'vertical'\"\n        (periodChanged)=\"_onPeriodChanged($event)\"\n      ></mat-time-period>\n    </ng-template>\n  }\n\n  <div\n    class=\"mat-clock-dial-faces\"\n    [class.mat-clock-dial-faces-horizontal]=\"orientation === 'horizontal'\"\n    >\n\n      <mat-hours-clock-dial\n        [color]=\"color\"\n        [selectedHour]=\"selectedHour\"\n        [isMeridiem]=\"isMeridiem\"\n        [availableHours]=\"_getAvailableHours()\"\n        (selectedChange)=\"_onHourChanged($event)\"\n        (keydown)=\"_onKeydown($event, 'hour')\"\n\n        class=\"mat-clock-dial-face\"\n        [class.is-visible]=\"isHoursView\"\n        [class.is-hidden]=\"!isHoursView\"\n        [attr.aria-hidden]=\"!isHoursView\"\n      ></mat-hours-clock-dial>\n  \n      <mat-minutes-clock-dial\n        [color]=\"color\"\n        [selectedMinute]=\"selectedMinute\"\n        [interval]=\"minuteInterval\"\n        [availableMinutes]=\"availableMinutes\"\n        (selectedChange)=\"_onMinuteSelected($event)\"\n        (keydown)=\"_onKeydown($event, 'minute')\"\n\n        class=\"mat-clock-dial-face\"\n        [class.is-visible]=\"!isHoursView\"\n        [class.is-hidden]=\"isHoursView\"\n        [attr.aria-hidden]=\"!isHoursView\"\n      ></mat-minutes-clock-dial>\n    \n  </div>\n</mat-timepicker-content-layout>\n", styles: [".mat-clock-dial-values{display:flex;width:100%;margin-top:10px}.mat-clock-dial-value{display:flex;align-items:center;justify-content:center;height:3.5rem;border-radius:4px;cursor:pointer;color:var(--DARK-GREY)}.mat-clock-dial-faces{padding:0 2rem}.mat-clock-dial-faces.mat-clock-dial-faces-horizontal{margin-top:0}.mat-mdc-fab:not(.mdc-fab--extended) .mdc-fab__ripple,.mat-mdc-mini-fab:not(.mdc-fab--extended) .mdc-fab__ripple{border-radius:50%;border:none}[mat-mini-fab].mat-clock-dial-cell:active,[mat-mini-fab].mat-clock-dial-cell:hover,[mat-mini-fab].mat-clock-dial-cell-active{background:#fff;border:2px solid var(--PRIMARY)}.mat-mdc-fab .mdc-button__label,.mat-mdc-mini-fab .mdc-button__label{color:var(--DARK-GREY);font-family:var(--font-medium)}.mat-clock-dial:before{background:var(--PRIMARY)}.mat-clock-dial-hand{background:var(--PRIMARY);width:2px}\n"], dependencies: [{ kind: "component", type: MatTimepickerContentLayout, selector: "mat-timepicker-content-layout", inputs: ["title", "orientation"], exportAs: ["matTimepickerContent"] }, { kind: "component", type: MatHoursClockDial, selector: "mat-hours-clock-dial", inputs: ["selectedHour", "isMeridiem", "availableHours", "color"], outputs: ["selectedChange"], exportAs: ["matHoursClockDial"] }, { kind: "component", type: MatMinutesClockDial, selector: "mat-minutes-clock-dial", inputs: ["selectedMinute", "interval", "availableMinutes", "color"], outputs: ["selectedChange"], exportAs: ["matMinutesClockDial"] }, { kind: "component", type: MatTimePeriod, selector: "mat-time-period", inputs: ["vertical", "period", "disabledPeriod"], outputs: ["periodChanged"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatClockDials, decorators: [{
            type: Component,
            args: [{ selector: 'mat-clock-dials', exportAs: 'matClockDials', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        role: 'dial',
                        class: 'mat-clock-dials',
                    }, standalone: false, template: "<mat-timepicker-content-layout\n  [title]=\"_intl.dialsTitle\"\n  [orientation]=\"orientation\"\n  >\n  <div\n    tabindex=\"0\"\n    class=\"mat-clock-dial-value\"\n    hours\n    [class.mat-clock-dial-value-active]=\"isHoursView\"\n    (click)=\"onViewChange($event,'hours')\"\n    (keydown.space)=\"onViewChange($event, 'hours')\"\n    >\n    {{ _withZeroPrefix(selectedHour) }}\n  </div>\n  <div\n    tabindex=\"0\"\n    class=\"mat-clock-dial-value\"\n    minutes\n    [class.mat-clock-dial-value-active]=\"!isHoursView\"\n    (click)=\"onViewChange($event,'minutes')\"\n    (keydown.space)=\"onViewChange($event,'minutes')\"\n    >\n    {{ _withZeroPrefix(selectedMinute) }}\n  </div>\n\n  @if (isMeridiem) {\n    <ng-template mat-time-period>\n      <mat-time-period\n        [period]=\"period\"\n        [disabledPeriod]=\"disabledPeriod\"\n        [vertical]=\"orientation === 'vertical'\"\n        (periodChanged)=\"_onPeriodChanged($event)\"\n      ></mat-time-period>\n    </ng-template>\n  }\n\n  <div\n    class=\"mat-clock-dial-faces\"\n    [class.mat-clock-dial-faces-horizontal]=\"orientation === 'horizontal'\"\n    >\n\n      <mat-hours-clock-dial\n        [color]=\"color\"\n        [selectedHour]=\"selectedHour\"\n        [isMeridiem]=\"isMeridiem\"\n        [availableHours]=\"_getAvailableHours()\"\n        (selectedChange)=\"_onHourChanged($event)\"\n        (keydown)=\"_onKeydown($event, 'hour')\"\n\n        class=\"mat-clock-dial-face\"\n        [class.is-visible]=\"isHoursView\"\n        [class.is-hidden]=\"!isHoursView\"\n        [attr.aria-hidden]=\"!isHoursView\"\n      ></mat-hours-clock-dial>\n  \n      <mat-minutes-clock-dial\n        [color]=\"color\"\n        [selectedMinute]=\"selectedMinute\"\n        [interval]=\"minuteInterval\"\n        [availableMinutes]=\"availableMinutes\"\n        (selectedChange)=\"_onMinuteSelected($event)\"\n        (keydown)=\"_onKeydown($event, 'minute')\"\n\n        class=\"mat-clock-dial-face\"\n        [class.is-visible]=\"!isHoursView\"\n        [class.is-hidden]=\"isHoursView\"\n        [attr.aria-hidden]=\"!isHoursView\"\n      ></mat-minutes-clock-dial>\n    \n  </div>\n</mat-timepicker-content-layout>\n", styles: [".mat-clock-dial-values{display:flex;width:100%;margin-top:10px}.mat-clock-dial-value{display:flex;align-items:center;justify-content:center;height:3.5rem;border-radius:4px;cursor:pointer;color:var(--DARK-GREY)}.mat-clock-dial-faces{padding:0 2rem}.mat-clock-dial-faces.mat-clock-dial-faces-horizontal{margin-top:0}.mat-mdc-fab:not(.mdc-fab--extended) .mdc-fab__ripple,.mat-mdc-mini-fab:not(.mdc-fab--extended) .mdc-fab__ripple{border-radius:50%;border:none}[mat-mini-fab].mat-clock-dial-cell:active,[mat-mini-fab].mat-clock-dial-cell:hover,[mat-mini-fab].mat-clock-dial-cell-active{background:#fff;border:2px solid var(--PRIMARY)}.mat-mdc-fab .mdc-button__label,.mat-mdc-mini-fab .mdc-button__label{color:var(--DARK-GREY);font-family:var(--font-medium)}.mat-clock-dial:before{background:var(--PRIMARY)}.mat-clock-dial-hand{background:var(--PRIMARY);width:2px}\n"] }]
        }], ctorParameters: () => [{ type: MatTimepickerIntl }, { type: TimeAdapter, decorators: [{
                    type: Optional
                }] }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { orientation: [{
                type: Input
            }] } });

class MatHourInput extends MatTimeInputBase {
    get availableHours() {
        return this._availableHours;
    }
    set availableHours(value) {
        this._availableHours = value;
    }
    constructor(element, _cdr, _document) {
        super(element, _cdr, _document);
        this._availableHours = [];
    }
    _withZeroPrefix(value) {
        return withZeroPrefixMeridiem(value, this.isMeridiem);
    }
    _formatValue(hour) {
        const getValue = () => {
            if (this.isMeridiem) {
                if (hour === 0 || hour === 24) {
                    return 12;
                }
            }
            if (hour === 24) {
                return 0;
            }
            return this.isMeridiem && hour > 12 ? hour - 12 : hour;
        };
        const value = getValue();
        if (this.isMeridiem) {
            if (!this.availableHours.length) {
                return this.value;
            }
            if (value === 12 && this.availableHours.includes(12)) {
                return 12;
            }
            if (value === 12 && !this.availableHours.includes(12)) {
                return Math.min(...this.availableHours);
            }
            if (value >= 1 && value < 12) {
                // the last item is max becuase 12 at the beginning is kinda "min"
                const maxHour = this.availableHours[this.availableHours.length - 1];
                return Math.min(Math.max(value, Math.min(...this.availableHours)), maxHour);
            }
        }
        return Math.min(Math.max(value, Math.min(...this.availableHours)), Math.max(...this.availableHours));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatHourInput, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatHourInput, isStandalone: false, selector: "input[matHourInput]", inputs: { availableHours: "availableHours", isMeridiem: "isMeridiem" }, host: { listeners: { "focus": "focus()", "blur": "blur()" }, classAttribute: "mat-time-input" }, exportAs: ["matTimeInput"], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatHourInput, decorators: [{
            type: Directive,
            args: [{
                    selector: 'input[matHourInput]',
                    exportAs: 'matTimeInput',
                    host: {
                        class: 'mat-time-input',
                        '(focus)': 'focus()',
                        '(blur)': 'blur()',
                    },
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: Document, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }], propDecorators: { availableHours: [{
                type: Input
            }], isMeridiem: [{
                type: Input
            }] } });
class MatMinuteInput extends MatTimeInputBase {
    /** Step over minutes. */
    get interval() {
        return this._interval;
    }
    set interval(value) {
        this._interval = coerceNumberProperty(value) || 1;
    }
    get availableMinutes() {
        return this._availableMinutes;
    }
    set availableMinutes(value) {
        this._availableMinutes = value;
    }
    constructor(element, _cdr, _document) {
        super(element, _cdr, _document);
        this._interval = 1;
        this._availableMinutes = [];
    }
    _withZeroPrefix(value) {
        return withZeroPrefix(value);
    }
    _formatValue(value) {
        if (!this.availableMinutes.length) {
            return this.value;
        }
        const roundedValue = Math.round(value / this.interval) * this.interval;
        return Math.min(Math.max(roundedValue, Math.min(...this.availableMinutes)), Math.max(...this.availableMinutes));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatMinuteInput, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatMinuteInput, isStandalone: false, selector: "input[matMinuteInput]", inputs: { interval: "interval", availableMinutes: "availableMinutes" }, host: { listeners: { "focus": "focus()", "blur": "blur()" }, classAttribute: "mat-time-input" }, exportAs: ["matTimeInput"], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatMinuteInput, decorators: [{
            type: Directive,
            args: [{
                    selector: 'input[matMinuteInput]',
                    exportAs: 'matTimeInput',
                    host: {
                        class: 'mat-time-input',
                        '(focus)': 'focus()',
                        '(blur)': 'blur()',
                    },
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: Document, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }], propDecorators: { interval: [{
                type: Input
            }], availableMinutes: [{
                type: Input
            }] } });
class MatTimeInputs extends MatTimeFaceBase {
    constructor(_intl, _timeAdapter, _ngZone, _elementRef) {
        super(_timeAdapter);
        this._intl = _intl;
        this._ngZone = _ngZone;
        this._elementRef = _elementRef;
        /**
         * Using for skipping that focus shouldn't be moved to the active cell on the next tick.
         * We need to use it to avoid focusing input for input mode.
         */
        this._skipNextTickFocus = false;
    }
    focusActiveCell() {
        this._ngZone.runOutsideAngular(() => {
            this._ngZone.onStable.pipe(take(1)).subscribe(() => {
                const activeCell = this._elementRef.nativeElement.querySelector('.mat-timepicker-content input');
                if (activeCell && !this._skipNextTickFocus) {
                    activeCell.focus();
                    this._skipNextTickFocus = true;
                }
            });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeInputs, deps: [{ token: MatTimepickerIntl }, { token: TimeAdapter, optional: true }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: MatTimeInputs, isStandalone: false, selector: "mat-time-inputs", host: { classAttribute: "mat-time-inputs" }, usesInheritance: true, ngImport: i0, template: "<mat-timepicker-content-layout [title]=\"_intl.inputsTitle\">\n  <mat-form-field\n    class=\"mat-time-inputs-field\"\n    appearance=\"outline\"\n    hours\n    [color]=\"color\"\n    >\n    <input\n      type=\"text\"\n      inputmode=\"numeric\"\n      maxlength=\"2\"\n      matInput\n      matHourInput\n      [isMeridiem]=\"isMeridiem\"\n      [value]=\"selectedHour\"\n      [availableHours]=\"_getAvailableHours()\"\n      (timeChanged)=\"_onHourSelected($event)\"\n      (keydown)=\"_onKeydown($event, 'hour')\"\n      />\n      <mat-hint>{{_intl.hourInputHint}}</mat-hint>\n    </mat-form-field>\n    <mat-form-field\n      class=\"mat-time-inputs-field\"\n      appearance=\"outline\"\n      minutes\n      [color]=\"color\"\n      >\n      <input\n        type=\"text\"\n        inputmode=\"numeric\"\n        maxlength=\"2\"\n        matInput\n        matMinuteInput\n        [value]=\"selectedMinute\"\n        [interval]=\"minuteInterval\"\n        [availableMinutes]=\"availableMinutes\"\n        (timeChanged)=\"_onMinuteSelected($event)\"\n        (keydown)=\"_onKeydown($event, 'minute')\"\n        />\n        <mat-hint>{{_intl.minuteInputHint}}</mat-hint>\n      </mat-form-field>\n\n      @if (isMeridiem) {\n        <ng-template mat-time-period>\n          <mat-time-period\n            [period]=\"period\"\n            [disabledPeriod]=\"disabledPeriod\"\n            (periodChanged)=\"_onPeriodChanged($event)\"\n          ></mat-time-period>\n        </ng-template>\n      }\n    </mat-timepicker-content-layout>\n", styles: [".mat-time-inputs{display:block}.mat-time-inputs .mat-timepicker-content-layout-separator{margin-top:5px}.mat-time-inputs-field{display:block}.mat-time-inputs-field.mat-form-field-appearance-outline .mat-mdc-form-field-flex{margin:0}.mat-time-inputs-field.mat-form-field-appearance-outline .mat-mdc-text-field-wrapper{top:0;margin:0}.mat-time-inputs-field.mat-form-field-appearance-outline:not(.mat-focused) .mdc-notched-outline__leading,.mat-time-inputs-field.mat-form-field-appearance-outline:not(.mat-focused) .mdc-notched-outline__notch,.mat-time-inputs-field.mat-form-field-appearance-outline:not(.mat-focused) .mdc-notched-outline__trailing{border-style:none}.mat-time-inputs-field.mat-form-field-appearance-outline .mat-mdc-form-field-subscript-wrapper{margin-top:.75rem;line-height:1;letter-spacing:.05rem}.mat-time-inputs-field.mat-form-field-appearance-outline .mat-mdc-form-field-subscript-wrapper .mat-mdc-form-field-hint-wrapper{padding-left:0}.mat-time-inputs-field .mat-mdc-form-field-bottom-align:before{height:0}.mat-time-inputs-field .mat-mdc-form-field-infix{border-top:none;text-align:center}.mat-time-inputs-field input.mat-mdc-input-element{margin-top:0;line-height:normal;text-align:center}\n"], dependencies: [{ kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: MatTimepickerContentLayout, selector: "mat-timepicker-content-layout", inputs: ["title", "orientation"], exportAs: ["matTimepickerContent"] }, { kind: "directive", type: MatHourInput, selector: "input[matHourInput]", inputs: ["availableHours", "isMeridiem"], exportAs: ["matTimeInput"] }, { kind: "directive", type: MatMinuteInput, selector: "input[matMinuteInput]", inputs: ["interval", "availableMinutes"], exportAs: ["matTimeInput"] }, { kind: "component", type: MatTimePeriod, selector: "mat-time-period", inputs: ["vertical", "period", "disabledPeriod"], outputs: ["periodChanged"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimeInputs, decorators: [{
            type: Component,
            args: [{ selector: 'mat-time-inputs', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'mat-time-inputs',
                    }, standalone: false, template: "<mat-timepicker-content-layout [title]=\"_intl.inputsTitle\">\n  <mat-form-field\n    class=\"mat-time-inputs-field\"\n    appearance=\"outline\"\n    hours\n    [color]=\"color\"\n    >\n    <input\n      type=\"text\"\n      inputmode=\"numeric\"\n      maxlength=\"2\"\n      matInput\n      matHourInput\n      [isMeridiem]=\"isMeridiem\"\n      [value]=\"selectedHour\"\n      [availableHours]=\"_getAvailableHours()\"\n      (timeChanged)=\"_onHourSelected($event)\"\n      (keydown)=\"_onKeydown($event, 'hour')\"\n      />\n      <mat-hint>{{_intl.hourInputHint}}</mat-hint>\n    </mat-form-field>\n    <mat-form-field\n      class=\"mat-time-inputs-field\"\n      appearance=\"outline\"\n      minutes\n      [color]=\"color\"\n      >\n      <input\n        type=\"text\"\n        inputmode=\"numeric\"\n        maxlength=\"2\"\n        matInput\n        matMinuteInput\n        [value]=\"selectedMinute\"\n        [interval]=\"minuteInterval\"\n        [availableMinutes]=\"availableMinutes\"\n        (timeChanged)=\"_onMinuteSelected($event)\"\n        (keydown)=\"_onKeydown($event, 'minute')\"\n        />\n        <mat-hint>{{_intl.minuteInputHint}}</mat-hint>\n      </mat-form-field>\n\n      @if (isMeridiem) {\n        <ng-template mat-time-period>\n          <mat-time-period\n            [period]=\"period\"\n            [disabledPeriod]=\"disabledPeriod\"\n            (periodChanged)=\"_onPeriodChanged($event)\"\n          ></mat-time-period>\n        </ng-template>\n      }\n    </mat-timepicker-content-layout>\n", styles: [".mat-time-inputs{display:block}.mat-time-inputs .mat-timepicker-content-layout-separator{margin-top:5px}.mat-time-inputs-field{display:block}.mat-time-inputs-field.mat-form-field-appearance-outline .mat-mdc-form-field-flex{margin:0}.mat-time-inputs-field.mat-form-field-appearance-outline .mat-mdc-text-field-wrapper{top:0;margin:0}.mat-time-inputs-field.mat-form-field-appearance-outline:not(.mat-focused) .mdc-notched-outline__leading,.mat-time-inputs-field.mat-form-field-appearance-outline:not(.mat-focused) .mdc-notched-outline__notch,.mat-time-inputs-field.mat-form-field-appearance-outline:not(.mat-focused) .mdc-notched-outline__trailing{border-style:none}.mat-time-inputs-field.mat-form-field-appearance-outline .mat-mdc-form-field-subscript-wrapper{margin-top:.75rem;line-height:1;letter-spacing:.05rem}.mat-time-inputs-field.mat-form-field-appearance-outline .mat-mdc-form-field-subscript-wrapper .mat-mdc-form-field-hint-wrapper{padding-left:0}.mat-time-inputs-field .mat-mdc-form-field-bottom-align:before{height:0}.mat-time-inputs-field .mat-mdc-form-field-infix{border-top:none;text-align:center}.mat-time-inputs-field input.mat-mdc-input-element{margin-top:0;line-height:normal;text-align:center}\n"] }]
        }], ctorParameters: () => [{ type: MatTimepickerIntl }, { type: TimeAdapter, decorators: [{
                    type: Optional
                }] }, { type: i0.NgZone }, { type: i0.ElementRef }] });

// Boilerplate for applying mixins to MatTimepickerContent.
/*  const _MatTimepickerContentBase = mixinColor(
    class {
      constructor(public _elementRef: ElementRef) {}
    },
  );*/
class MatTimepickerContent {
    constructor(elementRef, intl, _globalModel, _changeDetectorRef) {
        this._globalModel = _globalModel;
        this._changeDetectorRef = _changeDetectorRef;
        /** Portal with projected action buttons. */
        this._actionsPortal = null;
        /** Whether there is an in-progress animation. */
        this._isAnimating = false;
        /** Emits when an animation has finished. */
        this._animationDone = new Subject();
        this._subscriptions = new Subscription();
        //super(elementRef);
        this._closeButtonText = intl.closeTimepickerLabel;
    }
    ngOnInit() {
        this._animationState =
            this.timepicker.openAs === 'dialog' ? 'enter-dialog' : 'enter-dropdown';
    }
    ngAfterViewInit() {
        this._subscriptions.add(this.timepicker.stateChanges.subscribe(() => {
            this._changeDetectorRef.markForCheck();
        }));
        (this._dials || this._inputs)?.focusActiveCell();
    }
    ngOnDestroy() {
        this._subscriptions.unsubscribe();
        this._animationDone.complete();
    }
    /** Changes animation state while closing timepicker content. */
    _startExitAnimation() {
        this._animationState = 'void';
        this._changeDetectorRef.markForCheck();
        setTimeout(() => {
            this._animationDone.next();
        }, 100);
    }
    _handleAnimationEvent(event) {
        this._isAnimating = event.animationName === 'start';
        if (!this._isAnimating) {
            this._animationDone.next();
        }
    }
    onToggleMode(mode) {
        this.mode = mode;
    }
    _getSelected() {
        return this._model?.selection;
    }
    /** Applies the current pending selection to the global model. */
    _applyPendingSelection() {
        if (this._model !== this._globalModel) {
            this._globalModel.updateSelection(this._model.selection, this);
        }
    }
    /**
     * Assigns a new portal containing the timepicker actions.
     * @param portal Portal with the actions to be assigned.
     * @param forceRerender Whether a re-render of the portal should be triggered. This isn't
     * necessary if the portal is assigned during initialization, but it may be required if it's
     * added at a later point.
     */
    _assignActions(portal, forceRerender) {
        // As we have actions, clone the model so that we have the ability to cancel the selection.
        // Note that we want to assign this as soon as possible,
        // but `_actionsPortal` isn't available in the constructor so we do it in `ngOnInit`.
        this._model = this._globalModel.clone();
        this._actionsPortal = portal;
        if (forceRerender) {
            this._changeDetectorRef.detectChanges();
        }
    }
    _handleUserSelection(event) {
        const value = event;
        this._model.add(value);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerContent, deps: [{ token: i0.ElementRef }, { token: MatTimepickerIntl }, { token: MatTimeSelectionModel }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: MatTimepickerContent, isStandalone: false, selector: "mat-timepicker-content", host: { properties: { "class.enter-dialog": "_animationState === \"enter-dialog\"", "class.enter-dropdown": "_animationState === \"enter-dropdown\"", "class.exiting": "_animationState === \"void\"" }, classAttribute: "mat-timepicker-content" }, viewQueries: [{ propertyName: "_dials", first: true, predicate: MatClockDials, descendants: true }, { propertyName: "_inputs", first: true, predicate: MatTimeInputs, descendants: true }], exportAs: ["matTimepickerContent"], ngImport: i0, template: "<div\n  cdkTrapFocus\n  role=\"dialog\"\n  class=\"mat-timepicker-content-container\"\n  [attr.aria-modal]=\"true\"\n  [attr.aria-labelledby]=\"_dialogLabelId ?? undefined\"\n  >\n  @switch (mode) {\n    @case ('input') {\n      <mat-time-inputs\n        [id]=\"timepicker.id\"\n        [isMeridiem]=\"isMeridiem\"\n        [selected]=\"_getSelected()\"\n        [minTime]=\"timepicker._getMinTime()\"\n        [maxTime]=\"timepicker._getMaxTime()\"\n        [minuteInterval]=\"minuteInterval\"\n        (_userSelection)=\"_handleUserSelection($event)\"\n      ></mat-time-inputs>\n      <div class=\"mat-timepicker-content-actions\">\n        @if (showToggleModeButton && false) {\n          <button\n            class=\"mat-time-toggle-mode-button\"\n            mat-icon-button\n            (click)=\"onToggleMode('dial')\"\n            >\n            <svg\n              xmlns=\"http://www.w3.org/2000/svg\"\n              height=\"24\"\n              width=\"24\"\n              viewBox=\"0 0 24 24\"\n              >\n              <path\n                d=\"m15.175 16.625 1.475-1.45-3.6-3.6V7.1h-2.075v5.3ZM12 21.95q-2.075 0-3.887-.787-1.813-.788-3.15-2.125-1.338-1.338-2.125-3.151Q2.05 14.075 2.05 12t.788-3.887q.787-1.813 2.125-3.15Q6.3 3.625 8.113 2.837 9.925 2.05 12 2.05t3.887.787q1.813.788 3.151 2.126 1.337 1.337 2.125 3.15.787 1.812.787 3.887t-.787 3.887q-.788 1.813-2.125 3.151-1.338 1.337-3.151 2.125-1.812.787-3.887.787ZM12 12Zm0 7.8q3.225 0 5.513-2.275Q19.8 15.25 19.8 12q0-3.25-2.287-5.525Q15.225 4.2 12 4.2T6.488 6.475Q4.2 8.75 4.2 12q0 3.25 2.288 5.525Q8.775 19.8 12 19.8Z\"\n                />\n              </svg>\n            </button>\n          }\n          <ng-template [cdkPortalOutlet]=\"_actionsPortal\"></ng-template>\n        </div>\n      }\n      @case ('dial') {\n        <mat-clock-dials\n          [id]=\"timepicker.id\"\n          [isMeridiem]=\"isMeridiem\"\n          [selected]=\"_getSelected()\"\n          [minTime]=\"timepicker._getMinTime()\"\n          [maxTime]=\"timepicker._getMaxTime()\"\n          [minuteInterval]=\"minuteInterval\"\n          [orientation]=\"orientation\"\n          (_userSelection)=\"_handleUserSelection($event)\"\n        ></mat-clock-dials>\n        <div class=\"mat-timepicker-content-actions\">\n          @if (showToggleModeButton && false) {\n            <button\n              class=\"mat-time-toggle-mode-button\"\n              mat-icon-button\n              (click)=\"onToggleMode('input')\"\n              >\n              <svg\n                xmlns=\"http://www.w3.org/2000/svg\"\n                height=\"24\"\n                width=\"24\"\n                viewBox=\"0 0 24 24\"\n                >\n                <path\n                  d=\"M4 19q-.825 0-1.412-.587Q2 17.825 2 17V7q0-.825.588-1.412Q3.175 5 4 5h16q.825 0 1.413.588Q22 6.175 22 7v10q0 .825-.587 1.413Q20.825 19 20 19Zm0-2h16V7H4v10Zm4-1h8v-2H8Zm-3-3h2v-2H5Zm3 0h2v-2H8Zm3 0h2v-2h-2Zm3 0h2v-2h-2Zm3 0h2v-2h-2ZM5 10h2V8H5Zm3 0h2V8H8Zm3 0h2V8h-2Zm3 0h2V8h-2Zm3 0h2V8h-2ZM4 17V7v10Z\"\n                  />\n                </svg>\n              </button>\n            }\n            <ng-template [cdkPortalOutlet]=\"_actionsPortal\"></ng-template>\n          </div>\n        }\n      }\n\n      <!-- Invisible close button for screen reader users. -->\n      <button\n        type=\"button\"\n        class=\"mat-timepicker-close-button\"\n        mat-raised-button\n        [class.cdk-visually-hidden]=\"!_closeButtonFocused\"\n        (focus)=\"_closeButtonFocused = true\"\n        (blur)=\"_closeButtonFocused = false\"\n        (click)=\"timepicker.close()\"\n        >\n        {{ _closeButtonText }}\n      </button>\n    </div>\n", styles: [".mat-timepicker-content{display:block;border-radius:4px;transform-origin:top center;will-change:transform,opacity}.mat-timepicker-content.enter-dialog{animation:timepickerDialogIn .15s cubic-bezier(0,0,.2,1) both}@keyframes timepickerDialogIn{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:scale(1)}}.mat-timepicker-content.enter-dropdown{animation:timepickerDropdownIn .12s cubic-bezier(0,0,.2,1) both}@keyframes timepickerDropdownIn{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scaleY(1)}}.mat-timepicker-content.exiting{animation:timepickerOut .1s linear forwards}@keyframes timepickerOut{0%{opacity:1}to{opacity:0}}.mat-timepicker-content .mat-timepicker-content-actions,.mat-timepicker-content mat-time-inputs,.mat-timepicker-content mat-clock-dials{animation:timepickerContentFade .15s ease-out both}@keyframes timepickerContentFade{0%{opacity:0}to{opacity:1}}.mat-timepicker-content-container{position:relative;display:flex;flex-direction:column;padding:0;background:var(--WHITE);border-radius:5px;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f}.mat-timepicker-content-actions{display:flex;align-items:center;margin-top:10px;padding:1rem 1.3rem;gap:50px}.mat-time-toggle-mode-button{width:3.25rem;height:3.25rem;margin-left:-.75rem;margin-bottom:-.25rem}button.mat-timepicker-close-button{position:absolute;top:100%;left:0;margin-top:.5rem}.ng-animating button.mat-timepicker-close-button{display:none}\n"], dependencies: [{ kind: "component", type: i2.MatButton, selector: "    button[matButton], a[matButton], button[mat-button], button[mat-raised-button],    button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button],    a[mat-flat-button], a[mat-stroked-button]  ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i4.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "directive", type: i5.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: MatTimeInputs, selector: "mat-time-inputs" }, { kind: "component", type: MatClockDials, selector: "mat-clock-dials", inputs: ["orientation"], exportAs: ["matClockDials"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerContent, decorators: [{
            type: Component,
            args: [{ selector: 'mat-timepicker-content', exportAs: 'matTimepickerContent', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'mat-timepicker-content',
                        '[class.enter-dialog]': '_animationState === "enter-dialog"',
                        '[class.enter-dropdown]': '_animationState === "enter-dropdown"',
                        '[class.exiting]': '_animationState === "void"',
                        // '[class.mat-timepicker-content-touch]': 'timepicker.touchUi',
                    }, standalone: false, template: "<div\n  cdkTrapFocus\n  role=\"dialog\"\n  class=\"mat-timepicker-content-container\"\n  [attr.aria-modal]=\"true\"\n  [attr.aria-labelledby]=\"_dialogLabelId ?? undefined\"\n  >\n  @switch (mode) {\n    @case ('input') {\n      <mat-time-inputs\n        [id]=\"timepicker.id\"\n        [isMeridiem]=\"isMeridiem\"\n        [selected]=\"_getSelected()\"\n        [minTime]=\"timepicker._getMinTime()\"\n        [maxTime]=\"timepicker._getMaxTime()\"\n        [minuteInterval]=\"minuteInterval\"\n        (_userSelection)=\"_handleUserSelection($event)\"\n      ></mat-time-inputs>\n      <div class=\"mat-timepicker-content-actions\">\n        @if (showToggleModeButton && false) {\n          <button\n            class=\"mat-time-toggle-mode-button\"\n            mat-icon-button\n            (click)=\"onToggleMode('dial')\"\n            >\n            <svg\n              xmlns=\"http://www.w3.org/2000/svg\"\n              height=\"24\"\n              width=\"24\"\n              viewBox=\"0 0 24 24\"\n              >\n              <path\n                d=\"m15.175 16.625 1.475-1.45-3.6-3.6V7.1h-2.075v5.3ZM12 21.95q-2.075 0-3.887-.787-1.813-.788-3.15-2.125-1.338-1.338-2.125-3.151Q2.05 14.075 2.05 12t.788-3.887q.787-1.813 2.125-3.15Q6.3 3.625 8.113 2.837 9.925 2.05 12 2.05t3.887.787q1.813.788 3.151 2.126 1.337 1.337 2.125 3.15.787 1.812.787 3.887t-.787 3.887q-.788 1.813-2.125 3.151-1.338 1.337-3.151 2.125-1.812.787-3.887.787ZM12 12Zm0 7.8q3.225 0 5.513-2.275Q19.8 15.25 19.8 12q0-3.25-2.287-5.525Q15.225 4.2 12 4.2T6.488 6.475Q4.2 8.75 4.2 12q0 3.25 2.288 5.525Q8.775 19.8 12 19.8Z\"\n                />\n              </svg>\n            </button>\n          }\n          <ng-template [cdkPortalOutlet]=\"_actionsPortal\"></ng-template>\n        </div>\n      }\n      @case ('dial') {\n        <mat-clock-dials\n          [id]=\"timepicker.id\"\n          [isMeridiem]=\"isMeridiem\"\n          [selected]=\"_getSelected()\"\n          [minTime]=\"timepicker._getMinTime()\"\n          [maxTime]=\"timepicker._getMaxTime()\"\n          [minuteInterval]=\"minuteInterval\"\n          [orientation]=\"orientation\"\n          (_userSelection)=\"_handleUserSelection($event)\"\n        ></mat-clock-dials>\n        <div class=\"mat-timepicker-content-actions\">\n          @if (showToggleModeButton && false) {\n            <button\n              class=\"mat-time-toggle-mode-button\"\n              mat-icon-button\n              (click)=\"onToggleMode('input')\"\n              >\n              <svg\n                xmlns=\"http://www.w3.org/2000/svg\"\n                height=\"24\"\n                width=\"24\"\n                viewBox=\"0 0 24 24\"\n                >\n                <path\n                  d=\"M4 19q-.825 0-1.412-.587Q2 17.825 2 17V7q0-.825.588-1.412Q3.175 5 4 5h16q.825 0 1.413.588Q22 6.175 22 7v10q0 .825-.587 1.413Q20.825 19 20 19Zm0-2h16V7H4v10Zm4-1h8v-2H8Zm-3-3h2v-2H5Zm3 0h2v-2H8Zm3 0h2v-2h-2Zm3 0h2v-2h-2Zm3 0h2v-2h-2ZM5 10h2V8H5Zm3 0h2V8H8Zm3 0h2V8h-2Zm3 0h2V8h-2Zm3 0h2V8h-2ZM4 17V7v10Z\"\n                  />\n                </svg>\n              </button>\n            }\n            <ng-template [cdkPortalOutlet]=\"_actionsPortal\"></ng-template>\n          </div>\n        }\n      }\n\n      <!-- Invisible close button for screen reader users. -->\n      <button\n        type=\"button\"\n        class=\"mat-timepicker-close-button\"\n        mat-raised-button\n        [class.cdk-visually-hidden]=\"!_closeButtonFocused\"\n        (focus)=\"_closeButtonFocused = true\"\n        (blur)=\"_closeButtonFocused = false\"\n        (click)=\"timepicker.close()\"\n        >\n        {{ _closeButtonText }}\n      </button>\n    </div>\n", styles: [".mat-timepicker-content{display:block;border-radius:4px;transform-origin:top center;will-change:transform,opacity}.mat-timepicker-content.enter-dialog{animation:timepickerDialogIn .15s cubic-bezier(0,0,.2,1) both}@keyframes timepickerDialogIn{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:scale(1)}}.mat-timepicker-content.enter-dropdown{animation:timepickerDropdownIn .12s cubic-bezier(0,0,.2,1) both}@keyframes timepickerDropdownIn{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scaleY(1)}}.mat-timepicker-content.exiting{animation:timepickerOut .1s linear forwards}@keyframes timepickerOut{0%{opacity:1}to{opacity:0}}.mat-timepicker-content .mat-timepicker-content-actions,.mat-timepicker-content mat-time-inputs,.mat-timepicker-content mat-clock-dials{animation:timepickerContentFade .15s ease-out both}@keyframes timepickerContentFade{0%{opacity:0}to{opacity:1}}.mat-timepicker-content-container{position:relative;display:flex;flex-direction:column;padding:0;background:var(--WHITE);border-radius:5px;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f}.mat-timepicker-content-actions{display:flex;align-items:center;margin-top:10px;padding:1rem 1.3rem;gap:50px}.mat-time-toggle-mode-button{width:3.25rem;height:3.25rem;margin-left:-.75rem;margin-bottom:-.25rem}button.mat-timepicker-close-button{position:absolute;top:100%;left:0;margin-top:.5rem}.ng-animating button.mat-timepicker-close-button{display:none}\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: MatTimepickerIntl }, { type: MatTimeSelectionModel }, { type: i0.ChangeDetectorRef }], propDecorators: { _dials: [{
                type: ViewChild,
                args: [MatClockDials]
            }], _inputs: [{
                type: ViewChild,
                args: [MatTimeInputs]
            }] } });

const MAT_DEFAULT_ACITONS = new InjectionToken('MAT_DEFAULT_ACITONS');

/**
 * Injection token that can be used to configure the
 * default options for all timepickers within an app.
 */
const MAT_TIMEPICKER_DEFAULT_OPTIONS = new InjectionToken('MAT_TIMEPICKER_DEFAULT_OPTIONS');
/** Default open as used by the timepicker. */
const DEFAULT_OPEN_AS = 'popup';
/** Default mode used by the timepicker. */
const DEFAULT_MODE = 'dial';
/** Default format used by the timepicker. */
const DEFAULT_FORMAT = '12h';
/** Used to generate a unique ID for each timepicker instance. */
let timepickerUid = 0;
class MatTimepickerBase {
    /** Whether the timepicker pop-up should be disabled. */
    get disabled() {
        return this._disabled === undefined && this.timepickerInput
            ? this.timepickerInput.disabled
            : !!this._disabled;
    }
    set disabled(value) {
        const newValue = coerceBooleanProperty(value);
        if (newValue !== this._disabled) {
            this._disabled = newValue;
            this.stateChanges.next(undefined);
        }
    }
    /** Whether the timepicker is open. */
    get opened() {
        return this._opened;
    }
    set opened(value) {
        coerceBooleanProperty(value) ? this.open() : this.close();
    }
    /** Whether the timepicker mode which determines what the timepicker will be opened as. */
    get openAs() {
        return this._openAs || this._defaults?.openAs || DEFAULT_OPEN_AS;
    }
    set openAs(value) {
        this._openAs = value;
    }
    /** Color palette to use on the timepicker's content. */
    get color() {
        return (this._color ||
            this._defaults?.color ||
            (this.timepickerInput
                ? this.timepickerInput.getThemePalette()
                : undefined));
    }
    set color(value) {
        this._color = value;
    }
    /** Timepicker display mode. */
    get mode() {
        return this._mode || this._defaults?.mode || DEFAULT_MODE;
    }
    set mode(value) {
        this._mode = value;
    }
    /** Timepicker period format. */
    get format() {
        return this._format || this._defaults?.format || DEFAULT_FORMAT;
    }
    set format(value) {
        this._format = value;
    }
    /** Show or hide toggle button between dial and input. */
    get showToggleModeButton() {
        return this._showToggleModeButton;
    }
    set showToggleModeButton(value) {
        this._showToggleModeButton = value;
    }
    /** Step for minutes. */
    get minuteInterval() {
        return this._minuteInterval || this._defaults?.minuteInterval || 1;
    }
    set minuteInterval(value) {
        this._minuteInterval = coerceNumberProperty(value);
    }
    /** Orientation for dial mode. */
    get orientation() {
        return this._orientation || this._defaults?.orientation || 'vertical';
    }
    set orientation(value) {
        this._orientation = value;
    }
    /**
     * Whether to restore focus to the previously-focused element when the timepicker is closed.
     * Note that automatic focus restoration is an accessibility feature and it is recommended that
     * you provide your own equivalent, if you decide to turn it off.
     */
    get restoreFocus() {
        return this._restoreFocus;
    }
    set restoreFocus(value) {
        this._restoreFocus = coerceBooleanProperty(value);
    }
    /** The minimum selectable time. */
    _getMinTime() {
        return this.timepickerInput && this.timepickerInput.min;
    }
    /** The maximum selectable time. */
    _getMaxTime() {
        return this.timepickerInput && this.timepickerInput.max;
    }
    constructor(_viewContainerRef, _overlay, _ngZone, scrollStrategy, _defaultActionsComponent, _model, _defaults) {
        this._viewContainerRef = _viewContainerRef;
        this._overlay = _overlay;
        this._ngZone = _ngZone;
        this._defaultActionsComponent = _defaultActionsComponent;
        this._model = _model;
        this._defaults = _defaults;
        this._opened = false;
        this._showToggleModeButton = true;
        /** Preferred position of the timepicker in the X axis. */
        this.xPosition = 'start';
        /** Preferred position of the timepicker in the Y axis. */
        this.yPosition = 'below';
        this._restoreFocus = true;
        /** Emits when the timepicker has been opened. */
        this.openedStream = new EventEmitter();
        /** Emits when the timepicker has been closed. */
        this.closedStream = new EventEmitter();
        /** The id for the timepicker. */
        this.id = `mat-timepicker-${timepickerUid++}`;
        /** Portal with projected action buttons. */
        this._actionsPortal = null;
        /** Emits when the timepicker's state changes. */
        this.stateChanges = new Subject();
        /** Unique class that will be added to the backdrop so that the test harnesses can look it up. */
        this._backdropHarnessClass = `${this.id}-backdrop`;
        /** The element that was focused before the timepicker was opened. */
        this._focusedElementBeforeOpen = null;
        this._document = inject(DOCUMENT);
        this._scrollStrategy = scrollStrategy;
        if (_defaults) {
            this.showToggleModeButton =
                _defaults.showToggleModeButton !== undefined
                    ? _defaults.showToggleModeButton
                    : true;
        }
    }
    ngOnChanges(changes) {
        const positionChange = changes['xPosition'] || changes['yPosition'];
        if (positionChange && !positionChange.firstChange && this._overlayRef) {
            const positionStrategy = this._overlayRef.getConfig().positionStrategy;
            if (positionStrategy instanceof FlexibleConnectedPositionStrategy) {
                this._setConnectedPositions(positionStrategy);
                if (this.opened) {
                    this._overlayRef.updatePosition();
                }
            }
        }
        this.stateChanges.next(undefined);
    }
    ngOnDestroy() {
        this._destroyOverlay();
        this.close();
        this.stateChanges.complete();
    }
    /** Opens the timepicker. */
    open() {
        if (this._opened ||
            this.disabled ||
            this._componentRef?.instance._isAnimating) {
            return;
        }
        if (!this.timepickerInput) {
            throw Error('Attempted to open an MatTimepicker with no associated input.');
        }
        this._focusedElementBeforeOpen = _getFocusedElementPierceShadowDom();
        this._openOverlay();
        this._opened = true;
        this.openedStream.emit();
    }
    /** Closes the timepicker. */
    close() {
        if (!this._opened || this._componentRef?.instance._isAnimating) {
            return;
        }
        const canRestoreFocus = this.restoreFocus &&
            this._focusedElementBeforeOpen &&
            typeof this._focusedElementBeforeOpen.focus === 'function';
        const completeClose = () => {
            // The `_opened` could've been reset already if
            // we got two events in quick succession.
            if (this._opened) {
                this._opened = false;
                this.closedStream.emit();
            }
        };
        if (this._componentRef) {
            const { instance, location } = this._componentRef;
            instance._startExitAnimation();
            instance._animationDone.pipe(take(1)).subscribe(() => {
                const activeElement = this._document.activeElement;
                // Since we restore focus after the exit animation, we have to check that
                // the user didn't move focus themselves inside the `close` handler.
                if (canRestoreFocus &&
                    (!activeElement ||
                        activeElement === this._document.activeElement ||
                        location.nativeElement.contains(activeElement))) {
                    this._focusedElementBeforeOpen.focus();
                }
                this._focusedElementBeforeOpen = null;
                this._destroyOverlay();
            });
            if (canRestoreFocus) {
                setTimeout(completeClose);
            }
            else {
                completeClose();
            }
        }
    }
    /**
     * Register an input with this timepicker.
     * @param input The timepicker input to register with this timepicker.
     * @returns Selection model that the input should hook itself up to.
     */
    registerInput(input) {
        if (this.timepickerInput) {
            throw Error('A MatTimepicker can only be associated with a single input.');
        }
        this.timepickerInput = input;
        return this._model;
    }
    /**
     * Registers a portal containing action buttons with the timepicker.
     * @param portal Portal to be registered.
     */
    registerActions(portal) {
        if (this._actionsPortal) {
            throw Error('A MatTimepicker can only be associated with a single actions row.');
        }
        this._actionsPortal = portal;
        this._componentRef?.instance._assignActions(portal, true);
    }
    /**
     * Removes a portal containing action buttons from the timepicker.
     * @param portal Portal to be removed.
     */
    removeActions(portal) {
        if (portal === this._actionsPortal) {
            this._actionsPortal = null;
            this._componentRef?.instance._assignActions(null, true);
        }
    }
    /** Applies the current pending selection on the overlay to the model. */
    _applyPendingSelection() {
        this._componentRef?.instance?._applyPendingSelection();
    }
    /** Forwards relevant values from the timepicker to the timepicker content inside the overlay. */
    _forwardContentValues(instance) {
        const defaultPortal = new ComponentPortal(this._defaultActionsComponent);
        instance.timepicker = this;
        //instance.color = this.color;
        instance.mode = this.mode;
        instance.isMeridiem = this.format === '12h';
        instance.showToggleModeButton = this.showToggleModeButton;
        instance.minuteInterval = this.minuteInterval;
        instance.orientation = this.orientation;
        instance._dialogLabelId = this.timepickerInput.getOverlayLabelId();
        instance._assignActions(this._actionsPortal || defaultPortal, false);
    }
    /** Opens the overlay with the timepicker. */
    _openOverlay() {
        this._destroyOverlay();
        const isDialog = this.openAs === 'dialog';
        const portal = new ComponentPortal(MatTimepickerContent, this._viewContainerRef);
        const overlayRef = (this._overlayRef = this._overlay.create(new OverlayConfig({
            positionStrategy: isDialog
                ? this._getDialogStrategy()
                : this._getDropdownStrategy(),
            hasBackdrop: true,
            backdropClass: [
                isDialog
                    ? 'cdk-overlay-dark-backdrop'
                    : 'mat-overlay-transparent-backdrop',
                this._backdropHarnessClass,
            ],
            direction: 'ltr',
            scrollStrategy: isDialog
                ? this._overlay.scrollStrategies.block()
                : this._scrollStrategy(),
            panelClass: `mat-timepicker-${this.openAs}`,
        })));
        this._getCloseStream(overlayRef).subscribe((event) => {
            if (event) {
                event.preventDefault();
            }
            this.close();
        });
        // The `preventDefault` call happens inside the timepicker as well, however focus moves into
        // it inside a timeout which can give browsers a chance to fire off a keyboard event in-between
        // that can scroll the page. Always block default actions of arrow keys for the
        // entire overlay so the page doesn't get scrolled by accident.
        overlayRef.keydownEvents().subscribe((event) => {
            const keyCode = event.keyCode;
            if (keyCode === UP_ARROW ||
                keyCode === DOWN_ARROW ||
                keyCode === PAGE_UP ||
                keyCode === PAGE_DOWN) {
                event.preventDefault();
            }
        });
        this._componentRef = overlayRef.attach(portal);
        this._forwardContentValues(this._componentRef.instance);
        // Update the position once the timepicker has rendered. Only relevant in dropdown mode.
        if (!isDialog) {
            this._ngZone.onStable
                .pipe(first())
                .subscribe(() => overlayRef.updatePosition());
        }
    }
    /** Destroys the current overlay. */
    _destroyOverlay() {
        if (this._overlayRef) {
            this._overlayRef.dispose();
            this._overlayRef = this._componentRef = null;
        }
    }
    /** Gets a position strategy that will open the timepicker as a dropdown. */
    _getDialogStrategy() {
        return this._overlay
            .position()
            .global()
            .centerHorizontally()
            .centerVertically();
    }
    /** Gets a position strategy that will open the timepicker as a dropdown. */
    _getDropdownStrategy() {
        const strategy = this._overlay
            .position()
            .flexibleConnectedTo(this.timepickerInput.getConnectedOverlayOrigin())
            .withTransformOriginOn('.mat-timepicker-content')
            .withFlexibleDimensions(false)
            .withViewportMargin(8)
            .withLockedPosition();
        return this._setConnectedPositions(strategy);
    }
    /** Sets the positions of the timepicker in dropdown mode based on the current configuration. */
    _setConnectedPositions(strategy) {
        const primaryX = this.xPosition === 'end' ? 'end' : 'start';
        const secondaryX = primaryX === 'start' ? 'end' : 'start';
        const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
        const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
        return strategy.withPositions([
            {
                originX: primaryX,
                originY: secondaryY,
                overlayX: primaryX,
                overlayY: primaryY,
            },
            {
                originX: primaryX,
                originY: primaryY,
                overlayX: primaryX,
                overlayY: secondaryY,
            },
            {
                originX: secondaryX,
                originY: secondaryY,
                overlayX: secondaryX,
                overlayY: primaryY,
            },
            {
                originX: secondaryX,
                originY: primaryY,
                overlayX: secondaryX,
                overlayY: secondaryY,
            },
        ]);
    }
    /** Gets an observable that will emit when the overlay is supposed to be closed. */
    _getCloseStream(overlayRef) {
        return merge(overlayRef.backdropClick(), overlayRef.detachments(), overlayRef.keydownEvents().pipe(filter((event) => {
            // Closing on alt + up is only valid when there's an input associated with the timepicker.
            return ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
                (this.timepickerInput &&
                    hasModifierKey(event, 'altKey') &&
                    event.keyCode === UP_ARROW));
        })));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerBase, deps: [{ token: i0.ViewContainerRef }, { token: i1$4.Overlay }, { token: i0.NgZone }, { token: MAT_TIMEPICKER_SCROLL_STRATEGY }, { token: MAT_DEFAULT_ACITONS }, { token: MatTimeSelectionModel }, { token: MAT_TIMEPICKER_DEFAULT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerBase, isStandalone: true, inputs: { disabled: "disabled", opened: "opened", openAs: "openAs", color: "color", mode: "mode", format: "format", showToggleModeButton: "showToggleModeButton", minuteInterval: "minuteInterval", orientation: "orientation", xPosition: "xPosition", yPosition: "yPosition", restoreFocus: "restoreFocus" }, outputs: { openedStream: "opened", closedStream: "closed" }, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerBase, decorators: [{
            type: Directive
        }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i1$4.Overlay }, { type: i0.NgZone }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_TIMEPICKER_SCROLL_STRATEGY]
                }] }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DEFAULT_ACITONS]
                }] }, { type: MatTimeSelectionModel }, { type: undefined, decorators: [{
                    type: Optional
                }, {
                    type: Inject,
                    args: [MAT_TIMEPICKER_DEFAULT_OPTIONS]
                }] }], propDecorators: { disabled: [{
                type: Input
            }], opened: [{
                type: Input
            }], openAs: [{
                type: Input
            }], color: [{
                type: Input
            }], mode: [{
                type: Input
            }], format: [{
                type: Input
            }], showToggleModeButton: [{
                type: Input
            }], minuteInterval: [{
                type: Input
            }], orientation: [{
                type: Input
            }], xPosition: [{
                type: Input
            }], yPosition: [{
                type: Input
            }], restoreFocus: [{
                type: Input
            }], openedStream: [{
                type: Output,
                args: ['opened']
            }], closedStream: [{
                type: Output,
                args: ['closed']
            }] } });

class MatTimepicker extends MatTimepickerBase {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepicker, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepicker, isStandalone: false, selector: "mat-timepicker", host: { properties: { "class.mat-primary": "color !== \"accent\" && color !== \"warn\"", "class.mat-accent": "color === \"accent\"", "class.mat-warn": "color === \"warn\"" }, classAttribute: "mat-timepicker" }, providers: [
            MAT_SINGLE_TIME_SELECTION_MODEL_PROVIDER,
            { provide: MatTimepickerBase, useExisting: MatTimepicker },
        ], exportAs: ["matTimepicker"], usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepicker, decorators: [{
            type: Component,
            args: [{
                    selector: 'mat-timepicker',
                    template: '',
                    exportAs: 'matTimepicker',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    encapsulation: ViewEncapsulation.None,
                    host: {
                        class: 'mat-timepicker',
                        '[class.mat-primary]': 'color !== "accent" && color !== "warn"',
                        '[class.mat-accent]': 'color === "accent"',
                        '[class.mat-warn]': 'color === "warn"',
                    },
                    providers: [
                        MAT_SINGLE_TIME_SELECTION_MODEL_PROVIDER,
                        { provide: MatTimepickerBase, useExisting: MatTimepicker },
                    ],
                    standalone: false
                }]
        }] });

class MatTimepickerToggleIcon {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerToggleIcon, isStandalone: false, selector: "[matTimepickerToggleIcon]", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerToggleIcon, decorators: [{
            type: Directive,
            args: [{
                    selector: '[matTimepickerToggleIcon]',
                    standalone: false
                }]
        }] });
class MatTimepickerToggle {
    /** Whether the toggle button is disabled. */
    get disabled() {
        if (this._disabled === undefined && this.timepicker) {
            return this.timepicker.disabled;
        }
        return !!this._disabled;
    }
    set disabled(value) {
        this._disabled = coerceBooleanProperty(value);
    }
    constructor(defaultTabIndex, _intl, _cdr) {
        this._intl = _intl;
        this._cdr = _cdr;
        this._stateChanges = Subscription.EMPTY;
        const parsedTabIndex = Number(defaultTabIndex);
        this.tabIndex =
            parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
    }
    ngOnChanges(changes) {
        if (changes['timepicker']) {
            this._watchStateChanges();
        }
    }
    ngOnDestroy() {
        this._stateChanges.unsubscribe();
    }
    /** Opens timepicker. */
    open(event) {
        if (this.timepicker && !this.disabled) {
            this.timepicker.open();
            event.stopPropagation();
        }
    }
    _watchStateChanges() {
        const timepickerStateChanged = this.timepicker
            ? this.timepicker.stateChanges
            : of();
        const inputStateChanged = this.timepicker && this.timepicker.timepickerInput
            ? this.timepicker.timepickerInput.stateChanges
            : of();
        const timepickerToggled = this.timepicker
            ? merge(this.timepicker.openedStream, this.timepicker.closedStream)
            : of();
        this._stateChanges.unsubscribe();
        this._stateChanges = merge(timepickerStateChanged, inputStateChanged, timepickerToggled).subscribe(() => this._cdr.markForCheck());
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerToggle, deps: [{ token: 'tabindex', attribute: true }, { token: MatTimepickerIntl }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: MatTimepickerToggle, isStandalone: false, selector: "mat-timepicker-toggle", inputs: { timepicker: ["for", "timepicker"], disabled: "disabled", disableRipple: "disableRipple", tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"] }, host: { listeners: { "click": "open($event)" }, properties: { "attr.tabindex": "null", "class.mat-timepicker-toggle-active": "timepicker && timepicker.opened" }, classAttribute: "mat-timepicker-toggle" }, queries: [{ propertyName: "customIcon", first: true, predicate: MatTimepickerToggleIcon, descendants: true }], exportAs: ["matTimepickerToggle"], usesOnChanges: true, ngImport: i0, template: "<button\n  type=\"button\"\n  #button\n  mat-icon-button\n  [attr.aria-haspopup]=\"timepicker ? 'dialog' : null\"\n  [attr.aria-label]=\"ariaLabel || _intl.openTimepickerLabel\"\n  [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n  [disabled]=\"disabled\"\n  [disableRipple]=\"disableRipple\"\n  >\n  @if (!customIcon) {\n    <svg\n      class=\"mat-timepicker-toggle-default-icon\"\n      viewBox=\"0 0 24 24\"\n      width=\"24\"\n      height=\"24\"\n      fill=\"currentColor\"\n      focusable=\"false\"\n      >\n      <path\n        d=\"M12,2C6.5,2,2,6.5,2,12s4.5,10,10,10s10-4.5,10-10S17.5,2,12,2z M12,20c-4.41,0-8-3.59-8-8s3.59-8,8-8s8,3.59,8,8 S16.41,20,12,20z M12.5,7H11v6l5.2,3.2l0.8-1.3l-4.5-2.7V7z\"\n        />\n      </svg>\n    }\n\n    <ng-content select=\"[matTimepickerToggleIcon]\"></ng-content>\n  </button>\n", styles: [".mat-form-field .mat-form-field-prefix .mat-timepicker-toggle-default-icon,.mat-form-field .mat-form-field-suffix .mat-timepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field .mat-form-field-prefix .mat-icon-button .mat-timepicker-toggle-default-icon,.mat-form-field .mat-form-field-suffix .mat-icon-button .mat-timepicker-toggle-default-icon{margin:auto}\n"], dependencies: [{ kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerToggle, decorators: [{
            type: Component,
            args: [{ selector: 'mat-timepicker-toggle', exportAs: 'matTimepickerToggle', host: {
                        class: 'mat-timepicker-toggle',
                        '[attr.tabindex]': 'null',
                        '[class.mat-timepicker-toggle-active]': 'timepicker && timepicker.opened',
                        '(click)': 'open($event)',
                    }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<button\n  type=\"button\"\n  #button\n  mat-icon-button\n  [attr.aria-haspopup]=\"timepicker ? 'dialog' : null\"\n  [attr.aria-label]=\"ariaLabel || _intl.openTimepickerLabel\"\n  [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n  [disabled]=\"disabled\"\n  [disableRipple]=\"disableRipple\"\n  >\n  @if (!customIcon) {\n    <svg\n      class=\"mat-timepicker-toggle-default-icon\"\n      viewBox=\"0 0 24 24\"\n      width=\"24\"\n      height=\"24\"\n      fill=\"currentColor\"\n      focusable=\"false\"\n      >\n      <path\n        d=\"M12,2C6.5,2,2,6.5,2,12s4.5,10,10,10s10-4.5,10-10S17.5,2,12,2z M12,20c-4.41,0-8-3.59-8-8s3.59-8,8-8s8,3.59,8,8 S16.41,20,12,20z M12.5,7H11v6l5.2,3.2l0.8-1.3l-4.5-2.7V7z\"\n        />\n      </svg>\n    }\n\n    <ng-content select=\"[matTimepickerToggleIcon]\"></ng-content>\n  </button>\n", styles: [".mat-form-field .mat-form-field-prefix .mat-timepicker-toggle-default-icon,.mat-form-field .mat-form-field-suffix .mat-timepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field .mat-form-field-prefix .mat-icon-button .mat-timepicker-toggle-default-icon,.mat-form-field .mat-form-field-suffix .mat-icon-button .mat-timepicker-toggle-default-icon{margin:auto}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Attribute,
                    args: ['tabindex']
                }] }, { type: MatTimepickerIntl }, { type: i0.ChangeDetectorRef }], propDecorators: { timepicker: [{
                type: Input,
                args: ['for']
            }], disabled: [{
                type: Input
            }], disableRipple: [{
                type: Input
            }], tabIndex: [{
                type: Input
            }], customIcon: [{
                type: ContentChild,
                args: [MatTimepickerToggleIcon]
            }], ariaLabel: [{
                type: Input,
                args: ['aria-label']
            }] } });

/**
 * An event used for timepicker input and change events. We don't always have access to a native
 * input or change event because the event may have been triggered by the user clicking on the
 * clock popup. For consistency, we always use MatTimepickerInputEvent instead.
 */
class MatTimepickerInputEvent {
    constructor(
    /** Reference to the timepicker input component that emitted the event. */
    target, 
    /** Reference to the native input element associated with the timepicker input. */
    targetElement) {
        this.target = target;
        this.targetElement = targetElement;
        this.value = this.target.value;
    }
}
const TIME_FORMATS = { hour: '2-digit', minute: '2-digit' };
class MatTimepickerInputBase {
    /** The value of the input. */
    get value() {
        return this._model
            ? this._getValueFromModel(this._model.selection)
            : this._pendingValue;
    }
    set value(value) {
        this._assignValueProgrammatically(value);
    }
    /** Whether the timepicker-input is disabled. */
    get disabled() {
        return !!this._disabled;
    }
    set disabled(value) {
        const newValue = coerceBooleanProperty(value);
        const element = this._elementRef.nativeElement;
        if (this._disabled !== newValue) {
            this._disabled = newValue;
            this.stateChanges.next(undefined);
        }
        // We need to null check the `blur` method, because it's undefined during SSR.
        // In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
        // This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
        // element has been inserted.
        if (newValue && this._isInitialized && element.blur) {
            // Normally, native input elements automatically blur if they turn disabled. This behavior
            // is problematic, because it would mean that it triggers another change detection cycle,
            // which then causes a changed after checked error if the input element was focused before.
            element.blur();
        }
    }
    constructor(_elementRef, _timeAdapter) {
        this._elementRef = _elementRef;
        this._timeAdapter = _timeAdapter;
        /** Emits when a change event is fired on this <input>. */
        this.timeChange = new EventEmitter();
        /** Emits when an input event is fired on this <input>. */
        this.timeInput = new EventEmitter();
        /** Emits when the internal state has changed */
        this.stateChanges = new Subject();
        this._onTouched = () => { };
        this._validatorOnChange = () => { };
        this._cvaOnChange = () => { };
        this._valueChangesSubscription = Subscription.EMPTY;
        /** Whether the last value set on the input was valid. */
        this._lastValueValid = false;
        /** The form control validator for whether the input parses. */
        this._parseValidator = () => {
            return this._lastValueValid
                ? null
                : { matTimepickerParse: { text: this._elementRef.nativeElement.value } };
        };
        /** The form control validator for the min time. */
        this._minValidator = (control) => {
            const controlValue = this._timeAdapter.getValidTimeOrNull(this._timeAdapter.deserialize(control.value));
            const min = this._getMinTime();
            return !min ||
                !controlValue ||
                this._timeAdapter.compareTime(min, controlValue) <= 0
                ? null
                : { matTimepickerMin: { min, actual: controlValue } };
        };
        /** The form control validator for the max time. */
        this._maxValidator = (control) => {
            const controlValue = this._timeAdapter.getValidTimeOrNull(this._timeAdapter.deserialize(control.value));
            const max = this._getMaxTime();
            return !max ||
                !controlValue ||
                this._timeAdapter.compareTime(max, controlValue) >= 0
                ? null
                : { matTimepickerMax: { max, actual: controlValue } };
        };
    }
    ngOnChanges(changes) {
        if (timeInputsHaveChanged(changes, this._timeAdapter)) {
            this.stateChanges.next(undefined);
        }
    }
    ngOnDestroy() {
        this._valueChangesSubscription.unsubscribe();
        this.stateChanges.complete();
    }
    /** Registers a time selection model with the input. */
    _registerModel(model) {
        this._model = model;
        this._valueChangesSubscription.unsubscribe();
        if (this._pendingValue) {
            this._assignValue(this._pendingValue);
        }
        this._valueChangesSubscription = this._model.selectionChanged.subscribe((event) => {
            if (this._shouldHandleChangeEvent(event)) {
                const value = this._getValueFromModel(event.selection);
                this._lastValueValid = this._isValidValue(value);
                this._cvaOnChange(value);
                this._onTouched();
                this._formatValue(value);
                this.timeInput.emit(new MatTimepickerInputEvent(this, this._elementRef.nativeElement));
                this.timeChange.emit(new MatTimepickerInputEvent(this, this._elementRef.nativeElement));
            }
        });
    }
    _onInput(value) {
        const lastValueWasValid = this._lastValueValid;
        let time = this._timeAdapter.parse(value, TIME_FORMATS);
        this._lastValueValid = this._isValidValue(time);
        time = this._timeAdapter.getValidTimeOrNull(time);
        const hasChanged = !this._timeAdapter.sameTime(time, this.value);
        // We need to fire the CVA change event for all
        // nulls, otherwise the validators won't run.
        if (!time || hasChanged) {
            this._cvaOnChange(time);
        }
        else {
            // Call the CVA change handler for invalid values
            // since this is what marks the control as dirty.
            if (value && !this.value) {
                this._cvaOnChange(time);
            }
            if (lastValueWasValid !== this._lastValueValid) {
                this._validatorOnChange();
            }
        }
        if (hasChanged) {
            this._assignValue(time);
            this.timeInput.emit(new MatTimepickerInputEvent(this, this._elementRef.nativeElement));
        }
    }
    /** Handles change event on the input. */
    _onChange() {
        this.timeChange.emit(new MatTimepickerInputEvent(this, this._elementRef.nativeElement));
    }
    /** Handles blur event on the input. */
    _onBlur() {
        // Reformat the input only if we have a valid value.
        if (this.value) {
            this._formatValue(this.value);
        }
        this._onTouched();
    }
    /** Implemented as part of ControlValueAccessor.  */
    writeValue(value) {
        this.value = value;
    }
    /** Implemented as part of ControlValueAccessor.  */
    registerOnChange(fn) {
        this._cvaOnChange = fn;
    }
    /** Implemented as part of ControlValueAccessor.  */
    registerOnTouched(fn) {
        this._onTouched = fn;
    }
    /** Implemented as part of ControlValueAccessor.  */
    setDisabledState(isDisabled) {
        this.disabled = isDisabled;
    }
    registerOnValidatorChange(fn) {
        this._validatorOnChange = fn;
    }
    validate(c) {
        return this._validator ? this._validator(c) : null;
    }
    /** Programmatically assigns a value to the input. */
    _assignValueProgrammatically(value) {
        value = this._timeAdapter.deserialize(value);
        this._lastValueValid = this._isValidValue(value);
        value = this._timeAdapter.getValidTimeOrNull(value);
        this._assignValue(value);
        this._formatValue(value);
    }
    /** Formats a value and sets it on the input element. */
    _formatValue(value) {
        this._elementRef.nativeElement.value =
            value != null ? this._timeAdapter.format(value, TIME_FORMATS) : '';
    }
    /** Gets the base validator functions. */
    _getValidators() {
        return [this._parseValidator, this._minValidator, this._maxValidator];
    }
    /** Whether a value is considered valid. */
    _isValidValue(value) {
        return !value || this._timeAdapter.isValid(value);
    }
    /** Assigns a value to the model. */
    _assignValue(value) {
        // We may get some incoming values before the model was
        // assigned. Save the value so that we can assign it later.
        if (this._model) {
            this._assignValueToModel(value);
            this._pendingValue = null;
        }
        else {
            this._pendingValue = value;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerInputBase, deps: [{ token: i0.ElementRef }, { token: TimeAdapter, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerInputBase, isStandalone: true, inputs: { value: "value", disabled: "disabled" }, outputs: { timeChange: "timeChange", timeInput: "timeInput" }, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerInputBase, decorators: [{
            type: Directive
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: TimeAdapter, decorators: [{
                    type: Optional
                }] }], propDecorators: { value: [{
                type: Input
            }], disabled: [{
                type: Input
            }], timeChange: [{
                type: Output
            }], timeInput: [{
                type: Output
            }] } });
/**
 * Checks whether the `SimpleChanges` object from an `ngOnChanges`
 * callback has any changes, accounting for time objects.
 */
function timeInputsHaveChanged(changes, adapter) {
    const keys = Object.keys(changes);
    for (const key of keys) {
        const { previousValue, currentValue } = changes[key];
        if (adapter.isTimeInstance(previousValue) &&
            adapter.isTimeInstance(currentValue)) {
            if (!adapter.sameTime(previousValue, currentValue)) {
                return true;
            }
        }
        else {
            return true;
        }
    }
    return false;
}

const MAT_TIMEPICKER_VALUE_ACCESSOR = {
    provide: NG_VALUE_ACCESSOR,
    useExisting: forwardRef(() => MatTimepickerInput),
    multi: true,
};
const MAT_TIMEPICKER_VALIDATORS = {
    provide: NG_VALIDATORS,
    useExisting: forwardRef(() => MatTimepickerInput),
    multi: true,
};
/** Directive used to connect an input to a MatTimepicker. */
class MatTimepickerInput extends MatTimepickerInputBase {
    /** The timepicker that this input is associated with. */
    set matTimepicker(timepicker) {
        if (timepicker) {
            this._timepicker = timepicker;
            this._registerModel(timepicker.registerInput(this));
        }
    }
    /** The minimum valid date. */
    get min() {
        return this._min;
    }
    set min(value) {
        const validValue = this._timeAdapter.getValidTimeOrNull(this._timeAdapter.deserialize(value));
        if (!this._timeAdapter.sameTime(validValue, this._min)) {
            this._min = validValue;
            this._validatorOnChange();
        }
    }
    /** The maximum valid date. */
    get max() {
        return this._max;
    }
    set max(value) {
        const validValue = this._timeAdapter.getValidTimeOrNull(this._timeAdapter.deserialize(value));
        if (!this._timeAdapter.sameTime(validValue, this._max)) {
            this._max = validValue;
            this._validatorOnChange();
        }
    }
    constructor(elementRef, timeAdapter, _formField) {
        super(elementRef, timeAdapter);
        this._formField = _formField;
        this._validator = Validators.compose(super._getValidators());
    }
    /**
     * Gets the element that the timepicker popup should be connected to.
     * @return The element to connect the popup to.
     */
    getConnectedOverlayOrigin() {
        return this._formField
            ? this._formField.getConnectedOverlayOrigin()
            : this._elementRef;
    }
    /** Returns the palette used by the input's form field, if any. */
    getThemePalette() {
        return this._formField ? this._formField.color : undefined;
    }
    /** Gets the ID of an element that should be used a description for the timepicker overlay. */
    getOverlayLabelId() {
        if (this._formField) {
            return this._formField.getLabelId();
        }
        return this._elementRef.nativeElement.getAttribute('aria-labelledby');
    }
    /** Gets the input's minimum time. */
    _getMinTime() {
        return this._min;
    }
    /** Gets the input's maximum time. */
    _getMaxTime() {
        return this._max;
    }
    _assignValueToModel(value) {
        if (this._model) {
            this._model.updateSelection(value, this);
        }
    }
    _getValueFromModel(modelValue) {
        return modelValue;
    }
    _shouldHandleChangeEvent(event) {
        return event.source !== this;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerInput, deps: [{ token: i0.ElementRef }, { token: TimeAdapter, optional: true }, { token: MAT_FORM_FIELD, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerInput, isStandalone: false, selector: "input[matTimepicker]", inputs: { matTimepicker: "matTimepicker", min: "min", max: "max" }, host: { listeners: { "input": "_onInput($event.target.value)", "change": "_onChange()", "blur": "_onBlur()" }, properties: { "attr.aria-haspopup": "_timepicker ? \"dialog\" : null", "attr.aria-owns": "(_timepicker?.opened && _timepicker.id) || null", "attr.min": "min || null", "attr.max": "max || null", "disabled": "disabled" }, classAttribute: "mat-timepicker-input" }, providers: [
            MAT_TIMEPICKER_VALUE_ACCESSOR,
            MAT_TIMEPICKER_VALIDATORS,
            { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MatTimepickerInput },
        ], exportAs: ["matTimepickerInput"], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerInput, decorators: [{
            type: Directive,
            args: [{
                    selector: 'input[matTimepicker]',
                    exportAs: 'matTimepickerInput',
                    providers: [
                        MAT_TIMEPICKER_VALUE_ACCESSOR,
                        MAT_TIMEPICKER_VALIDATORS,
                        { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MatTimepickerInput },
                    ],
                    host: {
                        class: 'mat-timepicker-input',
                        '[attr.aria-haspopup]': '_timepicker ? "dialog" : null',
                        '[attr.aria-owns]': '(_timepicker?.opened && _timepicker.id) || null',
                        '[attr.min]': 'min || null',
                        '[attr.max]': 'max || null',
                        '[disabled]': 'disabled',
                        '(input)': '_onInput($event.target.value)',
                        '(change)': '_onChange()',
                        '(blur)': '_onBlur()',
                    },
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: TimeAdapter, decorators: [{
                    type: Optional
                }] }, { type: i2$2.MatFormField, decorators: [{
                    type: Optional
                }, {
                    type: Inject,
                    args: [MAT_FORM_FIELD]
                }] }], propDecorators: { matTimepicker: [{
                type: Input
            }], min: [{
                type: Input
            }], max: [{
                type: Input
            }] } });

/** Button that will close the timepicker and assign the current selection to the data model. */
class MatTimepickerApply {
    constructor(_timepicker) {
        this._timepicker = _timepicker;
    }
    _applySelection() {
        this._timepicker._applyPendingSelection();
        this._timepicker.close();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerApply, deps: [{ token: MatTimepickerBase }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerApply, isStandalone: false, selector: "[matTimepickerApply]", host: { listeners: { "click": "_applySelection()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerApply, decorators: [{
            type: Directive,
            args: [{
                    selector: '[matTimepickerApply]',
                    host: {
                        '(click)': '_applySelection()',
                    },
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: MatTimepickerBase }] });
/** Button that will close the timepicker and discard the current selection. */
class MatTimepickerCancel {
    constructor(_timepicker) {
        this._timepicker = _timepicker;
    }
    close() {
        this._timepicker.close();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerCancel, deps: [{ token: MatTimepickerBase }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerCancel, isStandalone: false, selector: "[matTimepickerCancel]", host: { listeners: { "click": "close()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerCancel, decorators: [{
            type: Directive,
            args: [{
                    selector: '[matTimepickerCancel]',
                    host: {
                        '(click)': 'close()',
                    },
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: MatTimepickerBase }] });
/**
 * Container that can be used to project a row of action buttons
 * to the bottom of a timepicker.
 */
class MatTimepickerActions {
    constructor(_timepicker, _viewContainerRef) {
        this._timepicker = _timepicker;
        this._viewContainerRef = _viewContainerRef;
    }
    ngAfterViewInit() {
        this._portal = new TemplatePortal(this._template, this._viewContainerRef);
        this._timepicker.registerActions(this._portal);
    }
    ngOnDestroy() {
        this._timepicker.removeActions(this._portal);
        // Needs to be null checked since we initialize it in `ngAfterViewInit`.
        if (this._portal && this._portal.isAttached) {
            this._portal?.detach();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerActions, deps: [{ token: MatTimepickerBase }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerActions, isStandalone: false, selector: "mat-timepicker-actions", host: { classAttribute: "mat-timepicker-actions-container" }, viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0, template: `
    <ng-template>
      <div class="mat-timepicker-actions">
        <ng-content></ng-content>
      </div>
    </ng-template>
  `, isInline: true, styles: [".mat-timepicker-actions-container{margin-left:auto}.mat-timepicker-actions{display:flex;gap:10px;align-items:center}.mat-timepicker-actions button{font-family:var(--font-bold);border-radius:4px;cursor:pointer;position:relative;background:transparent;text-transform:uppercase;letter-spacing:.03em;border:2px solid var(--PRIMARY);min-width:70px;min-height:30px;font-size:10px;padding:0 10px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerActions, decorators: [{
            type: Component,
            args: [{ selector: 'mat-timepicker-actions', template: `
    <ng-template>
      <div class="mat-timepicker-actions">
        <ng-content></ng-content>
      </div>
    </ng-template>
  `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'mat-timepicker-actions-container',
                    }, standalone: false, styles: [".mat-timepicker-actions-container{margin-left:auto}.mat-timepicker-actions{display:flex;gap:10px;align-items:center}.mat-timepicker-actions button{font-family:var(--font-bold);border-radius:4px;cursor:pointer;position:relative;background:transparent;text-transform:uppercase;letter-spacing:.03em;border:2px solid var(--PRIMARY);min-width:70px;min-height:30px;font-size:10px;padding:0 10px}\n"] }]
        }], ctorParameters: () => [{ type: MatTimepickerBase }, { type: i0.ViewContainerRef }], propDecorators: { _template: [{
                type: ViewChild,
                args: [TemplateRef]
            }] } });
// Boilerplate for applying mixins to MatTimepickerDefaultActions.
/*const _MatTimepickerDefaultActions = mixinColor(
  class {
    constructor(public _elementRef: ElementRef) {}
  },
);*/
/**
 * Default action buttons to the bottom of a timepicker.
 */
class MatTimepickerDefaultActions {
    constructor(elementRef, _timepicker, _intl) {
        this._timepicker = _timepicker;
        this._intl = _intl;
        //super(elementRef);
    }
    ngOnInit() {
        //this.color = this._timepicker.color;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerDefaultActions, deps: [{ token: i0.ElementRef }, { token: MatTimepickerBase }, { token: MatTimepickerIntl }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: MatTimepickerDefaultActions, isStandalone: false, selector: "mat-timepicker-default-actions", host: { classAttribute: "mat-timepicker-actions-container" }, ngImport: i0, template: `
    <div class="mat-timepicker-actions">
      <ng-content></ng-content>
      <button class="btn-primary sln-btn-full-s"  mat-button matTimepickerCancel>
        {{ _intl.cancelButton }}
      </button>
      <button class="btn-primary sln-btn-full-s"  mat-button matTimepickerApply>
        {{ _intl.okButton }}
      </button>
    </div>
  `, isInline: true, styles: [".mat-timepicker-actions-container{margin-left:auto}.mat-timepicker-actions{display:flex;gap:10px;align-items:center}.mat-timepicker-actions button{font-family:var(--font-bold);border-radius:4px;cursor:pointer;position:relative;background:transparent;text-transform:uppercase;letter-spacing:.03em;border:2px solid var(--PRIMARY);min-width:70px;min-height:30px;font-size:10px;padding:0 10px}\n"], dependencies: [{ kind: "component", type: i2.MatButton, selector: "    button[matButton], a[matButton], button[mat-button], button[mat-raised-button],    button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button],    a[mat-flat-button], a[mat-stroked-button]  ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatTimepickerApply, selector: "[matTimepickerApply]" }, { kind: "directive", type: MatTimepickerCancel, selector: "[matTimepickerCancel]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerDefaultActions, decorators: [{
            type: Component,
            args: [{ selector: 'mat-timepicker-default-actions', template: `
    <div class="mat-timepicker-actions">
      <ng-content></ng-content>
      <button class="btn-primary sln-btn-full-s"  mat-button matTimepickerCancel>
        {{ _intl.cancelButton }}
      </button>
      <button class="btn-primary sln-btn-full-s"  mat-button matTimepickerApply>
        {{ _intl.okButton }}
      </button>
    </div>
  `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'mat-timepicker-actions-container',
                    }, standalone: false, styles: [".mat-timepicker-actions-container{margin-left:auto}.mat-timepicker-actions{display:flex;gap:10px;align-items:center}.mat-timepicker-actions button{font-family:var(--font-bold);border-radius:4px;cursor:pointer;position:relative;background:transparent;text-transform:uppercase;letter-spacing:.03em;border:2px solid var(--PRIMARY);min-width:70px;min-height:30px;font-size:10px;padding:0 10px}\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: MatTimepickerBase }, { type: MatTimepickerIntl }] });

class MatTimepickerModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerModule, declarations: [MatTimepickerToggle,
            MatTimepickerToggleIcon,
            MatTimepicker,
            MatTimepickerContent,
            MatTimepickerContentLayout,
            MatTimepickerInput,
            MatTimeInputs,
            MatHourInput,
            MatMinuteInput,
            MatClockDials,
            MatHoursClockDial,
            MatMinutesClockDial,
            MatTimePeriod,
            MatTimepickerActions,
            MatTimepickerDefaultActions,
            MatTimepickerApply,
            MatTimepickerCancel], imports: [CommonModule,
            MatButtonModule,
            MatFormFieldModule,
            MatInputModule,
            MatIconModule,
            MatRippleModule,
            MatDividerModule,
            OverlayModule,
            PortalModule,
            A11yModule], exports: [CdkScrollableModule,
            MatTimepickerToggle,
            MatTimepickerToggleIcon,
            MatTimepicker,
            MatTimepickerContent,
            MatTimepickerContentLayout,
            MatTimepickerInput,
            MatTimeInputs,
            MatHourInput,
            MatMinuteInput,
            MatClockDials,
            MatHoursClockDial,
            MatMinutesClockDial,
            MatTimepickerActions,
            MatTimepickerDefaultActions,
            MatTimepickerApply,
            MatTimepickerCancel] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerModule, providers: [
            MatTimepickerIntl,
            MAT_TIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER,
            { provide: Window, useValue: window },
            { provide: MAT_DEFAULT_ACITONS, useValue: MatTimepickerDefaultActions },
            {
                provide: MAT_FAB_DEFAULT_OPTIONS,
                useValue: { color: 'unthemed' },
            },
        ], imports: [CommonModule,
            MatButtonModule,
            MatFormFieldModule,
            MatInputModule,
            MatIconModule,
            MatRippleModule,
            MatDividerModule,
            OverlayModule,
            PortalModule,
            A11yModule, CdkScrollableModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatTimepickerModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        MatTimepickerToggle,
                        MatTimepickerToggleIcon,
                        MatTimepicker,
                        MatTimepickerContent,
                        MatTimepickerContentLayout,
                        MatTimepickerInput,
                        MatTimeInputs,
                        MatHourInput,
                        MatMinuteInput,
                        MatClockDials,
                        MatHoursClockDial,
                        MatMinutesClockDial,
                        MatTimePeriod,
                        MatTimepickerActions,
                        MatTimepickerDefaultActions,
                        MatTimepickerApply,
                        MatTimepickerCancel,
                    ],
                    imports: [
                        CommonModule,
                        MatButtonModule,
                        MatFormFieldModule,
                        MatInputModule,
                        MatIconModule,
                        MatRippleModule,
                        MatDividerModule,
                        OverlayModule,
                        PortalModule,
                        A11yModule,
                    ],
                    exports: [
                        CdkScrollableModule,
                        MatTimepickerToggle,
                        MatTimepickerToggleIcon,
                        MatTimepicker,
                        MatTimepickerContent,
                        MatTimepickerContentLayout,
                        MatTimepickerInput,
                        MatTimeInputs,
                        MatHourInput,
                        MatMinuteInput,
                        MatClockDials,
                        MatHoursClockDial,
                        MatMinutesClockDial,
                        MatTimepickerActions,
                        MatTimepickerDefaultActions,
                        MatTimepickerApply,
                        MatTimepickerCancel,
                    ],
                    providers: [
                        MatTimepickerIntl,
                        MAT_TIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER,
                        { provide: Window, useValue: window },
                        { provide: MAT_DEFAULT_ACITONS, useValue: MatTimepickerDefaultActions },
                        {
                            provide: MAT_FAB_DEFAULT_OPTIONS,
                            useValue: { color: 'unthemed' },
                        },
                    ],
                }]
        }] });

class CoreMatModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreMatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreMatModule, imports: [MatAutocompleteModule,
            MatBadgeModule,
            MatBottomSheetModule,
            MatButtonModule,
            MatButtonToggleModule,
            MatCardModule,
            MatCheckboxModule,
            MatChipsModule,
            MatDatepickerModule,
            MatDialogModule,
            MatDividerModule,
            MatExpansionModule,
            MatGridListModule,
            MatIconModule,
            MatInputModule,
            MatListModule,
            MatMenuModule,
            MatNativeDateModule,
            MatPaginatorModule,
            MatProgressBarModule,
            MatProgressSpinnerModule,
            MatRadioModule,
            MatRippleModule,
            MatSelectModule,
            MatSidenavModule,
            MatSliderModule,
            MatSlideToggleModule,
            MatSnackBarModule,
            MatSortModule,
            MatStepperModule,
            MatTableModule,
            MatTabsModule,
            MatToolbarModule,
            MatTooltipModule,
            MatTreeModule], exports: [MatAutocompleteModule,
            MatBadgeModule,
            MatBottomSheetModule,
            MatButtonModule,
            MatButtonToggleModule,
            MatCardModule,
            MatCheckboxModule,
            MatChipsModule,
            MatDatepickerModule,
            MatDialogModule,
            MatDividerModule,
            MatExpansionModule,
            MatGridListModule,
            MatIconModule,
            MatInputModule,
            MatListModule,
            MatMenuModule,
            MatNativeDateModule,
            MatPaginatorModule,
            MatProgressBarModule,
            MatProgressSpinnerModule,
            MatRadioModule,
            MatRippleModule,
            MatSelectModule,
            MatSidenavModule,
            MatSliderModule,
            MatSlideToggleModule,
            MatSnackBarModule,
            MatSortModule,
            MatStepperModule,
            MatTableModule,
            MatTabsModule,
            MatToolbarModule,
            MatTooltipModule,
            MatTreeModule,
            MatTimepickerModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreMatModule, imports: [MatAutocompleteModule,
            MatBadgeModule,
            MatBottomSheetModule,
            MatButtonModule,
            MatButtonToggleModule,
            MatCardModule,
            MatCheckboxModule,
            MatChipsModule,
            MatDatepickerModule,
            MatDialogModule,
            MatDividerModule,
            MatExpansionModule,
            MatGridListModule,
            MatIconModule,
            MatInputModule,
            MatListModule,
            MatMenuModule,
            MatNativeDateModule,
            MatPaginatorModule,
            MatProgressBarModule,
            MatProgressSpinnerModule,
            MatRadioModule,
            MatRippleModule,
            MatSelectModule,
            MatSidenavModule,
            MatSliderModule,
            MatSlideToggleModule,
            MatSnackBarModule,
            MatSortModule,
            MatStepperModule,
            MatTableModule,
            MatTabsModule,
            MatToolbarModule,
            MatTooltipModule,
            MatTreeModule, MatAutocompleteModule,
            MatBadgeModule,
            MatBottomSheetModule,
            MatButtonModule,
            MatButtonToggleModule,
            MatCardModule,
            MatCheckboxModule,
            MatChipsModule,
            MatDatepickerModule,
            MatDialogModule,
            MatDividerModule,
            MatExpansionModule,
            MatGridListModule,
            MatIconModule,
            MatInputModule,
            MatListModule,
            MatMenuModule,
            MatNativeDateModule,
            MatPaginatorModule,
            MatProgressBarModule,
            MatProgressSpinnerModule,
            MatRadioModule,
            MatRippleModule,
            MatSelectModule,
            MatSidenavModule,
            MatSliderModule,
            MatSlideToggleModule,
            MatSnackBarModule,
            MatSortModule,
            MatStepperModule,
            MatTableModule,
            MatTabsModule,
            MatToolbarModule,
            MatTooltipModule,
            MatTreeModule,
            MatTimepickerModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreMatModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [],
                    imports: [
                        MatAutocompleteModule,
                        MatBadgeModule,
                        MatBottomSheetModule,
                        MatButtonModule,
                        MatButtonToggleModule,
                        MatCardModule,
                        MatCheckboxModule,
                        MatChipsModule,
                        MatDatepickerModule,
                        MatDialogModule,
                        MatDividerModule,
                        MatExpansionModule,
                        MatGridListModule,
                        MatIconModule,
                        MatInputModule,
                        MatListModule,
                        MatMenuModule,
                        MatNativeDateModule,
                        MatPaginatorModule,
                        MatProgressBarModule,
                        MatProgressSpinnerModule,
                        MatRadioModule,
                        MatRippleModule,
                        MatSelectModule,
                        MatSidenavModule,
                        MatSliderModule,
                        MatSlideToggleModule,
                        MatSnackBarModule,
                        MatSortModule,
                        MatStepperModule,
                        MatTableModule,
                        MatTabsModule,
                        MatToolbarModule,
                        MatTooltipModule,
                        MatTreeModule,
                    ],
                    exports: [
                        MatAutocompleteModule,
                        MatBadgeModule,
                        MatBottomSheetModule,
                        MatButtonModule,
                        MatButtonToggleModule,
                        MatCardModule,
                        MatCheckboxModule,
                        MatChipsModule,
                        MatDatepickerModule,
                        MatDialogModule,
                        MatDividerModule,
                        MatExpansionModule,
                        MatGridListModule,
                        MatIconModule,
                        MatInputModule,
                        MatListModule,
                        MatMenuModule,
                        MatNativeDateModule,
                        MatPaginatorModule,
                        MatProgressBarModule,
                        MatProgressSpinnerModule,
                        MatRadioModule,
                        MatRippleModule,
                        MatSelectModule,
                        MatSidenavModule,
                        MatSliderModule,
                        MatSlideToggleModule,
                        MatSnackBarModule,
                        MatSortModule,
                        MatStepperModule,
                        MatTableModule,
                        MatTabsModule,
                        MatToolbarModule,
                        MatTooltipModule,
                        MatTreeModule,
                        MatTimepickerModule,
                    ],
                }]
        }] });

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

let Utility$1 = class Utility {
    static isMergeableObject(value) {
        return !!value && typeof value === 'object' && !Utility.isSpecial(value);
    }
    static isSpecial(value) {
        var stringValue = Object.prototype.toString.call(value);
        return stringValue === '[object RegExp]' || stringValue === '[object Date]';
    }
};
class Deepmerge {
    static emptyTarget(val) {
        return Array.isArray(val) ? [] : {};
    }
    static cloneUnlessOtherwiseSpecified(value, options) {
        return (options.clone !== false && options.isMergeableObject(value))
            ? Deepmerge.deepmerge(Deepmerge.emptyTarget(value), value, options)
            : value;
    }
    static defaultArrayMerge(target, source, options) {
        return target.concat(source).map((element) => {
            return Deepmerge.cloneUnlessOtherwiseSpecified(element, options);
        });
    }
    static getMergeFunction(key, options) {
        if (!options.customMerge) {
            return Deepmerge.deepmerge;
        }
        var customMerge = options.customMerge(key);
        return typeof customMerge === 'function' ? customMerge : Deepmerge.deepmerge;
    }
    static getEnumerableOwnPropertySymbols(target) {
        return Object.getOwnPropertySymbols
            ? Object.getOwnPropertySymbols(target).filter((symbol) => {
                return Object.propertyIsEnumerable.call(target, symbol);
            })
            : [];
    }
    static getKeys(target) {
        return Object.keys(target).concat(Deepmerge.getEnumerableOwnPropertySymbols(target));
    }
    static propertyIsOnObject(object, property) {
        try {
            return property in object;
        }
        catch (_) {
            return false;
        }
    }
    // Protects from prototype poisoning and unexpected merging up the prototype chain.
    static propertyIsUnsafe(target, key) {
        return Deepmerge.propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
            && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
                && Object.propertyIsEnumerable.call(target, key)); // and also unsafe if they're nonenumerable.
    }
    static mergeObject(target, source, options) {
        var destination = {};
        if (options.isMergeableObject(target)) {
            Deepmerge.getKeys(target).forEach((key) => {
                destination[key] = Deepmerge.cloneUnlessOtherwiseSpecified(target[key], options);
            });
        }
        Deepmerge.getKeys(source).forEach((key) => {
            if (Deepmerge.propertyIsUnsafe(target, key)) {
                return null;
            }
            if (Deepmerge.propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
                destination[key] = Deepmerge.getMergeFunction(key, options)(target[key], source[key], options);
            }
            else {
                destination[key] = Deepmerge.cloneUnlessOtherwiseSpecified(source[key], options);
            }
        });
        return destination;
    }
    static deepmerge(target, source, options) {
        options = options || {};
        options.arrayMerge = options.arrayMerge || Deepmerge.defaultArrayMerge;
        options.isMergeableObject = options.isMergeableObject || Utility$1.isMergeableObject;
        // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
        // implementations can use it. The caller may not replace it.
        //options.cloneUnlessOtherwiseSpecified = this.cloneUnlessOtherwiseSpecified
        var sourceIsArray = Array.isArray(source);
        var targetIsArray = Array.isArray(target);
        var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
        if (!sourceAndTargetTypesMatch) {
            return Deepmerge.cloneUnlessOtherwiseSpecified(source, options);
        }
        else if (sourceIsArray) {
            return options.arrayMerge(target, source, options);
        }
        else {
            return Deepmerge.mergeObject(target, source, options);
        }
    }
    static all(array, options) {
        if (!Array.isArray(array)) {
            throw new Error('first argument should be an array');
        }
        return array.reduce((prev, next) => {
            return Deepmerge.deepmerge(prev, next, options);
        }, {});
    }
}

// https://github.com/btroncone/ngrx-store-localstorage
// Cannot import from the @ngrx/store package due to a module resolution issue.
// See Issue #206.
const INIT_ACTION = '@ngrx/store/init';
const UPDATE_ACTION = '@ngrx/store/update-reducers';
const detectDate = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/;
// correctly parse dates from local storage
const dateReviver = (_key, value) => {
    if (typeof value === 'string' && detectDate.test(value)) {
        return new Date(value);
    }
    return value;
};
const dummyReviver = (_key, value) => value;
const checkIsBrowserEnv = () => {
    return typeof window !== 'undefined';
};
const validateStateKeys = (keys) => {
    return keys.map((key) => {
        let attr = key;
        if (typeof key === 'object') {
            attr = Object.keys(key)[0];
        }
        if (typeof attr !== 'string') {
            throw new TypeError(`localStorageSync Unknown Parameter Type: ` + `Expected type of string, got ${typeof attr}`);
        }
        return key;
    });
};
const rehydrateApplicationState = (keys, storage, storageKeySerializer, restoreDates) => {
    return keys.reduce((acc, curr) => {
        let key = curr;
        let reviver = restoreDates ? dateReviver : dummyReviver;
        let deserialize;
        let decrypt;
        if (typeof key === 'object') {
            key = Object.keys(key)[0];
            // use the custom reviver function
            if (typeof curr[key] === 'function') {
                reviver = curr[key];
            }
            else {
                // use custom reviver function if available
                if (curr[key].reviver) {
                    reviver = curr[key].reviver;
                }
                // use custom serialize function if available
                if (curr[key].deserialize) {
                    deserialize = curr[key].deserialize;
                }
            }
            // Ensure that encrypt and decrypt functions are both present
            if (curr[key].encrypt && curr[key].decrypt) {
                if (typeof curr[key].encrypt === 'function' && typeof curr[key].decrypt === 'function') {
                    decrypt = curr[key].decrypt;
                }
                else {
                    console.error(`Either encrypt or decrypt is not a function on '${curr[key]}' key object.`);
                }
            }
            else if (curr[key].encrypt || curr[key].decrypt) {
                // Let know that one of the encryption functions is not provided
                console.error(`Either encrypt or decrypt function is not present on '${curr[key]}' key object.`);
            }
        }
        if (storage !== undefined) {
            let stateSlice = storage.getItem(storageKeySerializer(key));
            if (stateSlice) {
                // Use provided decrypt function
                if (decrypt) {
                    stateSlice = decrypt(stateSlice);
                }
                const isObjectRegex = new RegExp('{|\\[');
                let raw = stateSlice;
                if (stateSlice === 'null' || stateSlice === 'true' || stateSlice === 'false' || isObjectRegex.test(stateSlice.charAt(0))) {
                    raw = JSON.parse(stateSlice, reviver);
                }
                return Object.assign({}, acc, {
                    [key]: deserialize ? deserialize(raw) : raw,
                });
            }
        }
        return acc;
    }, {});
};
// Recursively traverse all properties of the existing slice as defined by the `filter` argument,
// and output the new object with extraneous properties removed.
function createStateSlice(existingSlice, filter) {
    return filter.reduce((memo, attr) => {
        if (typeof attr === 'string' || typeof attr === 'number') {
            const value = existingSlice?.[attr];
            if (value !== undefined) {
                memo[attr] = value;
            }
        }
        else {
            for (const key in attr) {
                if (Object.prototype.hasOwnProperty.call(attr, key)) {
                    const element = attr[key];
                    memo[key] = createStateSlice(existingSlice[key], element);
                }
            }
        }
        return memo;
    }, {});
}
const syncStateUpdate = (state, keys, storage, storageKeySerializer, removeOnUndefined, syncCondition) => {
    if (syncCondition) {
        try {
            if (syncCondition(state) !== true) {
                return;
            }
        }
        catch (e) {
            // Treat TypeError as do not sync
            if (e instanceof TypeError) {
                return;
            }
            throw e;
        }
    }
    keys.forEach((key) => {
        let stateSlice = state[key];
        let replacer;
        let space;
        let encrypt;
        if (typeof key === 'object') {
            let name = Object.keys(key)[0];
            stateSlice = state[name];
            if (typeof stateSlice !== 'undefined' && key[name]) {
                // use serialize function if specified.
                if (key[name].serialize) {
                    stateSlice = key[name].serialize(stateSlice);
                }
                else {
                    // if serialize function is not specified filter on fields if an array has been provided.
                    let filter;
                    if (key[name].reduce) {
                        filter = key[name];
                    }
                    else if (key[name].filter) {
                        filter = key[name].filter;
                    }
                    if (filter) {
                        stateSlice = createStateSlice(stateSlice, filter);
                    }
                    // Check if encrypt and decrypt are present, also checked at this#rehydrateApplicationState()
                    if (key[name].encrypt && key[name].decrypt) {
                        if (typeof key[name].encrypt === 'function') {
                            encrypt = key[name].encrypt;
                        }
                    }
                    else if (key[name].encrypt || key[name].decrypt) {
                        // If one of those is not present, then let know that one is missing
                        console.error(`Either encrypt or decrypt function is not present on '${key[name]}' key object.`);
                    }
                }
                /*
          Replacer and space arguments to pass to JSON.stringify.
          If these fields don't exist, undefined will be passed.
        */
                replacer = key[name].replacer;
                space = key[name].space;
            }
            key = name;
        }
        if (typeof stateSlice !== 'undefined' && storage !== undefined) {
            try {
                if (encrypt) {
                    // ensure that a string message is passed
                    stateSlice = encrypt(typeof stateSlice === 'string' ? stateSlice : JSON.stringify(stateSlice, replacer, space));
                }
                storage.setItem(storageKeySerializer(key), typeof stateSlice === 'string' ? stateSlice : JSON.stringify(stateSlice, replacer, space));
            }
            catch (e) {
                console.warn('Unable to save state to localStorage:', e);
            }
        }
        else if (typeof stateSlice === 'undefined' && removeOnUndefined && storage !== undefined) {
            try {
                storage.removeItem(storageKeySerializer(key));
            }
            catch (e) {
                console.warn(`Exception on removing/cleaning undefined '${key}' state`, e);
            }
        }
    });
};
// Default merge strategy is a full deep merge.
const defaultMergeReducer = (state, rehydratedState, action) => {
    if ((action.type === INIT_ACTION || action.type === UPDATE_ACTION) && rehydratedState) {
        const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;
        const options = {
            arrayMerge: overwriteMerge,
        };
        state = Deepmerge.deepmerge(state, rehydratedState, options);
    }
    return state;
};
const localStorageSync = (config) => (reducer) => {
    if ((config.storage === undefined && !config.checkStorageAvailability) ||
        (config.checkStorageAvailability && checkIsBrowserEnv())) {
        config.storage = localStorage || window.localStorage;
    }
    if (config.storageKeySerializer === undefined) {
        config.storageKeySerializer = (key) => key;
    }
    if (config.restoreDates === undefined) {
        config.restoreDates = true;
    }
    // Use default merge reducer.
    let mergeReducer = config.mergeReducer;
    if (mergeReducer === undefined || typeof mergeReducer !== 'function') {
        mergeReducer = defaultMergeReducer;
    }
    const stateKeys = validateStateKeys(config.keys);
    const rehydratedState = config.rehydrate
        ? rehydrateApplicationState(stateKeys, config.storage, config.storageKeySerializer, config.restoreDates)
        : undefined;
    return function (state, action) {
        let nextState;
        // If state arrives undefined, we need to let it through the supplied reducer
        // in order to get a complete state as defined by user
        if (action.type === INIT_ACTION && !state) {
            nextState = reducer(state, action);
        }
        else {
            nextState = { ...state };
        }
        // Merge the store state with the rehydrated state using
        // either a user-defined reducer or the default.
        nextState = mergeReducer(nextState, rehydratedState, action);
        nextState = reducer(nextState, action);
        if (action.type !== INIT_ACTION) {
            syncStateUpdate(nextState, stateKeys, config.storage, config.storageKeySerializer, config.removeOnUndefined, config.syncCondition);
        }
        return nextState;
    };
};

class InfoOrganization {
}

class Utility {
    // объект является пустым
    static isEmpty(object) {
        return object === undefined || object === null || object === '' || object === '00000000-0000-0000-0000-000000000000';
    }
    // сериализация объекта в GET последовательность
    static serializeObj(obj) {
        const result = new Array();
        for (const property in obj) {
            if (obj.hasOwnProperty(property) && !Utility.isEmpty(obj[property])) {
                result.push(encodeURIComponent(property) + '=' + encodeURIComponent(obj[property]));
            }
        }
        return result.join('&');
    }
    // удаление элемента из массива по ключу объекта
    static removeByKey(array, first) {
        while (array.some(function (item, index) { return array[index][first.key] === first.value; })) {
            array.some(function (item, index) {
                return (array[index][first.key] === first.value) ? !!(array.splice(index, 1)) : false;
            });
        }
        return array;
    }
    // удаление элементов из массива по двум ключам объекта
    static removeByTwoKey(array, first, second) {
        while (array.some(function (item, index) { return array[index][first.key] === first.value && array[index][second.key] === second.value; })) {
            array.some(function (item, index) {
                return (array[index][first.key] === first.value && array[index][second.key] === second.value) ? !!(array.splice(index, 1)) : false;
            });
        }
        return array;
    }
    // проверка наличия в массиве по ключу объекта
    static containsByKey(array, first) {
        let found = false;
        for (let index = 0; index < array.length; index++) {
            if (array[index][first.key] === first.value) {
                found = true;
                break;
            }
        }
        return found;
    }
    // проверка наличия в массиве по двум ключам объекта
    static containsByTwoKey(array, first, second) {
        let found = false;
        for (let index = 0; index < array.length; index++) {
            if (array[index][first.key] === first.value && array[index][second.key] === second.value) {
                found = true;
                break;
            }
        }
        return found;
    }
    // сравнение двух объектов по заданному полю
    static compareByKey(a, b, first) {
        if (a[first.key] < b[first.key]) {
            return -1;
        }
        if (a[first.key] > b[first.key]) {
            return 1;
        }
        return 0;
    }
    static format(value, pattern) {
        let i = 0;
        if (this.isEmpty(value))
            return value;
        const v = value.toString();
        return pattern.replace(/#/g, _ => v[i++] ?? '');
    }
}

class InfoUser {
    static getOperatorShortName(operator) {
        if (operator) {
            let name = operator.lastName + ' ' + operator.firstName.charAt(0) + '.';
            if (!Utility.isEmpty(operator.middleName)) {
                name += operator.middleName.charAt(0) + '.';
            }
            return name;
        }
        return '';
    }
    static getOperatorShortNameValue(lastName, firstName, middleName) {
        let name = lastName + ' ' + firstName.charAt(0) + '.';
        if (!Utility.isEmpty(middleName)) {
            name += middleName.charAt(0) + '.';
        }
        return name;
    }
}
function makeAttorneyLink(id, personInn, principalInn) {
    return `https://m4d.nalog.gov.ru/EMCHD/get-info?guid=${id}&innP=${principalInn}&innR=${personInn}`;
}

class CardFrame {
}
class CardButton {
    constructor(name, text, func) {
        this.name = name;
        this.text = text;
        if (func) {
            this.action = func;
        }
    }
}
class CardPanel {
    constructor(noButton) {
        this.buttons = new Array();
        if (noButton === undefined || noButton === false) {
            this.initDefaultButtons();
        }
    }
    initDefaultButtons() {
        const btn1 = new CardButton('edit', 'Редактировать');
    }
}

class DictionaryItem {
    constructor() {
        this.id = 0;
    }
}

class Exception {
    constructor(code, template) {
        this.code = code;
        this.template = template;
    }
}

class MenuItem {
    constructor() {
        this.expandedInit = false;
        this.subMenuItems = new Array();
    }
}
class MenuSetting {
}

class GridDataEvent {
    constructor(newElement, element) {
        this.isNewElement = newElement;
        this.element = element;
    }
}

class CoreAbstractComponent {
    constructor() {
        this.hostID = Guid.newGuid().toString();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAbstractComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreAbstractComponent, isStandalone: false, selector: "ng-component", host: { properties: { "hostID": "this.hostID" } }, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAbstractComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], propDecorators: { hostID: [{
                type: HostBinding,
                args: ['hostID']
            }] } });

class CoreBaseDestroyComponent extends CoreAbstractComponent {
    constructor() {
        super(...arguments);
        this._destroy$ = new ReplaySubject(1);
    }
    takeUntilDestroyed() {
        return takeUntil(this._destroy$.asObservable());
    }
    ngOnDestroy() {
        this._destroy$.next(true);
        this._destroy$.complete();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreBaseDestroyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreBaseDestroyComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreBaseDestroyComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }] });

/**
 * @deprecated Этот класс устарел и будет удален в будущих версиях
 */
class ClientSideDataSource {
    constructor(_schema) {
        this._schema = _schema;
        this._subject = new BehaviorSubject([]);
        this._loadingSubject = new BehaviorSubject(false);
        this.loading$ = this._loadingSubject.asObservable();
    }
    connect() {
        return this._subject.asObservable();
    }
    disconnect() {
        this._subject.complete();
        this._loadingSubject.complete();
    }
    initLocalization(paginator) {
        this._schema.paginator.initLocalization(paginator);
    }
    loadDataSourceItems(items) {
        if (!Utility.isEmpty(items)) {
            const currentItems = this._schema.paginator.paginate(items);
            this._schema.paginator.pageIndex = this._schema.paginator.pageIndex;
            this._schema.paginator.pageSize = this._schema.paginator.pageSize;
            this._schema.paginator.total = items.length;
            if (this._subject.isStopped) {
                this._subject.isStopped = false;
            }
            this._subject.next(currentItems);
        }
    }
}

class PaginatorSource {
    constructor() {
        this.pageIndex = 0;
        this.pageSize = 10;
    }
    initLocalization(paginator) {
        if (paginator) {
            paginator._intl.itemsPerPageLabel = 'Показать';
            paginator._intl.nextPageLabel = 'Следующая страница';
            paginator._intl.previousPageLabel = 'Предыдущая страница';
            paginator._intl.getRangeLabel = this.dutchRangeLabel;
        }
    }
    paginate(data) {
        if (!data) {
            return [];
        }
        return data.slice(this.pageIndex * this.pageSize, (this.pageIndex + 1) * this.pageSize);
    }
    dutchRangeLabel(page, pageSize, length) {
        if (length === 0 || pageSize === 0) {
            return `0 из ${length}`;
        }
        length = Math.max(length, 0);
        const startIndex = page * pageSize;
        const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize;
        return `${startIndex + 1} - ${endIndex} из ${length}`;
    }
}
class GridConfiguration {
    constructor(service) {
        this.paginator = new PaginatorSource();
        if (service) {
            this.dataService = service;
        }
    }
}

/**
 * @deprecated Этот класс устарел и будет удален в будущих версиях
 */
class CoreClientGrid extends CoreBaseDestroyComponent {
    dataSource() { return null; }
    sortingLogic(sort) { }
    get hiddenPaginator() {
        return this.dataSource().length > 10 ? 'block' : 'none';
    }
    ngOnInit() {
        this._gridConfig = new GridConfiguration();
        this._dataSource = new ClientSideDataSource(this._gridConfig);
    }
    ngAfterViewInit() {
        this._dataSource.initLocalization(this._paginator);
        // обнуляем индекс педжинации при сортировке
        if (this._sort) {
            this._gridConfig.sort = { field: this._sort.active, direction: this._sort.direction };
            this._sort.sortChange
                .pipe(this.takeUntilDestroyed())
                .subscribe(() => {
                if (this._paginator) {
                    this._paginator.pageIndex = 0;
                }
            });
        }
        merge(this._sort ? this._sort.sortChange : new EventEmitter(), this._paginator ? this._paginator.page : new EventEmitter())
            .pipe(this.takeUntilDestroyed(), tap(() => {
            // устанавливаем новую конфигурацию педжинации
            this._gridConfig.paginator.pageIndex = this._paginator ? this._paginator.pageIndex : 0;
            this._gridConfig.paginator.pageSize = this._paginator ? this._paginator.pageSize : 15;
            // устанавливаем конфигурацию сортировки
            if (this._sort) {
                this._gridConfig.sort = { field: this._sort.active, direction: this._sort.direction };
            }
            this._dataSource.loadDataSourceItems(this.dataSource());
        }))
            .subscribe();
    }
    sortData(sort) {
        if (!sort.active || sort.direction === '') {
            this._dataSource.loadDataSourceItems(this.dataSource());
            return;
        }
        this.sortingLogic(sort);
        this._dataSource.loadDataSourceItems(this.dataSource());
    }
    compare(a, b, isAsc) {
        return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
    }
    refresh(items) {
        this._dataSource.loadDataSourceItems(items);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreClientGrid, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreClientGrid, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "_paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "_sort", first: true, predicate: MatSort, descendants: true }], usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreClientGrid, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], propDecorators: { _paginator: [{
                type: ViewChild,
                args: [MatPaginator]
            }], _sort: [{
                type: ViewChild,
                args: [MatSort]
            }] } });

class Startup {
    get startupData() {
        return window.sellan_platform;
    }
    webSubfolder() {
        if (window.location.host.indexOf('localhost:') > -1) {
            return '';
        }
        else {
            return '/' + this.getByKey('APP_MODULE_NAME');
        }
    }
    apiRoot(url, api, version) {
        if (Utility.isEmpty(api)) {
            api = 'core'; // default
        }
        if (Utility.isEmpty(version)) {
            version = 'v1'; // default
        }
        return (this.getByKey('API_URL_' + api.toUpperCase()) + '/' + api + '/' + version + '/' + url);
    }
    getByKey(key) {
        if (!this.startupData) {
            return;
        }
        for (let i = 0; i < this.startupData.length; i++) {
            if (this.startupData[i].key === key) {
                return this.startupData[i].value;
            }
        }
        return null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: Startup, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: Startup, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: Startup, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }] });

class StorageCheck {
    // проверка доступности в браузере хранилища заданного типа
    static storageAvailable(type) {
        let storage;
        try {
            storage = window[type];
            const x = '__storage_test__';
            storage.setItem(x, x);
            storage.removeItem(x);
            return true;
        }
        catch (e) {
            return (e instanceof DOMException &&
                // everything except Firefox
                (e.code === 22 ||
                    // Firefox
                    e.code === 1014 ||
                    // test name field too, because code might not be present
                    // everything except Firefox
                    e.name === 'QuotaExceededError' ||
                    // Firefox
                    e.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&
                // acknowledge QuotaExceededError only if there's something already stored
                (storage && storage.length !== 0));
        }
    }
}
class AbstractStorage {
}

/*
 * Browser local storage
 */
class BrowserLocalStorage {
    constructor() {
        if (StorageCheck.storageAvailable('localStorage')) {
            this.storage = window.localStorage;
        }
    }
    get length() {
        return this.storage.length;
    }
    clear() {
        this.storage.clear();
    }
    getItem(key) {
        return this.storage.getItem(key);
    }
    getTyped(key) {
        const valString = this.getItem(key);
        return JSON.parse(valString);
    }
    key(index) {
        return this.storage.key(index);
    }
    removeItem(key) {
        this.storage.removeItem(key);
    }
    setItem(key, value) {
        this.storage.setItem(key, value);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserLocalStorage, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserLocalStorage, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserLocalStorage, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [] });
class LocalStorage extends AbstractStorage {
}

class MethodOptions {
    constructor(contentType) {
        this.contentType = Utility.isEmpty(contentType) ? 'application/json' : contentType; // 'application/x-www-form-urlencoded'
    }
}
class AjaxService {
    constructor(_http, _sessionStorage, _startUp) {
        this._http = _http;
        this._sessionStorage = _sessionStorage;
        this._startUp = _startUp;
    }
    get(options) {
        let httpParams = new HttpParams();
        if (options.data) {
            Object.keys(options.data).forEach(function (key) {
                httpParams = httpParams.append(key, options.data[key]);
            });
        }
        const httpOptions = this.makeHttpOption(options.contentType, httpParams);
        if (options.httpOptions) {
            Object.keys(options.httpOptions).forEach(x => httpOptions[x] = options.httpOptions[x]);
        }
        const observable = this._http.get(options.url, httpOptions).pipe(catchError((error) => {
            return this.errorHandler(error);
        }));
        return observable;
    }
    post(options) {
        if (Utility.isEmpty(options.contentType)) {
            options.contentType = 'application/json';
        }
        const httpOptions = this.makeHttpOption(options.contentType);
        if (options.httpOptions) {
            Object.keys(options.httpOptions).forEach(x => httpOptions[x] = options.httpOptions[x]);
        }
        const params = options.contentType === 'application/x-www-form-urlencoded' ? Utility.serializeObj(options.data) : options.data;
        const observable = this._http.post(options.url, params, httpOptions).pipe(catchError((error) => {
            return this.errorHandler(error);
        }));
        return observable;
    }
    delete(options) {
        if (Utility.isEmpty(options.contentType)) {
            options.contentType = 'application/json';
        }
        const httpOptions = this.makeHttpOption(options.contentType);
        const observable = this._http.delete(options.url, httpOptions).pipe(catchError((error) => {
            return this.errorHandler(error);
        }));
        return observable;
    }
    put(options) {
        if (Utility.isEmpty(options.contentType)) {
            options.contentType = 'application/json';
        }
        const httpOptions = this.makeHttpOption(options.contentType);
        const observable = this._http.put(options.url, options.data, httpOptions).pipe(catchError((error) => {
            return this.errorHandler(error);
        }));
        return observable;
    }
    download(data) {
        const token = this._sessionStorage.getItem('access_token');
        const httpOptions = {
            headers: new HttpHeaders({
                'Authorization': 'Bearer ' + token
            }),
            observe: 'response',
            responseType: 'blob'
        };
        this._http.get(data.url, httpOptions).pipe(map((response) => {
            const contentDispositionHeader = response.headers.get('Content-Disposition');
            if (Utility.isEmpty(contentDispositionHeader)) {
                return null;
            }
            const fileName = contentDispositionHeader.split(';')[1].trim().split('=')[1].replace(/'/g, '');
            return {
                fileName: decodeURI(fileName.replace('UTF-8', '')),
                data: response.body.slice()
            };
        }), catchError((error) => {
            return this.errorHandler(error);
        }))
            .subscribe((result) => {
            const options = { type: data.contentType + ';charset=utf-8;' };
            this._createAndDownloadBlobFile(result.data, options, result.fileName);
            if (data.callback) {
                data.callback();
            }
        }, err => {
            this.errorHandler(err);
        });
    }
    run(options) {
        this.post(options).subscribe((response) => {
            if (response.isSuccess) {
                const url = this._startUp.apiRoot('long-task/check?guid=' + response.entity, 'core');
                this.check(url, options.callback, options.progress);
            }
            else {
                throw Error(response.message);
            }
        });
    }
    check(url, successCallback, progressCallback) {
        let progress = 0;
        const timer = setInterval(() => {
            this.get({ url: url }).subscribe((response) => {
                if (response.isSuccess) {
                    if (response.entity) {
                        if (response.entity.status === 'Ready') {
                            clearInterval(timer);
                            successCallback(response.message);
                        }
                        else if (response.entity.status === 'Error') {
                            clearInterval(timer);
                            throw Error('Во время выполнения операции произошла ошибка.');
                        }
                        else {
                            progress = response.entity.progress;
                            progressCallback(progress);
                        }
                    }
                }
                else {
                    throw Error(response.message);
                }
            });
        }, 3000);
    }
    errorHandler(error) {
        return throwError(() => error);
    }
    // добавление заголовков и параметров запроса
    makeHttpOption(contentType, params) {
        const token = this._sessionStorage.getItem('access_token');
        const headers = contentType
            ? new HttpHeaders({ 'Authorization': 'Bearer ' + token, 'Content-Type': contentType })
            : new HttpHeaders({ 'Authorization': 'Bearer ' + token });
        return params ? { headers: headers, params: params } : { headers: headers };
    }
    _createAndDownloadBlobFile(body, options, filename) {
        const blob = new Blob([body], options);
        if (navigator.msSaveBlob) {
            // IE 10+
            navigator.msSaveBlob(blob, filename);
        }
        else {
            // Browsers that support HTML5 download attribute
            const link = document.createElement('a');
            if (link.download !== undefined) {
                const url = URL.createObjectURL(blob);
                link.setAttribute('href', url);
                link.setAttribute('download', filename);
                link.style.visibility = 'hidden';
                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link);
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AjaxService, deps: [{ token: i1$5.HttpClient }, { token: BrowserLocalStorage }, { token: Startup }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AjaxService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AjaxService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: i1$5.HttpClient }, { type: BrowserLocalStorage }, { type: Startup }] });

class PageService {
    constructor(_startUp, _title, _ajaxM, _sessionStorage) {
        this._startUp = _startUp;
        this._title = _title;
        this._ajaxM = _ajaxM;
        this._sessionStorage = _sessionStorage;
    }
    getItems() {
        if (this._sessionStorage.getItem('user_session')) {
            const url = this._startUp.apiRoot('access/current', 'oauth');
            return this._ajaxM.get({ url: url });
        }
        else {
            return of({ isSuccess: true, entity: [] });
        }
    }
    getVisualSetting() {
        const url = this._startUp.apiRoot('settings/check/visual', 'core');
        return this._ajaxM.get({ url: url });
    }
    getTitle() {
        return this._title.getTitle();
    }
    setTitle(title) {
        this._title.setTitle(title);
    }
    setHaveNewChatMessage(mark) {
        this.haveNewChatMessage = mark;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PageService, deps: [{ token: Startup }, { token: i1.Title }, { token: AjaxService }, { token: BrowserLocalStorage }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PageService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PageService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: Startup }, { type: i1.Title }, { type: AjaxService }, { type: BrowserLocalStorage }] });

class AccessManager {
    constructor(pageM) {
        this.pageM = pageM;
    }
    init(callback) {
        this.pageM.getItems()
            .subscribe((response) => {
            if (response.isSuccess) {
                this._accesses = response.entity;
                if (callback) {
                    callback();
                }
            }
            else {
                console.error(response.message);
            }
        });
    }
    check(action, obj) {
        if (Utility.isEmpty(this._accesses)) {
            //console.warn('Available accesses not set!');
            return false;
        }
        const currentObject = obj === undefined ? this._systemObj : obj;
        if (Utility.isEmpty(this._systemObj)) {
            throw Error('System object not set!');
        }
        const access = this._accesses.find(x => x.systemObj === currentObject);
        if (access === undefined) {
            return false;
        }
        const lowAction = action.charAt(0).toLowerCase() + action.slice(1);
        return access.actions[lowAction];
    }
    setSystemObj(sysObj) {
        this._systemObj = sysObj;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AccessManager, deps: [{ token: PageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AccessManager, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AccessManager, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: PageService }] });

class DataExportService {
    constructor(_ajaxM, _startUp) {
        this._ajaxM = _ajaxM;
        this._startUp = _startUp;
    }
    exportData(data) {
        const url = this._startUp.apiRoot('data-export', 'core');
        return this._ajaxM.post({ url: url, data: data, httpOptions: { responseType: 'blob' } });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DataExportService, deps: [{ token: AjaxService }, { token: Startup }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DataExportService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DataExportService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: AjaxService }, { type: Startup }] });

/**
 * @deprecated Этот класс устарел и будет удален в будущих версиях
 */
class CoreGrid extends CoreBaseDestroyComponent {
    get anyRecords() {
        return (this._paginator?.length ?? 0) !== 0;
    }
    loadGridConfiguration() { return null; }
    loadAdditionalParams() { return null; }
    loadToolbarConfiguration() { }
    afterLoadingCallback() { }
    constructor(injector) {
        super();
        this.selectItem = new EventEmitter();
        this._am = injector.get(AccessManager);
        this._defaultFilters = new Array();
        this._dataExportService = injector.get(DataExportService);
        this.selected = [];
    }
    ngOnInit() {
        this._gridConfig = this.loadGridConfiguration();
        this._dataSource = new ServerSideDataSource(this._gridConfig, this._dataExportService, this._defaultFilters);
    }
    ngAfterViewInit() {
        this.initGridMainConfiguration();
    }
    ngAfterContentChecked() {
        this.setIsAllSelected();
    }
    refreshClick() {
        const params = this.loadAdditionalParams();
        if (this._dataSource) {
            const that = this;
            this._dataSource.forceLoading();
            this._dataSource.loadDataSourceItems(params, () => { that.afterLoadingCallback(); });
        }
    }
    exportExcel() {
        this._dataSource.exportExcel(this._exportedColumns);
    }
    check(action, obj) {
        return this._am.check(action, obj);
    }
    setSystemObj(sysObj) {
        return this._am.setSystemObj(sysObj);
    }
    initGridMainConfiguration() {
        const that = this;
        this.loadToolbarConfiguration();
        this._dataSource.initLocalization(this._paginator);
        this.initSortConfiguration(that);
        const params = this.loadAdditionalParams();
        this._dataSource.loadDataSourceItems(params, () => { that.afterLoadingCallback(); });
    }
    initSortConfiguration(that) {
        // обнуляем индекс педжинации при сортировке
        if (this._sort) {
            this._gridConfig.sort = { field: this._sort.active, direction: this._sort.direction };
            this._sort.sortChange
                .pipe(this.takeUntilDestroyed())
                .subscribe(() => {
                if (this._paginator) {
                    this._paginator.pageIndex = 0;
                }
            });
        }
        if (!this._sort && this._paginator) {
            this._paginator
                .page
                .pipe(this.takeUntilDestroyed(), tap(() => {
                // устанавливаем новую конфигурацию педжинации
                this._gridConfig.paginator.pageIndex = this._paginator ? this._paginator.pageIndex : 0;
                this._gridConfig.paginator.pageSize = this._paginator ? this._paginator.pageSize : 15;
                const paramsLocal = this.loadAdditionalParams();
                this._dataSource.loadDataSourceItems(paramsLocal, () => { that.afterLoadingCallback(); });
            }))
                .subscribe();
            return;
        }
        if (this._sort && this._paginator) {
            merge(this._sort ? this._sort.sortChange : new EventEmitter(), this._paginator ? this._paginator.page : new EventEmitter())
                .pipe(this.takeUntilDestroyed(), tap(() => {
                // устанавливаем новую конфигурацию педжинации
                this._gridConfig.paginator.pageIndex = this._paginator ? this._paginator.pageIndex : 0;
                this._gridConfig.paginator.pageSize = this._paginator ? this._paginator.pageSize : 15;
                // устанавливаем конфигурацию сортировки
                if (this._sort) {
                    this._gridConfig.sort = { field: this._sort.active, direction: this._sort.direction };
                }
                const paramsLocal = this.loadAdditionalParams();
                this._dataSource.loadDataSourceItems(paramsLocal, () => { that.afterLoadingCallback(); });
            }))
                .subscribe();
        }
    }
    isSelectedRow(row) {
        return this.selected.includes(row.id);
    }
    setIsAllSelected() {
        this.isAllSelected = this._dataSource.dataItems?.every((row) => this.selected.includes(row.id));
    }
    selectAll(event) {
        this._dataSource.dataItems.filter(this.canSelect).forEach(row => this._selectRow(row, event.checked));
    }
    canSelect(row) {
        return true;
    }
    onSelectedChange(val, row) {
        this._selectRow(row, !this.isSelectedRow(row));
    }
    onRowClick(row) {
        this._selectRow(row, !this.isSelectedRow(row));
    }
    _selectRow(row, checked) {
        if (checked) {
            if (!this.isSelectedRow(row))
                this.selected.push(row.id);
        }
        else {
            this.selected.splice(this.selected.findIndex(x => x === row.id), 1);
        }
        ;
        this.selectItem.emit(this.selected);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGrid, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreGrid, isStandalone: false, selector: "ng-component", outputs: { selectItem: "selectItem" }, viewQueries: [{ propertyName: "_paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "_sort", first: true, predicate: MatSort, descendants: true }], usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGrid, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { selectItem: [{
                type: Output
            }], _paginator: [{
                type: ViewChild,
                args: [MatPaginator]
            }], _sort: [{
                type: ViewChild,
                args: [MatSort]
            }] } });

class CoreTitlePage extends CoreBaseDestroyComponent {
    constructor(injector) {
        super();
        this._pageM = injector.get(PageService);
    }
    ngOnInit() {
        this._title = this._pageM.getTitle();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTitlePage, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreTitlePage, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTitlePage, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

class VisualSettingManager {
    // private _store: Store<ICoreStore>;
    get Setting() {
        return this._settings;
    }
    get host() {
        if (window.location.host.indexOf('localhost:') > -1 && this._startupM.getByKey('APP_MODULE_NAME') === 'main') {
            return '.';
        }
        else {
            return this._startupM.getByKey('APP_URL_BASE');
        }
    }
    get isEmailMustVerify() {
        return this.getVerificationType('email');
    }
    get isPhoneMustVerify() {
        return this.getVerificationType('phone');
    }
    constructor(injector) {
        this.injector = injector;
        this._pageM = injector.get(PageService);
        this._startupM = injector.get(Startup);
        /*  this._store = store;
          this._store
          .select(selectCoreDataState)
          .subscribe((z) => {
            if (!!z) {
              this._settings = z?.visualSettings;
            }
          });*/
    }
    init(callback) {
        this._pageM.getVisualSetting().subscribe((response) => {
            if (response.isSuccess) {
                this._settings = response.entity;
                if (callback) {
                    callback();
                }
            }
            else {
                console.error(response.message);
            }
        });
    }
    getVerificationType(verificationChannel) {
        const verificationMode = {
            "email": false,
            "phone": false
        };
        if (this.Setting) {
            switch (this.Setting.common.userVerificationMode) {
                case "None":
                    verificationMode["email"] = false;
                    verificationMode["phone"] = false;
                    break;
                case "OnlyEmail":
                    verificationMode["email"] = true;
                    verificationMode["phone"] = false;
                    break;
                case "OnlyPhone":
                    verificationMode["email"] = false;
                    verificationMode["phone"] = true;
                    break;
                case "All":
                    verificationMode["email"] = true;
                    verificationMode["phone"] = true;
                    break;
                case "OnlyOne":
                default:
                    break;
            }
        }
        return verificationMode[verificationChannel];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: VisualSettingManager, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: VisualSettingManager, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: VisualSettingManager, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

class DiagInfo {
    constructor() {
        this.date = new Date();
    }
}

class DiagService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    getInfo() {
        const info = new DiagInfo();
        info.host = this._startUp.getByKey('DIAG_INFO_SERVER');
        info.version = this._startUp.getByKey('DIAG_INFO_VERSION');
        return info;
    }
    // получение IP
    getIp() {
        const getIp = this._startUp.apiRoot('version', 'core', 'v1');
        const repUrl = getIp.replace('/v1/', '/');
        return this._ajaxM.post({ url: repUrl });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DiagService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DiagService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DiagService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class CoreBasePage extends CoreBaseDestroyComponent {
    constructor(injector) {
        super();
        window.sellan_injector_instance = injector;
        this.VM = injector.get(VisualSettingManager);
        this._diagM = injector.get(DiagService);
    }
    ngOnInit() {
        this.VM.init();
        this.diag = this._diagM.getInfo();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreBasePage, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreBasePage, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreBasePage, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

class CoreSimplePage extends CoreBasePage {
    constructor(injector) {
        super(injector);
        this.manualInitAM = false;
        this.AM = injector.get(AccessManager);
    }
    ngOnInit() {
        super.ngOnInit();
        if (this.manualInitAM === false) {
            this.AM.init();
        }
    }
    check(action, obj) {
        return this.AM.check(action, obj);
    }
    setSystemObj(sysObj) {
        return this.AM.setSystemObj(sysObj);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreSimplePage, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreSimplePage, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreSimplePage, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

var BooleanMode;
(function (BooleanMode) {
    BooleanMode["Option"] = "Option";
    BooleanMode["Checkbox"] = "Checkbox";
    BooleanMode["Slide"] = "Slide";
    /**
     * @deprecated помечен к удалению
     */
    BooleanMode["YesNo"] = "YesNo";
})(BooleanMode || (BooleanMode = {}));
var RequisitsMode;
(function (RequisitsMode) {
    RequisitsMode["All"] = "All";
    RequisitsMode["Fiz"] = "Fiz";
    RequisitsMode["Jur"] = "Jur";
})(RequisitsMode || (RequisitsMode = {}));
class FieldSetting {
    constructor() {
        // common settings
        this.isRequired = false;
        this.isReadonly = false;
        this.useInformer = false;
        this.informerIcon = '';
        this.informerText = '';
        this.leftHint = null;
        this.useBorder = true;
        // string settings
        this.maxLength = null;
        this.defaultText = null;
        this.useMask = null;
        this.maskExpression = null;
        // number settings
        this.decimals = null;
        this.minN = null;
        this.maxN = null;
        this.isMoney = null;
        this.isPercentage = null;
        // boolean settings
        this.mode = null;
        this.requisitesMode = null;
        this.positiveText = null;
        this.positiveinformerText = null;
        this.negativeText = null;
        this.negativeinformerText = null;
        // datetime settings
        this.minD = null;
        this.maxD = null;
        this.minCount = null;
        this.maxCount = null;
        // combobox settings
        this.sourceCode = null;
        this.masterD = null;
        this.expressionD = new Array();
        this.emptyText = null;
        this.tempData = new Array();
        this.needVerificate = false;
    }
}

class OAuthModel {
    constructor(model) {
        if (model) {
            this.username = (model.login) ? model.login : 'undefind';
            this.password = (model.password) ? model.password : 'undefind';
            this.signature = model.signature;
            if (model.type) {
                this.grant_type = model.type;
            }
            else {
                this.grant_type = 'password';
            }
            if (model.code_challenge) {
                this.code_challenge = model.code_challenge;
            }
        }
    }
}

class UserSessionData {
}

class CollapseDirective {
    set collapse(value) {
        this.isExpanded = value;
        this.toggle();
    }
    get collapse() {
        return this.isExpanded;
    }
    constructor() {
        // shown
        this.isExpanded = true;
        // hidden
        this.isCollapsed = false;
        // stale state
        this.isCollapse = true;
        // animation state
        this.isCollapsing = false;
    }
    toggle() {
        if (this.isExpanded) {
            this.hide();
        }
        else {
            this.show();
        }
    }
    hide() {
        this.isCollapse = false;
        this.isCollapsing = true;
        this.isExpanded = false;
        this.isCollapsed = true;
        setTimeout(() => {
            this.height = '0';
            this.isCollapse = true;
            this.isCollapsing = false;
        }, 4);
    }
    show() {
        this.isCollapse = false;
        this.isCollapsing = true;
        this.isExpanded = true;
        this.isCollapsed = false;
        setTimeout(() => {
            this.height = 'auto';
            this.isCollapse = true;
            this.isCollapsing = false;
        }, 4);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CollapseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: CollapseDirective, isStandalone: false, selector: "[collapse]", inputs: { collapse: "collapse" }, host: { properties: { "style.height": "this.height", "class.in": "this.isExpanded", "attr.aria-expanded": "this.isExpanded", "attr.aria-hidden": "this.isCollapsed", "class.collapse": "this.isCollapse", "class.collapsing": "this.isCollapsing" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CollapseDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[collapse]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { height: [{
                type: HostBinding,
                args: ['style.height']
            }], isExpanded: [{
                type: HostBinding,
                args: ['class.in']
            }, {
                type: HostBinding,
                args: ['attr.aria-expanded']
            }], isCollapsed: [{
                type: HostBinding,
                args: ['attr.aria-hidden']
            }], isCollapse: [{
                type: HostBinding,
                args: ['class.collapse']
            }], isCollapsing: [{
                type: HostBinding,
                args: ['class.collapsing']
            }], collapse: [{
                type: Input
            }] } });

class CopyClipboardDirective {
    onDblClick(event) {
        event.preventDefault();
        let selection = window.getSelection();
        let range = document.createRange();
        range.selectNodeContents(this.el.nativeElement);
        selection.removeAllRanges();
        selection.addRange(range);
        let listener = (e) => {
            let clipboard = e.clipboardData || window["clipboardData"];
            clipboard.setData("text", this.el.nativeElement.outerText);
            setTimeout(() => {
                let x = event.clientX;
                let y = event.clientY - 40;
                this.createTooltipPopup(x, y);
                selection.removeAllRanges();
            }, 500);
            e.preventDefault();
        };
        document.addEventListener("copy", listener, false);
        document.execCommand("copy");
        document.removeEventListener("copy", listener, false);
    }
    constructor(el) {
        this.el = el;
        this.tooltip = 'Скопировано';
        this.delay = 50;
    }
    createTooltipPopup(x, y) {
        let popup = document.createElement('div');
        popup.innerHTML = this.tooltip;
        popup.setAttribute("class", "custom-directive-tooltip-container");
        popup.style.top = y.toString() + "px";
        popup.style.left = x.toString() + "px";
        popup.style.position = "absolute";
        document.body.appendChild(popup);
        this._myPopup = popup;
        setTimeout(() => {
            if (this._myPopup)
                this._myPopup.remove();
        }, 2000); // Remove tooltip after 2 seconds
    }
    ngOnDestroy() {
        if (this._myPopup) {
            this._myPopup.remove();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CopyClipboardDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: CopyClipboardDirective, isStandalone: false, selector: "[copyClipboard]", inputs: { tooltip: "tooltip", delay: "delay" }, host: { listeners: { "dblclick": "onDblClick($event)" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CopyClipboardDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[copyClipboard]',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { tooltip: [{
                type: Input
            }], delay: [{
                type: Input
            }], onDblClick: [{
                type: HostListener,
                args: ["dblclick", ["$event"]]
            }] } });

class RequiredFileValidatorDirective {
    validate(c) {
        return this.requiredFile && (c.value === null || c.value === undefined || c.value?.length === 0) ? { 'required': true } : null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RequiredFileValidatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: RequiredFileValidatorDirective, isStandalone: false, selector: "[requiredFile]", inputs: { requiredFile: "requiredFile" }, providers: [
            { provide: NG_VALIDATORS, useExisting: forwardRef(() => RequiredFileValidatorDirective), multi: true }
        ], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RequiredFileValidatorDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[requiredFile]',
                    providers: [
                        { provide: NG_VALIDATORS, useExisting: forwardRef(() => RequiredFileValidatorDirective), multi: true }
                    ],
                    standalone: false
                }]
        }], propDecorators: { requiredFile: [{
                type: Input
            }] } });

class EqualValidatorDirective {
    constructor(validateEqual, reverse) {
        this.validateEqual = validateEqual;
        this.reverse = reverse;
    }
    get isReverse() {
        if (!this.reverse) {
            return false;
        }
        return this.reverse === 'true' ? true : false;
    }
    validate(c) {
        // self value (e.g. retype password)
        const v = c.value;
        // c.root.get(this.validateEqual)
        // control value (e.g. password)
        const e = c.root.get(this.validateEqual);
        // value not equal
        if (e && v !== e.value && !this.isReverse) {
            return { validateEqual: false };
        }
        // value equal and reverse
        if (e && v === e.value && this.isReverse) {
            delete e.errors['validateEqual'];
            if (!Object.keys(e.errors).length) {
                e.setErrors(null);
            }
        }
        // value not equal and reverse
        if (e && v !== e.value && this.isReverse) {
            return { 'validateEqual': true };
        }
        // value not equal
        if (e && v !== e.value) {
            return { 'validateEqual': true };
        }
        return null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: EqualValidatorDirective, deps: [{ token: 'validateEqual', attribute: true }, { token: 'reverse', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: EqualValidatorDirective, isStandalone: false, selector: "[validateEqual][formControlName],[validateEqual][formControl],[validateEqual][ngModel]", providers: [
            { provide: NG_VALIDATORS, useExisting: forwardRef(() => EqualValidatorDirective), multi: true }
        ], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: EqualValidatorDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[validateEqual][formControlName],[validateEqual][formControl],[validateEqual][ngModel]',
                    providers: [
                        { provide: NG_VALIDATORS, useExisting: forwardRef(() => EqualValidatorDirective), multi: true }
                    ],
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Attribute,
                    args: ['validateEqual']
                }] }, { type: undefined, decorators: [{
                    type: Attribute,
                    args: ['reverse']
                }] }] });

class VerificationDirective {
    get isVerificated() {
        const isDoneText = this.el.nativeElement.getAttribute('isVerificated');
        if (Utility.isEmpty(isDoneText)) {
            return false;
        }
        return isDoneText === 'true' ? true : false;
    }
    constructor(el) {
        this.el = el;
    }
    validate(c) {
        const newValue = c.value;
        if (this.verification && !Utility.isEmpty(newValue) && this.isVerificated !== true) {
            return { 'verification': true };
        }
        return null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: VerificationDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: VerificationDirective, isStandalone: false, selector: "[verification]", inputs: { verification: "verification" }, providers: [
            { provide: NG_VALIDATORS, useExisting: forwardRef(() => VerificationDirective), multi: true }
        ], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: VerificationDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[verification]',
                    providers: [
                        { provide: NG_VALIDATORS, useExisting: forwardRef(() => VerificationDirective), multi: true }
                    ],
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { verification: [{
                type: Input
            }] } });

class DigitMaxDirective {
    constructor(el) {
        this.el = el;
    }
    validate(c) {
        const newValue = Number(c.value);
        if (!Utility.isEmpty(newValue) && !Utility.isEmpty(this.max)) {
            if (this.max < newValue) {
                return { 'max': { invalid: true, max: this.max } };
            }
        }
        return null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DigitMaxDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: DigitMaxDirective, isStandalone: false, selector: "[max]", inputs: { max: "max" }, providers: [
            { provide: NG_VALIDATORS, useExisting: forwardRef(() => DigitMaxDirective), multi: true }
        ], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DigitMaxDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[max]',
                    providers: [
                        { provide: NG_VALIDATORS, useExisting: forwardRef(() => DigitMaxDirective), multi: true }
                    ],
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { max: [{
                type: Input
            }] } });

class DigitMinDirective {
    constructor(el) {
        this.el = el;
    }
    validate(c) {
        const newValue = Number(c.value);
        if (!Utility.isEmpty(newValue) && !Utility.isEmpty(this.min)) {
            if (this.min > newValue) {
                return { 'min': { invalid: true, min: this.min } };
            }
        }
        return null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DigitMinDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: DigitMinDirective, isStandalone: false, selector: "[min]", inputs: { min: "min" }, providers: [
            { provide: NG_VALIDATORS, useExisting: forwardRef(() => DigitMinDirective), multi: true }
        ], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DigitMinDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[min]',
                    providers: [
                        { provide: NG_VALIDATORS, useExisting: forwardRef(() => DigitMinDirective), multi: true }
                    ],
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { min: [{
                type: Input
            }] } });

class PasswordValidatorDirective {
    constructor() {
        this.MIN_LENGTH = 8;
    }
    validate(c) {
        const newValue = c.value;
        // проверяем обязательное заполнение
        if (Utility.isEmpty(newValue)) {
            return { 'required': true };
        }
        if (this.passwordCheck === true) {
            // проверяем минимальную длину поля
            if (newValue.length < this.MIN_LENGTH) {
                return { 'minlength': true };
            }
            const latin = new RegExp('[^a-zA-Z0-9!@#$%^&*()_+\-=?]');
            if (!Utility.isEmpty(newValue.match(latin))) {
                return { 'noLatin': true };
            }
            // проверяем на вхождение в пароль заглвных латинских символов, строчных и цифр
            const numbs = new RegExp('[0-9]');
            if (Utility.isEmpty(newValue.match(numbs))) {
                return { 'noNumbers': true };
            }
            const lowercase = new RegExp('[a-z]');
            if (Utility.isEmpty(newValue.match(lowercase))) {
                return { 'noLowercase': true };
            }
            const uppercase = new RegExp('[A-Z]');
            if (Utility.isEmpty(newValue.match(uppercase))) {
                return { 'noUppercase': true };
            }
        }
        return null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PasswordValidatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: PasswordValidatorDirective, isStandalone: false, selector: "[passwordCheck]", inputs: { passwordCheck: "passwordCheck" }, providers: [
            { provide: NG_VALIDATORS, useExisting: forwardRef(() => PasswordValidatorDirective), multi: true }
        ], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PasswordValidatorDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[passwordCheck]',
                    providers: [
                        { provide: NG_VALIDATORS, useExisting: forwardRef(() => PasswordValidatorDirective), multi: true }
                    ],
                    standalone: false
                }]
        }], propDecorators: { passwordCheck: [{
                type: Input
            }] } });

class SnilsDirective {
    constructor(el) {
        this.el = el;
    }
    _checkSum(snils) {
        const snilsCore = snils.substr(0, 9);
        const snilsControl = Number(snils.substr(9, 2));
        const digits = snilsCore.split('').map(i => Number(i));
        let controlSum = digits.map((d, i) => d * (digits.length - i)).reduce((p, c) => p + c);
        do {
            if (controlSum < 100) {
                controlSum = controlSum;
            }
            if (controlSum === 100 || controlSum === 101) {
                controlSum = 0;
            }
            if (controlSum > 101) {
                controlSum = controlSum % 101;
            }
        } while (controlSum >= 100);
        return snilsControl !== controlSum;
    }
    validate(c) {
        const newValue = c.value;
        if (!Utility.isEmpty(newValue)) {
            const snils = newValue.replace(/\D+/g, '');
            if (snils.length !== 11) {
                return { 'snils': true };
            }
            if (this._checkSum(snils)) {
                return { 'snils': true };
            }
        }
        return null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SnilsDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: SnilsDirective, isStandalone: false, selector: "[snils]", providers: [
            { provide: NG_VALIDATORS, useExisting: forwardRef(() => SnilsDirective), multi: true }
        ], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SnilsDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[snils]',
                    providers: [
                        { provide: NG_VALIDATORS, useExisting: forwardRef(() => SnilsDirective), multi: true }
                    ],
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }] });

class DragUploudDirective {
    constructor(sanitizer) {
        this.sanitizer = sanitizer;
        this.files = new EventEmitter();
        this.background = "#eee";
    }
    onDragOver(evt) {
        evt.preventDefault();
        evt.stopPropagation();
        this.background = "#999";
    }
    onDragLeave(evt) {
        evt.preventDefault();
        evt.stopPropagation();
        this.background = "#eee";
    }
    onDrop(evt) {
        evt.preventDefault();
        evt.stopPropagation();
        this.background = '#eee';
        let files = [];
        for (let i = 0; i < evt.dataTransfer.files.length; i++) {
            const file = evt.dataTransfer.files[i];
            const url = this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(file));
            files.push({ file, url });
        }
        if (files.length > 0) {
            this.files.emit(files);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DragUploudDirective, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: DragUploudDirective, isStandalone: false, selector: "[dragUpload]", outputs: { files: "files" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "style.background": "this.background" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DragUploudDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: "[dragUpload]",
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i1.DomSanitizer }], propDecorators: { files: [{
                type: Output
            }], background: [{
                type: HostBinding,
                args: ["style.background"]
            }], onDragOver: [{
                type: HostListener,
                args: ["dragover", ["$event"]]
            }], onDragLeave: [{
                type: HostListener,
                args: ["dragleave", ["$event"]]
            }], onDrop: [{
                type: HostListener,
                args: ['drop', ['$event']]
            }] } });

// @Directive declaration styled same as matMenuTriggerFor
// with different selector and exportAs.
class MatContextMenuTrigger extends MatMenuTrigger {
    constructor() {
        super(...arguments);
        // Create a place to store the host element.
        this.hostElement = null;
        // The complex logic below is to handle submenus and hasBackdrop===false well.
        // Listen for click and contextmenu (right-click) events on entire document.
        // If this menu is open, one of the following conditional actions.
        //   1) If the click came from the overlay backdrop, close the menu and prevent default.
        //   2) If the click came inside the overlay container, it was on a menu. If it was
        //      a contextmenu event, prevent default and re-dispatch it as a click.
        //   3) If the event did not come from our host element, close the menu.
        this.contextListenerSub = merge(fromEvent(document, "contextmenu"), fromEvent(document, "click")).subscribe(event => {
            if (this.menuOpen) {
                if (event.target) {
                    const target = event.target;
                    if (target.classList.contains("cdk-overlay-backdrop")) {
                        event.preventDefault();
                        this.closeMenu();
                    }
                    else {
                        let inOverlay = false;
                        document.querySelectorAll(".cdk-overlay-container").forEach(e => {
                            if (e.contains(target))
                                inOverlay = true;
                        });
                        if (inOverlay) {
                            if (event.type === "contextmenu") {
                                event.preventDefault();
                                event.target?.dispatchEvent(new MouseEvent("click", event));
                            }
                        }
                        else if (target !== this.hostElement)
                            this.closeMenu();
                    }
                }
            }
        });
    }
    // Duplicate the code for the matMenuTriggerFor binding
    // using a new property and the public menu accessors.
    get menu_again() {
        return this.menu;
    }
    set menu_again(menu) {
        this.menu = menu;
    }
    // Make sure to ignore the original binding
    // to allow separate menus on each button.
    set ignoredMenu(value) { }
    // Override _handleMousedown, and call super._handleMousedown 
    // with a new MouseEvent having button numbers 2 and 0 reversed.
    _handleMousedown(event) {
        return super._handleMousedown(new MouseEvent(event.type, Object.assign({}, event, { button: event.button === 0 ? 2 : event.button === 2 ? 0 : event.button })));
    }
    // Override _handleClick to make existing binding to clicks do nothing.
    _handleClick(event) { }
    // Listen for contextmenu events (right-clicks), then:
    //  1) Store the hostElement for use in later events.
    //  2) Prevent browser default action.
    //  3) Call super._handleClick to open the menu as expected.
    _handleContextMenu(event) {
        this.hostElement = event.target;
        if (event.shiftKey)
            return; // Hold a shift key to open original context menu. Delete this line if not desired behavior.
        event.preventDefault();
        super._handleClick(event);
    }
    // When destroyed, stop listening for the contextmenu events above, 
    // null the host element reference, then call super.
    ngOnDestroy() {
        this.contextListenerSub.unsubscribe();
        this.hostElement = null;
        return super.ngOnDestroy();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatContextMenuTrigger, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: MatContextMenuTrigger, isStandalone: false, selector: "[matContextMenuTriggerFor]", inputs: { menu_again: ["matContextMenuTriggerFor", "menu_again"], ignoredMenu: ["matMenuTriggerFor", "ignoredMenu"] }, host: { listeners: { "contextmenu": "_handleContextMenu($event)" }, classAttribute: "mat-menu-trigger" }, exportAs: ["matContextMenuTrigger"], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MatContextMenuTrigger, decorators: [{
            type: Directive,
            args: [{
                    selector: `[matContextMenuTriggerFor]`,
                    host: {
                        'class': 'mat-menu-trigger',
                    },
                    exportAs: 'matContextMenuTrigger',
                    standalone: false
                }]
        }], propDecorators: { menu_again: [{
                type: Input,
                args: ['matContextMenuTriggerFor']
            }], ignoredMenu: [{
                type: Input,
                args: ['matMenuTriggerFor']
            }], _handleContextMenu: [{
                type: HostListener,
                args: ['contextmenu', ['$event']]
            }] } });

class InnDirective {
    constructor(el) {
        this.el = el;
    }
    validate(c) {
        const newValue = c.value;
        if (!Utility.isEmpty(newValue)) {
            const inn = newValue.replace(/\D+/g, '');
            if (!this._checkInn(inn)) {
                return { 'inn': true };
            }
        }
        return null;
    }
    _checkInn(value) {
        //ИНН юрлиц - 10 символов, ИП - 12 символов
        if (value.length !== 10 && value.length !== 12) {
            return false;
        }
        //преобразуем строку в массив цифр
        const arNumbers = value.split('');
        //формула для юрлиц и ИП отличается
        if (arNumbers.length === 10) {
            //переменная для итоговой суммы
            let checkSum;
            //каждую цифру мы умножаем на свой коэффициент
            //а потом получаем остаток от деления на 11 и на 10
            checkSum = ((2 * +arNumbers[0] +
                4 * +arNumbers[1] +
                10 * +arNumbers[2] +
                3 * +arNumbers[3] +
                5 * +arNumbers[4] +
                9 * +arNumbers[5] +
                4 * +arNumbers[6] +
                6 * +arNumbers[7] +
                8 * +arNumbers[8]) % 11) % 10;
            //проверяем что десятый символ ИНН совпадает с контрольной суммой
            if (checkSum === Number(arNumbers[9])) {
                return true;
            }
            else {
                return false;
            }
            //код для ИП
        }
        else if (arNumbers.length === 12) {
            //в этом случае будет две контрольные суммы
            let checkSumOne, checkSumTwo;
            checkSumOne = ((7 * +arNumbers[0] +
                2 * +arNumbers[1] +
                4 * +arNumbers[2] +
                10 * +arNumbers[3] +
                3 * +arNumbers[4] +
                5 * +arNumbers[5] +
                9 * +arNumbers[6] +
                4 * +arNumbers[7] +
                6 * +arNumbers[8] +
                8 * +arNumbers[9]) % 11) % 10;
            checkSumTwo = ((3 * +arNumbers[0] +
                7 * +arNumbers[1] +
                2 * +arNumbers[2] +
                4 * +arNumbers[3] +
                10 * +arNumbers[4] +
                3 * +arNumbers[5] +
                5 * +arNumbers[6] +
                9 * +arNumbers[7] +
                4 * +arNumbers[8] +
                6 * +arNumbers[9] +
                8 * +arNumbers[10]) % 11) % 10;
            //в этом случае мы проверяем 11 и 12 символы
            if (checkSumOne === +arNumbers[10] &&
                checkSumTwo === +arNumbers[11]) {
                return true;
            }
            else if (checkSumOne !== +arNumbers[10]) {
                return false;
            }
            else if (checkSumTwo !== +arNumbers[11]) {
                return false;
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: InnDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: InnDirective, isStandalone: false, selector: "[inn]", providers: [
            { provide: NG_VALIDATORS, useExisting: forwardRef(() => InnDirective), multi: true }
        ], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: InnDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[inn]',
                    providers: [
                        { provide: NG_VALIDATORS, useExisting: forwardRef(() => InnDirective), multi: true }
                    ],
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }] });

class HotkeyDirective {
    constructor() {
        this.hotkey = '';
        this.hotkeyCtrl = false;
        this.hotkeyShift = false;
        this.hotkeyAlt = false;
        this.hotkeyPressed = new EventEmitter();
    }
    onKeyDown(event) {
        if (this.matchesHotkey(event)) {
            event.preventDefault();
            this.hotkeyPressed.emit();
        }
    }
    matchesHotkey(event) {
        const keyMatches = event.key.toLowerCase() === this.hotkey.toLowerCase();
        const ctrlMatches = this.hotkeyCtrl ? event.ctrlKey : !event.ctrlKey;
        const shiftMatches = this.hotkeyShift ? event.shiftKey : !event.shiftKey;
        const altMatches = this.hotkeyAlt ? event.altKey : !event.altKey;
        return keyMatches && ctrlMatches && shiftMatches && altMatches;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: HotkeyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: HotkeyDirective, isStandalone: false, selector: "[hotkey]", inputs: { hotkey: "hotkey", hotkeyCtrl: "hotkeyCtrl", hotkeyShift: "hotkeyShift", hotkeyAlt: "hotkeyAlt" }, outputs: { hotkeyPressed: "hotkeyPressed" }, host: { listeners: { "document:keydown": "onKeyDown($event)" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: HotkeyDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[hotkey]',
                    standalone: false
                }]
        }], propDecorators: { hotkey: [{
                type: Input
            }], hotkeyCtrl: [{
                type: Input
            }], hotkeyShift: [{
                type: Input
            }], hotkeyAlt: [{
                type: Input
            }], hotkeyPressed: [{
                type: Output
            }], onKeyDown: [{
                type: HostListener,
                args: ['document:keydown', ['$event']]
            }] } });

class CoreDirectiveModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreDirectiveModule, declarations: [CollapseDirective,
            RequiredFileValidatorDirective,
            CopyClipboardDirective,
            EqualValidatorDirective,
            VerificationDirective,
            DigitMaxDirective,
            DigitMinDirective,
            PasswordValidatorDirective,
            SnilsDirective,
            InnDirective,
            DragUploudDirective,
            MatContextMenuTrigger,
            HotkeyDirective], exports: [CollapseDirective,
            CopyClipboardDirective,
            RequiredFileValidatorDirective,
            EqualValidatorDirective,
            VerificationDirective,
            DigitMaxDirective,
            DigitMinDirective,
            PasswordValidatorDirective,
            SnilsDirective,
            InnDirective,
            DragUploudDirective,
            MatContextMenuTrigger,
            HotkeyDirective] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDirectiveModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDirectiveModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CollapseDirective,
                        RequiredFileValidatorDirective,
                        CopyClipboardDirective,
                        EqualValidatorDirective,
                        VerificationDirective,
                        DigitMaxDirective,
                        DigitMinDirective,
                        PasswordValidatorDirective,
                        SnilsDirective,
                        InnDirective,
                        DragUploudDirective,
                        MatContextMenuTrigger,
                        HotkeyDirective
                    ],
                    exports: [
                        CollapseDirective,
                        CopyClipboardDirective,
                        RequiredFileValidatorDirective,
                        EqualValidatorDirective,
                        VerificationDirective,
                        DigitMaxDirective,
                        DigitMinDirective,
                        PasswordValidatorDirective,
                        SnilsDirective,
                        InnDirective,
                        DragUploudDirective,
                        MatContextMenuTrigger,
                        HotkeyDirective
                    ],
                }]
        }] });

;
class PrettyPrintJsonStringPipe {
    transform(value) {
        if (Utility.isEmpty(value)) {
            return '';
        }
        const obj = JSON.parse(value);
        return JSON.stringify(obj, null, '\t');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PrettyPrintJsonStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: PrettyPrintJsonStringPipe, isStandalone: false, name: "prettyprintJsonString" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PrettyPrintJsonStringPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'prettyprintJsonString',
                    standalone: false
                }]
        }] });

class SafePipe {
    constructor(sanitizer) {
        this.sanitizer = sanitizer;
    }
    transform(url) {
        return this.sanitizer.bypassSecurityTrustResourceUrl(url);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: SafePipe, isStandalone: false, name: "safe" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SafePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'safe',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i1.DomSanitizer }] });

class BooleanPipe {
    transform(value) {
        return value ? "Да" : "Нет";
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BooleanPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: BooleanPipe, isStandalone: false, name: "boolean" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BooleanPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'boolean',
                    standalone: false
                }]
        }] });

class FilterCmbxPipe {
    transform(items, filter) {
        if (!items) {
            return items;
        }
        if (filter === null || filter === undefined) {
            // нет выбранного значения => ничего не показываем в триггере
            return [];
        }
        return items.filter(item => item.id === filter);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: FilterCmbxPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: FilterCmbxPipe, isStandalone: false, name: "filterCmbx", pure: false }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: FilterCmbxPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filterCmbx',
                    pure: false,
                    standalone: false
                }]
        }] });

class StringExtension {
    static copyClipboard(text) {
        const selBox = document.createElement('textarea');
        selBox.style.position = 'fixed';
        selBox.style.left = '0';
        selBox.style.top = '0';
        selBox.style.opacity = '0';
        selBox.value = text;
        document.body.appendChild(selBox);
        selBox.focus();
        selBox.select();
        document.execCommand('copy');
        document.body.removeChild(selBox);
    }
    static nbspInsert(text) {
        return text.replace(/\s+/g, '&nbsp;');
    }
    // добавляет необходимое количество символов c для дополнения до длины l
    static padLeft(element, l, c) {
        if (element === undefined) {
            element = 0;
        }
        return Array(l - element.toString().length + 1).join(c || ' ') + element;
    }
    // Функция проверки, что все символы в строке являются числами
    static isAllDigits(str) {
        if (Utility.isEmpty(str)) {
            return false;
        }
        return str.length > 0 && /^\d+$/.test(str);
    }
    static truncatStr(text, length) {
        if (text.length > length) {
            return text.substr(0, length) + '...';
        }
        return text;
    }
    static translate(text) {
        if (text === undefined || text === null) {
            return '';
        }
        const ru = {
            'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd',
            'е': 'e', 'ё': 'e', 'ж': 'j', 'з': 'z', 'и': 'i',
            'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o',
            'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u',
            'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', 'ш': 'sh',
            'щ': 'shch', 'ы': 'y', 'э': 'e', 'ю': 'u', 'я': 'ya',
            '1': '1', '2': '2', '3': '3', '4': '4', '5': '5',
            '6': '6', '7': '7', '8': '8', '9': '9', '0': '0',
            ' ': '_', '-': '_', '|': '_'
        }, n_str = [];
        let str = text.replace(/[&\/\\#№,+()$~%.'":*?<>{}]/g, '');
        str = str.replace(/[ъь]+/g, '').replace(/й/g, 'i');
        for (let i = 0; i < str.length; ++i) {
            n_str.push(ru[str[i]]
                || ru[str[i].toLowerCase()] === undefined && str[i]
                || ru[str[i].toLowerCase()].replace(/^(.)/, (match) => match.toUpperCase()));
        }
        let translated = n_str.join('');
        while (!isNaN(Number(translated.charAt(0)))) {
            translated = '_' + translated;
        }
        return translated;
    }
    static innParse(val) {
        const regex = /(\d{10}|\d{12})/g;
        const fount = val.match(regex);
        return fount.length > 0 ? fount[0] : undefined;
    }
}

class ZeroLeftPadPipe {
    transform(value, args) {
        const result = StringExtension.padLeft(value, 6, '0');
        return result;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ZeroLeftPadPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: ZeroLeftPadPipe, isStandalone: false, name: "zero" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ZeroLeftPadPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'zero',
                    standalone: false
                }]
        }] });

class MaskPipe {
    constructor() {
        this.maskedChars = [
            '0', // обязательное числовое значнеие (реализовано)
            '9', // необязательно числовое значение (реализовано)
            'X', // обязательный литерал анлийский
            'Z', // необязательный литерал английский
            'А', // обязательный литерал русский
            'Я' // необязательный литерал русский
        ];
    }
    transform(value, mask) {
        const result = this.masked(value, mask);
        return result !== undefined ? result.result : undefined;
    }
    parse(value, mask) {
        return this.unmasked(value, mask);
    }
    masked(value, maskTemplate) {
        let itemIndex = 0;
        let maskIndex = -1;
        let pattern = '';
        let val = '';
        for (let i = 0; i < maskTemplate.length; i++) {
            const charItem = maskTemplate[i];
            let charItemPatern = '';
            switch (charItem) {
                case '0':
                    charItemPatern = '\\d{1}';
                    pattern += charItemPatern;
                    break;
                case '9':
                    charItemPatern = '\\d{0,1}';
                    pattern += charItemPatern;
                    break;
                default:
                    maskIndex++;
                    pattern += '[' + charItem + ']';
                    break;
            }
            const position = i - maskIndex;
            if (position > 0) {
                const x = value[position - 1 + itemIndex];
                const r = new RegExp(charItemPatern, 'g');
                val += (x !== undefined && x.match(r) != null) ? x : '';
                itemIndex++;
                maskIndex++;
            }
            else {
                val += charItem;
            }
            if (val.length === maskTemplate.length) {
                break;
            }
        }
        return { origin: value, expression: pattern, result: val };
    }
    unmasked(value, maskTemplate) {
        let val = '';
        for (let i = 0; i < maskTemplate.length; i++) {
            const charItem = maskTemplate[i];
            switch (charItem) {
                case '0':
                case '9':
                    if (Utility.isEmpty(value) === false) {
                        const x = value[i];
                        val += (x === undefined) ? '' : x;
                    }
                    break;
                default: break;
            }
        }
        return val;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MaskPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: MaskPipe, isStandalone: false, name: "mask" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MaskPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'mask',
                    standalone: false
                }]
        }] });

const PADDING = '000000';
class MoneyPipe {
    constructor() {
        this.DECIMAL_SEPARATOR = '.';
        this.THOUSANDS_SEPARATOR = '\'';
    }
    transform(value, fractionSize = 2) {
        let [integer, fraction = ''] = (value || '').toString().split(this.DECIMAL_SEPARATOR);
        fraction = fractionSize > 0
            ? this.DECIMAL_SEPARATOR + (fraction + PADDING).substring(0, fractionSize)
            : '';
        integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, this.THOUSANDS_SEPARATOR);
        if (Utility.isEmpty(integer)) {
            integer = '0';
        }
        return integer + fraction;
    }
    parse(value, fractionSize = 2) {
        let [integer, fraction = ''] = (value || '').split(this.DECIMAL_SEPARATOR);
        integer = integer.replace(new RegExp(this.THOUSANDS_SEPARATOR, 'g'), '');
        fraction = parseInt(fraction, 10) > 0 && fractionSize > 0
            ? this.DECIMAL_SEPARATOR + (fraction + PADDING).substring(0, fractionSize)
            : '';
        return integer + fraction;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MoneyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: MoneyPipe, isStandalone: false, name: "money" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MoneyPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'money',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class PercentTransformPipe extends MoneyPipe {
    transform(value) {
        return super.transform(value) + '%';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PercentTransformPipe, deps: null, target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: PercentTransformPipe, isStandalone: false, name: "percentTransform" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PercentTransformPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'percentTransform',
                    standalone: false
                }]
        }] });

class ProportionPercentPipe {
    constructor() { }
    transform(value) {
        return (value * 100) + "%";
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ProportionPercentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: ProportionPercentPipe, isStandalone: false, name: "proportion" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ProportionPercentPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'proportion',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

var DateCompareOption;
(function (DateCompareOption) {
    DateCompareOption[DateCompareOption["Full"] = 0] = "Full";
    DateCompareOption[DateCompareOption["Date"] = 1] = "Date";
    DateCompareOption[DateCompareOption["Time"] = 2] = "Time";
})(DateCompareOption || (DateCompareOption = {}));
class DateExtension {
    static isValidInput(dateStr, format) {
        let regex;
        switch (format) {
            case 'hh:mm': {
                const m = dateStr.match(/^(\d{2}):(\d{2})$/);
                if (!m)
                    return false;
                const hn = +m[1];
                const mn = +m[2];
                return hn >= 0 && hn <= 23 && mn >= 0 && mn <= 59;
            }
            case 'DD.MM.YYYY':
            case 'dd.MM.yyyy': {
                regex = /^(\d{2})\.(\d{2})\.(\d{4})$/;
                if (!regex.test(dateStr))
                    return false;
                break;
            }
            case 'YYYY-MM-DD':
            case 'yyyy-MM-dd': {
                regex = /^(\d{4})-(\d{2})-(\d{2})$/;
                if (!regex.test(dateStr))
                    return false;
                break;
            }
            case 'DD/MM/YYYY':
            case 'dd/MM/yyyy': {
                regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
                if (!regex.test(dateStr))
                    return false;
                break;
            }
            case 'YYYY/MM/DD':
            case 'yyyy/MM/dd': {
                regex = /^(\d{4})\/(\d{2})\/(\d{2})$/;
                if (!regex.test(dateStr))
                    return false;
                break;
            }
        }
        const [_, day, month, year] = dateStr.match(regex);
        const date = new Date(Number(year), Number(month) - 1, Number(day));
        return date.getFullYear() == Number(year) &&
            date.getMonth() == Number(month) - 1 &&
            date.getDate() == Number(day);
    }
    static parse(dateStr, format) {
        let dayValue;
        let monthValue;
        let yearValue;
        switch (format) {
            case 'hh:mm': {
                const [h, min] = dateStr.split(':');
                const d = new Date();
                d.setHours(parseInt(h, 10), parseInt(min, 10), 0, 0);
                return d;
            }
            case 'DD.MM.YYYY':
            case 'dd.MM.yyyy': {
                const [day, month, year] = dateStr.split('.');
                dayValue = day;
                monthValue = month;
                yearValue = year;
                break;
            }
            case 'YYYY-MM-DD':
            case 'yyyy-MM-dd': {
                const [year, month, day] = dateStr.split('-');
                dayValue = day;
                monthValue = month;
                yearValue = year;
                break;
            }
            case 'DD/MM/YYYY':
            case 'dd/MM/yyyy': {
                const [day, month, year] = dateStr.split('/');
                dayValue = day;
                monthValue = month;
                yearValue = year;
                break;
            }
            case 'YYYY/MM/DD':
            case 'yyyy/MM/dd': {
                const [year, month, day] = dateStr.split('/');
                dayValue = day;
                monthValue = month;
                yearValue = year;
                break;
            }
        }
        const date = `${yearValue}-${monthValue}-${dayValue}`;
        return new Date(date);
    }
    static format(date, format) {
        const o = {
            'M+': date.getMonth() + 1,
            'D+': date.getDate(),
            'h+': date.getHours(),
            'm+': date.getMinutes(),
            's+': date.getSeconds(),
            'q+': Math.floor((date.getMonth() + 3) / 3),
            'S': date.getMilliseconds() // millisecond
        };
        if (/(Y+)/.test(format)) {
            format = format.replace(RegExp.$1, StringExtension.padLeft(date.getFullYear(), 4, '0'));
        }
        for (const k in o) {
            if (new RegExp('(' + k + ')').test(format)) {
                format = format.replace(RegExp.$1, RegExp.$1.length === 1
                    ? o[k]
                    : StringExtension.padLeft(o[k], 2, '0'));
            }
        }
        return format;
    }
    static getDatePart(date) {
        const current = new Date(date.getFullYear(), date.getMonth(), date.getDate());
        return current;
    }
    static addMinutes(date, minutes) {
        const current = new Date(date.valueOf());
        current.setMinutes(current.getMinutes() + minutes);
        return current;
    }
    static addHours(date, hours) {
        const current = new Date(date.valueOf());
        current.setHours(current.getHours() + hours);
        return current;
    }
    static addDays(date, days) {
        const current = new Date(date.valueOf());
        current.setDate(current.getDate() + days);
        return current;
    }
    static toUtc(date) {
        const zone = new Date().getTimezoneOffset() / 60;
        const tempDate = new Date(date);
        const current = new Date(Date.UTC(tempDate.getUTCFullYear(), tempDate.getUTCMonth(), tempDate.getUTCDate(), tempDate.getUTCHours() + zone, tempDate.getUTCMinutes(), tempDate.getUTCSeconds()));
        return current;
    }
    static fromUtc(date, offset) {
        if (typeof date === 'string' || date instanceof String) {
            offset = undefined;
        }
        const tempDate = new Date(date);
        const current = new Date(Date.UTC(tempDate.getUTCFullYear(), tempDate.getUTCMonth(), tempDate.getUTCDate(), tempDate.getUTCHours(), tempDate.getUTCMinutes() - (offset ? offset : 0), tempDate.getUTCSeconds()));
        return current;
    }
    static compare(date1, date2, option) {
        switch (option) {
            case DateCompareOption.Date: {
                return date1.getFullYear() === date2.getFullYear() &&
                    date1.getMonth() === date2.getMonth() &&
                    date1.getDate() === date2.getDate();
            }
            case DateCompareOption.Time: {
                return date1.getHours() === date2.getHours() &&
                    date1.getMinutes() === date2.getMinutes() &&
                    date1.getSeconds() === date2.getSeconds();
            }
            default: {
                return date1.getFullYear() === date2.getFullYear() &&
                    date1.getMonth() === date2.getMonth() &&
                    date1.getDate() === date2.getDate() &&
                    date1.getHours() === date2.getHours() &&
                    date1.getMinutes() === date2.getMinutes() &&
                    date1.getSeconds() === date2.getSeconds();
            }
        }
    }
}

class RuDatePipe {
    transform(value, args) {
        if (Utility.isEmpty(value)) {
            return '';
        }
        const date = new Date(value);
        const result = DateExtension.format(date, 'DD.MM.YYYY');
        return result;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RuDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: RuDatePipe, isStandalone: false, name: "dateRu" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RuDatePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'dateRu',
                    standalone: false
                }]
        }] });

class RuDateTimePipe {
    transform(value, displayAsUtc) {
        if (Utility.isEmpty(value)) {
            return '';
        }
        const hasUtcMarker = typeof value === 'string'
            && (value.indexOf('Z') !== -1 || value.indexOf('+') !== -1);
        if (displayAsUtc) {
            const date = hasUtcMarker
                ? new Date(value)
                : this.getCurrentDateWithUtcTimeValues(new Date(value));
            return hasUtcMarker
                ? this.formatUtc(date)
                : DateExtension.format(date, 'DD.MM.YYYY hh:mm');
        }
        let date;
        if (hasUtcMarker) {
            // если есть Z — автоматическое преобразование даты UTC к локали
            date = new Date(value);
        }
        else {
            date = this.getCurrentDateWithUtcTimeValues(new Date(value));
        }
        return DateExtension.format(date, 'DD.MM.YYYY hh:mm');
    }
    getCurrentDateWithUtcTimeValues(date) {
        const now = new Date();
        date.setMinutes(date.getMinutes() - now.getTimezoneOffset());
        return date;
    }
    formatUtc(date) {
        const o = {
            'M+': date.getUTCMonth() + 1,
            'D+': date.getUTCDate(),
            'h+': date.getUTCHours(),
            'm+': date.getUTCMinutes(),
            's+': date.getUTCSeconds(),
            'q+': Math.floor((date.getUTCMonth() + 3) / 3),
            'S': date.getUTCMilliseconds()
        };
        let format = 'DD.MM.YYYY hh:mm';
        if (/(Y+)/.test(format)) {
            format = format.replace(RegExp.$1, StringExtension.padLeft(date.getUTCFullYear(), 4, '0'));
        }
        for (const k in o) {
            if (new RegExp('(' + k + ')').test(format)) {
                format = format.replace(RegExp.$1, RegExp.$1.length === 1
                    ? String(o[k])
                    : StringExtension.padLeft(o[k], 2, '0'));
            }
        }
        return format;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RuDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: RuDateTimePipe, isStandalone: false, name: "dateTimeRu" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RuDateTimePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'dateTimeRu',
                    standalone: false
                }]
        }] });

class PhoneRuPipe {
    transform(rawNum) {
        rawNum = "8" + rawNum;
        const areaCode = rawNum.slice(1, 4);
        const first = rawNum.slice(4, 7);
        const second = rawNum.slice(7, 9);
        const therd = rawNum.slice(9, 11);
        return `8 (${areaCode}) ${first}-${second}-${therd}`;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PhoneRuPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: PhoneRuPipe, isStandalone: false, name: "phoneRu" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PhoneRuPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: "phoneRu",
                    standalone: false
                }]
        }] });

class ConversionDatePipe {
    transform(value) {
        if (value <= 0) {
            return 'Неверное значение';
        }
        const currentDate = new Date();
        let currentYear = currentDate.getFullYear();
        let years = 0;
        let months = 0;
        let days = 0;
        let remainingDays = value;
        while (remainingDays >= this.getYearDays(currentYear)) {
            years++;
            remainingDays -= this.getYearDays(currentYear);
            currentYear++;
        }
        let monthIndex = currentDate.getMonth();
        while (remainingDays > 0) {
            if (remainingDays >= this.getDaysInMonth(currentYear, monthIndex)) {
                remainingDays -= this.getDaysInMonth(currentYear, monthIndex);
                months++;
                monthIndex = (monthIndex + 1) % 12;
            }
            else {
                days = remainingDays;
                remainingDays = 0;
            }
        }
        return `${years} ${this.getSuffixForYears(years)}, ${months} ${this.getSuffixForMounth(months)}, ${this.getSuffixForDays(days)}`;
    }
    isLeapYear(year) {
        return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
    }
    getYearDays(year) {
        return this.isLeapYear(year) ? 366 : 365;
    }
    getDaysInMonth(year, monthIndex) {
        const daysInMonths = [31, this.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        return daysInMonths[monthIndex];
    }
    getSuffixForYears(num) {
        if (num % 10 === 1 && num !== 11) {
            return "год";
        }
        else if ((num % 10 >= 2 && num % 10 <= 4) && !(num >= 12 && num <= 14)) {
            return "года";
        }
        else {
            return "лет";
        }
    }
    getSuffixForMounth(num) {
        if (num % 10 === 1 && num !== 11) {
            return "месяц";
        }
        else if ((num % 10 >= 2 && num % 10 <= 4) && !(num >= 12 && num <= 14)) {
            return "месяца";
        }
        else {
            return "месяцев";
        }
    }
    getSuffixForDays(days) {
        if (days === 1) {
            return `${days} день`;
        }
        else if (days >= 2 && days <= 4) {
            return `${days} дня`;
        }
        else {
            return `${days} дней`;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ConversionDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: ConversionDatePipe, isStandalone: false, name: "conversionDate" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ConversionDatePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'conversionDate',
                    standalone: false
                }]
        }] });

class DateAndTimePipe {
    constructor() {
        this.months = ['янв', 'фев', 'мар', 'апр', 'мая', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'];
    }
    transform(value) {
        if (!value)
            return null;
        // преобразуем всё в Date
        let date = value instanceof Date ? value : new Date(value);
        // проверка валидности
        if (isNaN(date.getTime()))
            return 'Неверная дата';
        const now = new Date();
        const sameDay = date.toDateString() === now.toDateString();
        const sameYear = date.getFullYear() === now.getFullYear();
        // если сегодня
        if (sameDay) {
            return date.toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit' });
        }
        // если в этом же году, то d mm
        if (sameYear) {
            const day = date.getDate();
            const monthName = this.months[date.getMonth()];
            return `${day} ${monthName}`;
        }
        // иначе - DD.MM.YY
        const dd = date.getDate().toString().padStart(2, '0');
        const mm = (date.getMonth() + 1).toString().padStart(2, '0');
        const yy = date.getFullYear().toString().slice(-2);
        return `${dd}.${mm}.${yy}`;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DateAndTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: DateAndTimePipe, isStandalone: false, name: "todayDate" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DateAndTimePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'todayDate',
                    standalone: false
                }]
        }] });

class MiddleEllipsisPipe {
    constructor() {
        this.defaultMaxLength = 20;
        this.ellipsis = '...';
    }
    transform(value, maxLength) {
        if (value == null) {
            return '';
        }
        const str = String(value);
        const limit = this.resolveMaxLength(maxLength);
        if (str.length <= limit) {
            return str;
        }
        if (limit <= this.ellipsis.length) {
            return str.slice(0, limit);
        }
        const keep = limit - this.ellipsis.length;
        const left = Math.ceil(keep / 2);
        const right = Math.floor(keep / 2);
        const start = str.slice(0, left);
        const end = str.slice(str.length - right);
        return `${start}${this.ellipsis}${end}`;
    }
    resolveMaxLength(maxLength) {
        if (maxLength == null || !Number.isFinite(maxLength)) {
            return this.defaultMaxLength;
        }
        const n = Math.floor(maxLength);
        return n > 0 ? n : this.defaultMaxLength;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MiddleEllipsisPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: MiddleEllipsisPipe, isStandalone: false, name: "middleEllipsis" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MiddleEllipsisPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'middleEllipsis',
                    standalone: false
                }]
        }] });

class CorePipeModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CorePipeModule, declarations: [RuDatePipe,
            RuDateTimePipe,
            DateAndTimePipe,
            ConversionDatePipe,
            PhoneRuPipe,
            BooleanPipe,
            SafePipe,
            PercentTransformPipe,
            ProportionPercentPipe,
            MaskPipe,
            MiddleEllipsisPipe,
            ZeroLeftPadPipe,
            MoneyPipe,
            FilterCmbxPipe,
            PrettyPrintJsonStringPipe], exports: [RuDatePipe,
            RuDateTimePipe,
            ConversionDatePipe,
            DateAndTimePipe,
            PhoneRuPipe,
            SafePipe,
            ZeroLeftPadPipe,
            BooleanPipe,
            PercentTransformPipe,
            ProportionPercentPipe,
            MaskPipe,
            MiddleEllipsisPipe,
            MoneyPipe,
            FilterCmbxPipe,
            PrettyPrintJsonStringPipe] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePipeModule, providers: [
            DatePipe
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePipeModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        RuDatePipe,
                        RuDateTimePipe,
                        DateAndTimePipe,
                        ConversionDatePipe,
                        PhoneRuPipe,
                        BooleanPipe,
                        SafePipe,
                        PercentTransformPipe,
                        ProportionPercentPipe,
                        MaskPipe,
                        MiddleEllipsisPipe,
                        ZeroLeftPadPipe,
                        MoneyPipe,
                        FilterCmbxPipe,
                        PrettyPrintJsonStringPipe
                    ],
                    imports: [],
                    exports: [
                        RuDatePipe,
                        RuDateTimePipe,
                        ConversionDatePipe,
                        DateAndTimePipe,
                        PhoneRuPipe,
                        SafePipe,
                        ZeroLeftPadPipe,
                        BooleanPipe,
                        PercentTransformPipe,
                        ProportionPercentPipe,
                        MaskPipe,
                        MiddleEllipsisPipe,
                        MoneyPipe,
                        FilterCmbxPipe,
                        PrettyPrintJsonStringPipe
                    ],
                    providers: [
                        DatePipe
                    ]
                }]
        }] });

class CardEditButtonsComponent extends CoreAbstractComponent {
    set formIsReadonly(formIsReadonly) {
        this._formIsReadonly = formIsReadonly;
        this.formIsReadonlyChange.emit(formIsReadonly);
    }
    get formIsReadonly() {
        return this._formIsReadonly;
    }
    get saveDisabled() {
        return this.form ? this.form.invalid : false;
    }
    constructor() {
        super();
        this.formIsReadonlyChange = new EventEmitter();
        this.editButton = {
            name: 'edit',
            text: 'Редактировать',
            hidden: false,
            action: () => {
                this.hiddenAction(false);
            }
        };
        this.saveButton = {
            name: 'save',
            text: 'Сохранить',
            hidden: true,
            action: () => {
                this.hiddenAction(true);
                this.saveAction();
            }
        };
        this.cancelButton = {
            name: 'cancel',
            text: 'Отменить',
            hidden: true,
            action: () => {
                if (this.cancelAction) {
                    this.hiddenAction(true);
                    this.cancelAction();
                }
                else {
                    this.hiddenAction(true);
                }
            }
        };
    }
    ngOnInit() {
        if (!this.formIsReadonly) {
            throw Error('Не задано состояние формы. Отсутствует связь между формой и кнопками редактирования.');
        }
        if (!this.saveAction) {
            throw Error('Не задан метод для действия "Сохранить".');
        }
    }
    hiddenAction(isReadonly) {
        this.formIsReadonly = isReadonly;
        this.editButton.hidden = !isReadonly;
        this.saveButton.hidden = isReadonly;
        this.cancelButton.hidden = isReadonly;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CardEditButtonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CardEditButtonsComponent, isStandalone: false, selector: "core-card-edit-buttons", inputs: { formIsReadonly: "formIsReadonly", saveAction: "saveAction", cancelAction: "cancelAction", form: "form" }, outputs: { formIsReadonlyChange: "formIsReadonlyChange" }, usesInheritance: true, ngImport: i0, template: "@if (!editButton.hidden) {\n  <button (click)=\"editButton.action()\" class=\"btn-primary sln-btn-full-s editButton\">{{ editButton.text }}</button>\n}\n@if (!saveButton.hidden) {\n  <button (click)=\"saveButton.action()\" [disabled]=\"saveDisabled\" style=\"margin-right:10px;\" class=\"btn-primary sln-btn-full-s saveButton\">{{ saveButton.text }}</button>\n}\n@if (!cancelButton.hidden) {\n  <button (click)=\"cancelButton.action()\" class=\"btn-primary sln-btn-full-s cancelButton\">{{ cancelButton.text }}</button>\n}\n", styles: [".editButton,.saveButton,.cancelButton{letter-spacing:.02em}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CardEditButtonsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-card-edit-buttons', standalone: false, template: "@if (!editButton.hidden) {\n  <button (click)=\"editButton.action()\" class=\"btn-primary sln-btn-full-s editButton\">{{ editButton.text }}</button>\n}\n@if (!saveButton.hidden) {\n  <button (click)=\"saveButton.action()\" [disabled]=\"saveDisabled\" style=\"margin-right:10px;\" class=\"btn-primary sln-btn-full-s saveButton\">{{ saveButton.text }}</button>\n}\n@if (!cancelButton.hidden) {\n  <button (click)=\"cancelButton.action()\" class=\"btn-primary sln-btn-full-s cancelButton\">{{ cancelButton.text }}</button>\n}\n", styles: [".editButton,.saveButton,.cancelButton{letter-spacing:.02em}\n"] }]
        }], ctorParameters: () => [], propDecorators: { formIsReadonlyChange: [{
                type: Output
            }], formIsReadonly: [{
                type: Input
            }], saveAction: [{
                type: Input
            }], cancelAction: [{
                type: Input
            }], form: [{
                type: Input
            }] } });

class CardPanelComponent extends CoreAbstractComponent {
    constructor() {
        super(...arguments);
        this.edit = new EventEmitter();
    }
    get viewFooter() {
        if (!this.panel?.editable) {
            return false;
        }
        return true;
    }
    onEditClick(event) {
        event.stopPropagation();
        this.edit.emit();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CardPanelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CardPanelComponent, isStandalone: false, selector: "core-card-panel", inputs: { panel: "panel", buttonsTop: "buttonsTop" }, outputs: { edit: "edit" }, usesInheritance: true, ngImport: i0, template: "<div class=\"sln-panel-wrap\">\n  @if (!panel?.hidden) {\n    <mat-expansion-panel [expanded]=\" panel?.expanded ?? true\"\n      class=\"sln-card-panel panel-default\" id=\"p_{{panel?.name}}\"\n      [disabled]=\"panel?.disabled\" [hideToggle]=\"panel?.hideToggle\">\n      <mat-expansion-panel-header class=\"panel-default-header\">\n        <ng-content select=\"[header]\"></ng-content>\n        <mat-panel-title class=\"sln-card-panel__title\">\n          <p>{{panel?.title}}</p>\n          @if (panel?.addButtonVisible) {\n            <button (click)=\"onEditClick($event)\" tid=\"onEditClick\" matTooltip=\"{{panel?.addButtonTitle}}\" class=\"sln-add-button right-side-btn-xs\">\n              <div class=\"sln-add-plus sln-add-plus-position\"></div>\n            </button>\n          }\n        </mat-panel-title>\n      </mat-expansion-panel-header>\n      <div class=\"sln-card-panel__body\">\n        @if (buttonsTop) {\n          <core-card-edit-buttons [(formIsReadonly)]=\"panel.editable.formIsReadonly\" [saveAction]=\"panel.editable.saveAction\" [cancelAction]=\"panel?.editable?.cancelAction\" [form]=\"panel?.editable?.form\" class=\"card-panel-buttons\"></core-card-edit-buttons>\n        }\n        <ng-content select=\"[body]\"></ng-content>\n      </div>\n      @if (viewFooter && !buttonsTop) {\n        <div class=\"sln-card-panel__footer\">\n          <div class=\"ibox-tools\">\n            <core-card-edit-buttons [(formIsReadonly)]=\"panel.editable.formIsReadonly\" [saveAction]=\"panel.editable.saveAction\" [cancelAction]=\"panel?.editable.cancelAction\" [form]=\"panel?.editable?.form\" class=\"card-panel-buttons\"></core-card-edit-buttons>\n          </div>\n        </div>\n      }\n    </mat-expansion-panel>\n  }\n</div>", styles: [".sln-card-panel__title{display:flex;align-items:center;justify-content:space-between}\n"], dependencies: [{ kind: "component", type: i3.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i3.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i3.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CardEditButtonsComponent, selector: "core-card-edit-buttons", inputs: ["formIsReadonly", "saveAction", "cancelAction", "form"], outputs: ["formIsReadonlyChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CardPanelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-card-panel', standalone: false, template: "<div class=\"sln-panel-wrap\">\n  @if (!panel?.hidden) {\n    <mat-expansion-panel [expanded]=\" panel?.expanded ?? true\"\n      class=\"sln-card-panel panel-default\" id=\"p_{{panel?.name}}\"\n      [disabled]=\"panel?.disabled\" [hideToggle]=\"panel?.hideToggle\">\n      <mat-expansion-panel-header class=\"panel-default-header\">\n        <ng-content select=\"[header]\"></ng-content>\n        <mat-panel-title class=\"sln-card-panel__title\">\n          <p>{{panel?.title}}</p>\n          @if (panel?.addButtonVisible) {\n            <button (click)=\"onEditClick($event)\" tid=\"onEditClick\" matTooltip=\"{{panel?.addButtonTitle}}\" class=\"sln-add-button right-side-btn-xs\">\n              <div class=\"sln-add-plus sln-add-plus-position\"></div>\n            </button>\n          }\n        </mat-panel-title>\n      </mat-expansion-panel-header>\n      <div class=\"sln-card-panel__body\">\n        @if (buttonsTop) {\n          <core-card-edit-buttons [(formIsReadonly)]=\"panel.editable.formIsReadonly\" [saveAction]=\"panel.editable.saveAction\" [cancelAction]=\"panel?.editable?.cancelAction\" [form]=\"panel?.editable?.form\" class=\"card-panel-buttons\"></core-card-edit-buttons>\n        }\n        <ng-content select=\"[body]\"></ng-content>\n      </div>\n      @if (viewFooter && !buttonsTop) {\n        <div class=\"sln-card-panel__footer\">\n          <div class=\"ibox-tools\">\n            <core-card-edit-buttons [(formIsReadonly)]=\"panel.editable.formIsReadonly\" [saveAction]=\"panel.editable.saveAction\" [cancelAction]=\"panel?.editable.cancelAction\" [form]=\"panel?.editable?.form\" class=\"card-panel-buttons\"></core-card-edit-buttons>\n          </div>\n        </div>\n      }\n    </mat-expansion-panel>\n  }\n</div>", styles: [".sln-card-panel__title{display:flex;align-items:center;justify-content:space-between}\n"] }]
        }], propDecorators: { panel: [{
                type: Input
            }], buttonsTop: [{
                type: Input
            }], edit: [{
                type: Output
            }] } });

class CoreLabelComponent extends CoreAbstractComponent {
    get value() {
        const viewValue = this.text?.length > this.length ? this.text.slice(0, this.length - 1) : this.text;
        if (this.text?.length <= this.length) {
            return viewValue;
        }
        return (viewValue) + '...';
    }
    ngOnInit() {
        if (Utility.isEmpty(this.length)) {
            this.length = 60;
        }
        if (Utility.isEmpty(this.hasButton)) {
            this.hasButton = true;
        }
    }
    copy() {
        StringExtension.copyClipboard(this.text);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreLabelComponent, isStandalone: false, selector: "core-label", inputs: { text: "text", length: "length", hasButton: "hasButton" }, usesInheritance: true, ngImport: i0, template: "<div class=\"input-group\">\n  <span matTooltip=\"{{text}}\">{{ value }}</span>\n  <div matSuffix matTooltip=\"\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n    @if (hasButton) {\n      <button (click)=\"copy()\">\n        <div class=\"sln-revocation-copy\"></div>\n      </button>\n    }\n  </div>\n</div>", styles: [".input-group{border:2px solid var(--LIGHT-GRAY);border-radius:10px;padding:5px 10px;min-height:44.5px;display:flex;align-items:center}.input-group button{display:flex;align-items:center;margin-right:5px;cursor:pointer;background:none;border:none}.input-group button img{margin-right:4px}.input-group span{color:var(--GRAY-SOFT);font-size:13px}\n"], dependencies: [{ kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLabelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-label', standalone: false, template: "<div class=\"input-group\">\n  <span matTooltip=\"{{text}}\">{{ value }}</span>\n  <div matSuffix matTooltip=\"\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n    @if (hasButton) {\n      <button (click)=\"copy()\">\n        <div class=\"sln-revocation-copy\"></div>\n      </button>\n    }\n  </div>\n</div>", styles: [".input-group{border:2px solid var(--LIGHT-GRAY);border-radius:10px;padding:5px 10px;min-height:44.5px;display:flex;align-items:center}.input-group button{display:flex;align-items:center;margin-right:5px;cursor:pointer;background:none;border:none}.input-group button img{margin-right:4px}.input-group span{color:var(--GRAY-SOFT);font-size:13px}\n"] }]
        }], propDecorators: { text: [{
                type: Input
            }], length: [{
                type: Input
            }], hasButton: [{
                type: Input
            }] } });

class CoreAbstractAccessorComponent extends CoreBaseDestroyComponent {
    get value() {
        return this._value;
    }
    set value(v) {
        this._setValueInternal(v, true);
    }
    constructor() {
        super();
        this.valueChange = new EventEmitter();
        this.unfocus = new EventEmitter();
        this.validationDone = new EventEmitter();
        this.onChange = (_) => { };
        this.onTouched = (_) => { };
        this.cmpClass = '';
        this.labelClass = 'sln-default-label';
    }
    onUnfocused(model) {
        this.unfocus.emit(model);
    }
    formatValue(model) { return null; }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    onValueChange(model) {
        this.value = model;
        if (this.settings?.isRequired && this.value != null && this.value !== '') {
            this.hideRequiredMarker = true;
        }
        else {
            this.hideRequiredMarker = false;
        }
    }
    setDefault() {
        if (!this.settings.isRequired) {
            this.settings.isRequired = false;
        }
        if (!this.settings.isReadonly) {
            this.settings.isReadonly = false;
        }
        if (!this.settings.useInformer) {
            this.settings.useInformer = false;
        }
        if (!this.settings.informerIcon) {
            this.settings.informerIcon = 'question';
        }
        if (!this.settings.informerText) {
            this.settings.informerText = '';
        }
    }
    // implements ControlValueAccessor
    writeValue(obj) {
        this._setValueInternal(obj, false);
        this.writeLogic(this.value);
        if (this.settings?.isRequired && this.value != null && this.value !== '') {
            this.hideRequiredMarker = true;
        }
        else {
            this.hideRequiredMarker = false;
        }
    }
    // implements ControlValueAccessor
    registerOnChange(fn) {
        this.onChange = fn;
    }
    // implements ControlValueAccessor
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    // implements ControlValueAccessor
    setDisabledState(isDisabled) {
        this.disabledLogic(isDisabled);
    }
    _setValueInternal(v, emitChange) {
        if (v !== undefined && v !== this._value) {
            this._value = this.formatValue(v);
            if (emitChange) {
                this.onChange(this._value);
                this.valueChange.emit(this._value);
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAbstractAccessorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreAbstractAccessorComponent, isStandalone: false, selector: "ng-component", inputs: { hideRequiredMarker: "hideRequiredMarker", disabled: "disabled", placeholder: "placeholder", labelClass: "labelClass", cmpClass: "cmpClass", fieldName: "fieldName", settings: "settings", section: "section", value: "value" }, outputs: { valueChange: "valueChange", unfocus: "unfocus", validationDone: "validationDone" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAbstractAccessorComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { hideRequiredMarker: [{
                type: Input
            }], disabled: [{
                type: Input
            }], placeholder: [{
                type: Input
            }], labelClass: [{
                type: Input
            }], cmpClass: [{
                type: Input
            }], fieldName: [{
                type: Input
            }], settings: [{
                type: Input
            }], section: [{
                type: Input
            }], valueChange: [{
                type: Output
            }], unfocus: [{
                type: Output
            }], validationDone: [{
                type: Output
            }], value: [{
                type: Input
            }] } });

class CoreFieldInnComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'ИНН';
        }
        if (!this.settings) {
            this.settings = { isRequired: false };
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldInnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldInnComponent, isStandalone: false, selector: "core-field-inn", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldInnComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\" mask=\"000000000099\" pattern=\"^(\\d{10}|\\d{12})$\" inn/>\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question  \"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('pattern') || control.hasError('inn')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n\n    <div class=\"mat-hint\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: InnDirective, selector: "[inn]" }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldInnComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-inn', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldInnComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\" mask=\"000000000099\" pattern=\"^(\\d{10}|\\d{12})$\" inn/>\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question  \"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('pattern') || control.hasError('inn')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n\n    <div class=\"mat-hint\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n" }]
        }], ctorParameters: () => [] });

class CoreFieldKppComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'КПП';
        }
        if (!this.settings) {
            this.settings = { isRequired: false };
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldKppComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldKppComponent, isStandalone: false, selector: "core-field-kpp", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldKppComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\" mask=\"000000000\" />\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('mask')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n    <div class=\"mat-hint\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldKppComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-kpp', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldKppComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\" mask=\"000000000\" />\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('mask')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n    <div class=\"mat-hint\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n" }]
        }], ctorParameters: () => [] });

class CoreFieldOgrnComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'ОГРН';
        }
        if (!this.settings) {
            this.settings = { isRequired: false };
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldOgrnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldOgrnComponent, isStandalone: false, selector: "core-field-ogrn", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldOgrnComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\" mask=\"000000000000099\" />\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('mask')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n    <div class=\"mat-hint\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldOgrnComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-ogrn', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldOgrnComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\" mask=\"000000000000099\" />\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('mask')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n    <div class=\"mat-hint\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n" }]
        }], ctorParameters: () => [] });

class CoreFieldPasswordComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
        this.makeValidation = true;
        this.hidePassword = false;
        this.hideConfirm = false;
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'Пароль';
        }
        if (!this.settings) {
            this.settings = { maxLength: 20, isRequired: false, defaultText: '' };
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldPasswordComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldPasswordComponent, isStandalone: false, selector: "core-field-password", inputs: { makeValidation: "makeValidation" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldPasswordComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <mat-form-field>\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <div matTooltip='{{ makeValidation ? \"\u041F\u0430\u0440\u043E\u043B\u044C \u0434\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B \u0432\u0435\u0440\u0445\u043D\u0435\u0433\u043E \u0438 \u043D\u0438\u0436\u043D\u0435\u0433\u043E \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043E\u0432, \u0430 \u0442\u0430\u043A\u0436\u0435 \u0446\u0438\u0444\u0440\u044B. \u0414\u043B\u0438\u043D\u0430 \u043F\u0430\u0440\u043E\u043B\u044F \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u043E\u0442 8 \u0434\u043E 20 \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432.\" : \"\" }}' matTooltipPosition=\"right\"  >\n      <input matInput [(ngModel)]=\"value\"\n        #password=\"ngModel\"\n        (ngModelChange)=\"onValueChange($event)\"\n        \n        name=\"{{ fieldName }}\"\n        [type]=\"hidePassword ? 'text':  'password'\" maxlength=\"20\"\n        [passwordCheck]=\"makeValidation\">\n      </div>\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n      }\n      @if (!disabled && !settings.useMask && !settings.rightHintHide) {\n        <mat-hint align=\"end\">{{ password.value?.length || 0 }} / {{settings.maxLength || 20}}</mat-hint>\n      }\n      <div class=\"sln-informer-icongroup\">\n        @if (!hidePassword) {\n          <div (click)=\"hidePassword = !hidePassword\" matSuffix class=\"sln-control-close-eye sln-password \"></div>\n        }\n        @if (hidePassword) {\n          <div (click)=\"hidePassword= !hidePassword\" matSuffix class=\"sln-control-eye sln-password-show\"></div>\n        }\n        <div class=\"sln-position-informer\">\n          @if (password.hasError('minlength')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u043E \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (password.hasError('noNumbers')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u041D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0438\u0444\u0440\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (password.hasError('noLowercase')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u041D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0445 \u0431\u0443\u043A\u0432\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (password.hasError('noUppercase')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u041D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u0430\u0433\u043B\u0430\u0432\u043D\u044B\u0445 \u0431\u0443\u043A\u0432\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (password.hasError('noLatin')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u0414\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0431\u0443\u043A\u0432\u044B \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u043E\u0433\u043E \u0430\u043B\u0444\u0430\u0432\u0438\u0442\u0430\" matTooltipPosition=\"above\"  >\n              </div>\n            </mat-error>\n          }\n        </div>\n      </div>\n\n    </mat-form-field>\n  </div>\n", styles: [".sln-password-show{cursor:pointer;padding:9px;z-index:22}.sln-password{cursor:pointer;padding:5px 10px;z-index:22}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: PasswordValidatorDirective, selector: "[passwordCheck]", inputs: ["passwordCheck"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldPasswordComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-password', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldPasswordComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm>\n  <mat-form-field>\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <div matTooltip='{{ makeValidation ? \"\u041F\u0430\u0440\u043E\u043B\u044C \u0434\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B \u0432\u0435\u0440\u0445\u043D\u0435\u0433\u043E \u0438 \u043D\u0438\u0436\u043D\u0435\u0433\u043E \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043E\u0432, \u0430 \u0442\u0430\u043A\u0436\u0435 \u0446\u0438\u0444\u0440\u044B. \u0414\u043B\u0438\u043D\u0430 \u043F\u0430\u0440\u043E\u043B\u044F \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u043E\u0442 8 \u0434\u043E 20 \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432.\" : \"\" }}' matTooltipPosition=\"right\"  >\n      <input matInput [(ngModel)]=\"value\"\n        #password=\"ngModel\"\n        (ngModelChange)=\"onValueChange($event)\"\n        \n        name=\"{{ fieldName }}\"\n        [type]=\"hidePassword ? 'text':  'password'\" maxlength=\"20\"\n        [passwordCheck]=\"makeValidation\">\n      </div>\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n      }\n      @if (!disabled && !settings.useMask && !settings.rightHintHide) {\n        <mat-hint align=\"end\">{{ password.value?.length || 0 }} / {{settings.maxLength || 20}}</mat-hint>\n      }\n      <div class=\"sln-informer-icongroup\">\n        @if (!hidePassword) {\n          <div (click)=\"hidePassword = !hidePassword\" matSuffix class=\"sln-control-close-eye sln-password \"></div>\n        }\n        @if (hidePassword) {\n          <div (click)=\"hidePassword= !hidePassword\" matSuffix class=\"sln-control-eye sln-password-show\"></div>\n        }\n        <div class=\"sln-position-informer\">\n          @if (password.hasError('minlength')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u043E \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (password.hasError('noNumbers')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u041D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0438\u0444\u0440\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (password.hasError('noLowercase')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u041D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0445 \u0431\u0443\u043A\u0432\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (password.hasError('noUppercase')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u041D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u0430\u0433\u043B\u0430\u0432\u043D\u044B\u0445 \u0431\u0443\u043A\u0432\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (password.hasError('noLatin')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u0414\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0431\u0443\u043A\u0432\u044B \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u043E\u0433\u043E \u0430\u043B\u0444\u0430\u0432\u0438\u0442\u0430\" matTooltipPosition=\"above\"  >\n              </div>\n            </mat-error>\n          }\n        </div>\n      </div>\n\n    </mat-form-field>\n  </div>\n", styles: [".sln-password-show{cursor:pointer;padding:9px;z-index:22}.sln-password{cursor:pointer;padding:5px 10px;z-index:22}\n"] }]
        }], ctorParameters: () => [], propDecorators: { makeValidation: [{
                type: Input
            }] } });

class CoreFieldSnilsComponent extends CoreAbstractAccessorComponent {
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'СНИЛС';
        }
        if (!this.settings) {
            this.settings = { isRequired: false };
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (Utility.isEmpty(model))
            return model;
        model = model.replace(/\D+/g, '');
        model = Utility.format(model, '###-###-### ##');
        return model;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldSnilsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldSnilsComponent, isStandalone: false, selector: "core-field-snils", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldSnilsComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\" mask=\"000-000-000 00\" [showMaskTyped]=\"true\" snils />\n\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('mask') || control.hasError('snils')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"{{ control.hasError('mask') ? '\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442' : '' }} {{ control.hasError('snils') ? '\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440' : '' }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n\n\n    <div class=\"mat-h\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: SnilsDirective, selector: "[snils]" }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldSnilsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-snils', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldSnilsComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\" mask=\"000-000-000 00\" [showMaskTyped]=\"true\" snils />\n\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('mask') || control.hasError('snils')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"{{ control.hasError('mask') ? '\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442' : '' }} {{ control.hasError('snils') ? '\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440' : '' }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n\n\n    <div class=\"mat-h\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n" }]
        }] });

class BooleanExtension {
    static toBoolean(value) {
        return value === true || value === 'true' || value === 'True' || value === '1';
    }
}

class CoreFieldTypeBoolComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
        this.ansvers = [
            { value: true, title: this.settings.positiveText, informerText: this.settings.positiveinformerText },
            { value: false, title: this.settings.negativeText, informerText: this.settings.negativeinformerText }
        ];
        //todo: избавляемся по коду от mode = 'YesNo', явно его переопределяем на слайдер
        if (this.settings.mode === BooleanMode.YesNo) {
            this.settings.mode = BooleanMode.Slide;
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return null;
        }
        return BooleanExtension.toBoolean(model);
    }
    setDefault() {
        super.setDefault();
        if (!this.settings.mode) {
            this.settings.mode = BooleanMode.Option;
        }
        if (!this.settings.positiveText) {
            this.settings.positiveText = 'Да';
        }
        if (!this.settings.negativeText) {
            this.settings.negativeText = 'Нет';
        }
        if (!this.settings.positiveinformerText) {
            this.settings.positiveinformerText = '';
        }
        if (!this.settings.negativeinformerText) {
            this.settings.negativeinformerText = '';
        }
        if (this.settings.useBorder === undefined || this.settings.useBorder === null) {
            this.settings.useBorder = true;
        }
    }
    onBoolValueChange(model) {
        this.onValueChange(model);
        this.onUnfocused(model);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeBoolComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTypeBoolComponent, isStandalone: false, selector: "core-field-bool", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTypeBoolComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-core-field-bool\" provideParentForm>\n  <div>\n    @switch (settings.mode) {\n      @case ('Option') {\n        <div class=\"sln-core-field-bool-option\">\n          <div style=\"display: inline-flex;\">\n            <span class=\"sln-control-bool\">{{ placeholder }}</span>\n            @if (settings.isRequired && (value === null || value === undefined)) {\n              <span class=\"mat-form-field-required-marker\"> *</span>\n            }\n          </div>\n          :\n          <mat-radio-group [(ngModel)]=\"value\" [disabled]=\"disabled\" (ngModelChange)=\"onBoolValueChange($event)\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" >\n            @for (ansver of ansvers; track ansver) {\n              <mat-radio-button [value]=\"ansver.value\" style=\"margin-right: 10px; margin-left: 5px;\" class=\"sln-mat-radio-button\">\n                {{ ansver.title }}\n                @if (settings.useInformer) {\n                  <i class=\"fa {{ settings.informerIcon }}\" matSuffix matTooltip=\"{{ ansver.informerText }}\"></i>\n                }\n              </mat-radio-button>\n            }\n          </mat-radio-group>\n        </div>\n      }\n      @case ('Checkbox') {\n        <div class=\"sln-core-field-bool-checkbox\">\n          <mat-checkbox [(ngModel)]=\"value\" [disabled]=\"disabled\" (ngModelChange)=\"onBoolValueChange($event)\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" class=\"sln-mat-checkbox\">\n            <div style=\"display: inline-flex;\">\n              <span [innerHTML]=\"placeholder\"></span>\n              @if (settings.isRequired && !value) {\n                <span class=\"mat-form-field-required-marker\"> *</span>\n              }\n              @if (settings.useInformer) {\n                <div class=\"sln-informer\">\n                  <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n                    @if (settings.useInformer && settings.informerIcon === 'question') {\n                      <div class=\"sln-control-question\"></div>\n                    }\n                    @if (settings.useInformer && settings.informerIcon === 'alert') {\n                      <div class=\"sln-control-mistake\"></div>\n                    }\n                  </div>\n                </div>\n              }\n            </div>\n          </mat-checkbox>\n        </div>\n      }\n      @case ('Slide') {\n        <mat-slide-toggle [(ngModel)]=\"value\" [disabled]=\"disabled\" (ngModelChange)=\"onBoolValueChange($event)\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" class=\"sln-mat-slide-toggle {{disabled ? 'sln-mat-slide-toggle-disabled': ''}} {{settings.useBorder === false ? 'sln-mat-slide-toggle--no-border' : ''}}\">\n          <div class=\"sln-mat-slide-toggle-label\">\n            {{ placeholder }}\n            @if (settings.isRequired && !value) {\n              <span class=\"mat-form-field-required-marker\"> *</span>\n            }\n            @if (settings.useInformer) {\n              <div style=\"display: inline-block;\">\n                <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n                  @if (settings.useInformer && settings.informerIcon === 'question') {\n                    <div class=\"sln-control-question\"></div>\n                  }\n                  @if (settings.useInformer && settings.informerIcon === 'alert') {\n                    <div class=\"sln-control-mistake\"></div>\n                  }\n                </div>\n              </div>\n            }\n          </div>\n        </mat-slide-toggle>\n      }\n    }\n  </div>\n</div>", styles: ["@charset \"UTF-8\";.sln-core-field-bool-checkbox{line-height:0}.sln-core-field-bool-checkbox .mdc-checkbox{padding-top:3px}.mat-checkbox-label{font-weight:400}.sln-mat-slide-toggle-label{display:flex;align-items:center;padding-right:5px;color:var(--MIDLE-GRAY);font-family:var(--font-medium)}::ng-deep .mdc-switch__track{height:20px!important}::ng-deep .mdc-switch--unselected .mdc-switch__track,::ng-deep .mdc-switch:not(.mdc-switch--checked) .mdc-switch__track{background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='30px' width='30px'><text x='0' y='20' fill='black' font-size='14' font-family='Arial'>\\41d\\435\\442</text></svg>\");background-repeat:no-repeat;background-position:bottom 25px right 5px}::ng-deep .mdc-switch--selected .mdc-switch__track,::ng-deep .mdc-switch--checked .mdc-switch__track{background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='30px' width='30px'><text x='0' y='20' fill='white' font-size='14' font-family='Arial'>\\414\\430</text></svg>\");background-repeat:no-repeat;background-position:bottom 25px left 10px}\n"], dependencies: [{ kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$3.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i3$3.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "component", type: i4$2.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeBoolComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-bool', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTypeBoolComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<div class=\"sln-core-field-bool\" provideParentForm>\n  <div>\n    @switch (settings.mode) {\n      @case ('Option') {\n        <div class=\"sln-core-field-bool-option\">\n          <div style=\"display: inline-flex;\">\n            <span class=\"sln-control-bool\">{{ placeholder }}</span>\n            @if (settings.isRequired && (value === null || value === undefined)) {\n              <span class=\"mat-form-field-required-marker\"> *</span>\n            }\n          </div>\n          :\n          <mat-radio-group [(ngModel)]=\"value\" [disabled]=\"disabled\" (ngModelChange)=\"onBoolValueChange($event)\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" >\n            @for (ansver of ansvers; track ansver) {\n              <mat-radio-button [value]=\"ansver.value\" style=\"margin-right: 10px; margin-left: 5px;\" class=\"sln-mat-radio-button\">\n                {{ ansver.title }}\n                @if (settings.useInformer) {\n                  <i class=\"fa {{ settings.informerIcon }}\" matSuffix matTooltip=\"{{ ansver.informerText }}\"></i>\n                }\n              </mat-radio-button>\n            }\n          </mat-radio-group>\n        </div>\n      }\n      @case ('Checkbox') {\n        <div class=\"sln-core-field-bool-checkbox\">\n          <mat-checkbox [(ngModel)]=\"value\" [disabled]=\"disabled\" (ngModelChange)=\"onBoolValueChange($event)\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" class=\"sln-mat-checkbox\">\n            <div style=\"display: inline-flex;\">\n              <span [innerHTML]=\"placeholder\"></span>\n              @if (settings.isRequired && !value) {\n                <span class=\"mat-form-field-required-marker\"> *</span>\n              }\n              @if (settings.useInformer) {\n                <div class=\"sln-informer\">\n                  <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n                    @if (settings.useInformer && settings.informerIcon === 'question') {\n                      <div class=\"sln-control-question\"></div>\n                    }\n                    @if (settings.useInformer && settings.informerIcon === 'alert') {\n                      <div class=\"sln-control-mistake\"></div>\n                    }\n                  </div>\n                </div>\n              }\n            </div>\n          </mat-checkbox>\n        </div>\n      }\n      @case ('Slide') {\n        <mat-slide-toggle [(ngModel)]=\"value\" [disabled]=\"disabled\" (ngModelChange)=\"onBoolValueChange($event)\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" class=\"sln-mat-slide-toggle {{disabled ? 'sln-mat-slide-toggle-disabled': ''}} {{settings.useBorder === false ? 'sln-mat-slide-toggle--no-border' : ''}}\">\n          <div class=\"sln-mat-slide-toggle-label\">\n            {{ placeholder }}\n            @if (settings.isRequired && !value) {\n              <span class=\"mat-form-field-required-marker\"> *</span>\n            }\n            @if (settings.useInformer) {\n              <div style=\"display: inline-block;\">\n                <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n                  @if (settings.useInformer && settings.informerIcon === 'question') {\n                    <div class=\"sln-control-question\"></div>\n                  }\n                  @if (settings.useInformer && settings.informerIcon === 'alert') {\n                    <div class=\"sln-control-mistake\"></div>\n                  }\n                </div>\n              </div>\n            }\n          </div>\n        </mat-slide-toggle>\n      }\n    }\n  </div>\n</div>", styles: ["@charset \"UTF-8\";.sln-core-field-bool-checkbox{line-height:0}.sln-core-field-bool-checkbox .mdc-checkbox{padding-top:3px}.mat-checkbox-label{font-weight:400}.sln-mat-slide-toggle-label{display:flex;align-items:center;padding-right:5px;color:var(--MIDLE-GRAY);font-family:var(--font-medium)}::ng-deep .mdc-switch__track{height:20px!important}::ng-deep .mdc-switch--unselected .mdc-switch__track,::ng-deep .mdc-switch:not(.mdc-switch--checked) .mdc-switch__track{background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='30px' width='30px'><text x='0' y='20' fill='black' font-size='14' font-family='Arial'>\\41d\\435\\442</text></svg>\");background-repeat:no-repeat;background-position:bottom 25px right 5px}::ng-deep .mdc-switch--selected .mdc-switch__track,::ng-deep .mdc-switch--checked .mdc-switch__track{background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='30px' width='30px'><text x='0' y='20' fill='white' font-size='14' font-family='Arial'>\\414\\430</text></svg>\");background-repeat:no-repeat;background-position:bottom 25px left 10px}\n"] }]
        }], ctorParameters: () => [] });

const SLN_CORE_COMBOBOX_SOURCE = 'ComboboxUriDescriptionService';
class DefaultComboboxUriDescriptionService {
    getUri(code, module) {
        return null;
    }
    getLocalSourse(code, filters) {
        return of({ isSuccess: true, message: '', entity: [] });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DefaultComboboxUriDescriptionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DefaultComboboxUriDescriptionService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DefaultComboboxUriDescriptionService, decorators: [{
            type: Injectable
        }] });

class CoreComboboxService {
    constructor(_externalService, _startUp, _ajaxM) {
        this._externalService = _externalService;
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    loadValues(code, filter, count, module) {
        const local = 'Local_';
        if (code.startsWith(local)) {
            return this.getLocalDictionary(code, filter);
        }
        else {
            const directory = 'DIRECTORY';
            const url = code.startsWith(directory)
                ? this._startUp.apiRoot('directory/items/combobox', 'core')
                : this.getUri(code, module);
            if (Utility.isEmpty(url)) {
                console.error('Для источника данных с кодом \'' + code + '\' не удалось получить url.');
                return of({ isSuccess: true, message: '', entity: [] });
            }
            if (code.startsWith(directory)) {
                filter.expression.push({ key: 'code', value: code });
            }
            return this.getDictionary(url, code, filter.text, filter.expression, count);
        }
    }
    getUri(code, module) {
        const urls = [
            { code: 'Accesses', url: this._url('access/combobox/system-user-accesses', 'oauth') },
            { code: 'Roles', url: this._url('roles/default') },
            { code: 'Persons', url: this._url('persons/combobox') },
            { code: 'Users', url: this._url('users/combobox') },
            { code: 'AllUsers', url: this._url('users/all-users-combobox') },
            { code: 'SystemObjects', url: this._url('system-objects/combobox') },
            { code: 'SystemObjectsGroup', url: this._url('system-objects/group/combobox') },
            { code: 'Statuses', url: this._url('statuses/combobox') },
            { code: 'StatusesGroup', url: this._url('statuses/group/combobox') },
            { code: 'Countries', url: this._url('dictionary/country/combobox') },
            { code: 'Modules', url: this._url('dictionary/modules') },
            { code: 'ModulesKeys', url: this._url('dictionary/modules/keys') },
            { code: 'Regions', url: this._url('dictionary/region/combobox') },
            { code: 'AddressTypes', url: this._url('addresses/address-type') },
            { code: 'RoomTypes', url: this._url('addresses/address-room-type') },
            { code: 'Okopfs', url: this._url('dictionary/okopf/combobox') },
            { code: 'Okveds', url: this._url('dictionary/okved/combobox') },
            { code: 'Organizations', url: this._url('organizations/combobox') },
            { code: 'OrganizationsUid', url: this._url('organizations/combobox-uid') },
            { code: 'OrganizationsInn', url: this._url('organizations/combobox-inn') },
            { code: 'OrganizationSettings', url: this._url('organizations/settings/combobox', module ?? 'core') },
            { code: 'Departments', url: this._url('departments/combobox') },
            { code: 'Participations', url: this._url('participations/combobox') },
            { code: 'FileTypes', url: this._url('file-types/combobox', 'storage') },
            { code: 'FileTypesIsVersioned', url: this._url('file-types/combobox/is-versioned', 'storage') },
            { code: 'FileTypesWithDescription', url: this._url('file-types/combobox-with-description', 'storage') },
            { code: 'FileTypeMultiOrganizations', url: this._url('archives/combobox/multi-organization', 'storage') },
            { code: 'FileAttributes', url: this._url('file-attributes/combobox', 'storage') },
            { code: 'FileFolders', url: this._url('archives/combobox/folders', 'storage') },
            { code: 'AccountTypes', url: this._url('requisites/account-type') },
            { code: 'DirectoryList', url: this._url('directory/combobox') },
            { code: 'ChatUsersList', url: this._url('chat/combobox') },
            { code: 'ChatRoomsList', url: this._url('chat/combobox/rooms') },
            //todo: проверить и убрать
            { code: 'TenderPlaycingWays', url: this._url('dictionary/tenders/combobox/playcing-way') },
            { code: 'OrganizationRequisites', url: this._url('requisites/combobox') },
            { code: 'MenuItems', url: this._url('menu/combobox') },
            { code: 'BrokerRelatedOrganizations', url: this._url('archives/combobox/contractors', 'storage') },
            { code: 'IntegrationTypes', url: this._url('applications/combobox/integration-types', 'oauth') },
            { code: 'IntegrationFileTypes', url: this._url('applications/combobox/integration-file-types', 'oauth') },
            { code: 'IntegrationSubTypes', url: this._url('applications/combobox/integration-subtypes', 'oauth') },
            { code: 'FtpProtocols', url: this._url('applications/combobox/ftp-protocols', 'oauth') },
            { code: 'ApplicationTypes', url: this._url('applications/combobox/types', 'oauth') },
            //общая механика но с источником из другого модуля
            { code: 'ImportedEntities', url: this._url('import/combobox', this._startUp.getByKey('APP_MODULE_NAME') === 'main' ? 'core' : this._startUp.getByKey('APP_MODULE_NAME')) },
            // todo: убрать ConditionsProducts через MF
            { code: 'ConditionsProducts', url: this._url('tariffication/combobox/products', 'factoring') },
            { code: 'BpmFields', url: this._url('step-fields/combobox/process', 'bpm') }
        ];
        let url = urls.filter(x => x.code === code)[0]?.url();
        if (Utility.isEmpty(url)) {
            // попытка получения данных из внешнего сервиса
            url = this._externalService.getUri(code, module);
        }
        return url;
    }
    _url(part, module) {
        return () => this._startUp.apiRoot(part, module ?? 'core');
    }
    getDictionary(url, code, text, expression, count) {
        const recordsCount = count ? count : this.getRecordCount(code);
        let query = '?count=' + recordsCount;
        if (!Utility.isEmpty(text)) {
            query += '&filter=' + text;
        }
        if (!Utility.isEmpty(expression) && expression.length > 0) {
            for (let i = 0; i < expression.length; i++) {
                query += '&' + expression[i].key + '=' + expression[i].value;
            }
        }
        return this._ajaxM.get({ url: url + query });
    }
    getRecordCount(code) {
        const setting = [
            { code: 'Regions', count: 100 },
            { code: 'Okopfs', count: 150 }
        ];
        const count = setting.filter(x => x.code === code)[0]?.count;
        if (Utility.isEmpty(count)) {
            return 30;
        }
        return count;
    }
    getLocalDictionary(code, filter) {
        switch (code) {
            case 'Local_DictionaryList': {
                return this._getDataSourceSelectorComboboxValues();
            }
            case 'Local_VersionLevels': {
                return this._getFileTypesVersionLevels();
            }
            case 'Local_Participations': {
                return this._getAdminParticipations();
            }
            case 'Local_SimpleFieldTypes': {
                return this._getSimpleFieldTypes();
            }
            case 'Local_SettingFieldTypes': {
                return this._getSettingFieldTypes();
            }
            case 'Local_DirectoryColumn': {
                return this._getDirectoryColumn();
            }
            case 'Local_ValidToUnit': {
                return this.getValidToUnit();
            }
            case 'Local_Conditions': {
                return this.getConditions();
            }
            case 'Local_FrequencyValues': {
                return this._getFrequencyValues();
            }
            case 'Local_DaysOfWeek': {
                return this._getDaysOfWeek();
            }
            case 'Local_OrganizationMandates': {
                return this._getOrganizationMandates();
            }
            default: {
                return this._externalService.getLocalSourse(code, filter);
            }
        }
    }
    getConditions() {
        const sourse = new Array();
        sourse.push({ id: 'EqualTo', text: 'Равно', description: null });
        sourse.push({ id: 'NotEqualTo', text: 'Не равно', description: null });
        sourse.push({ id: 'Contains', text: 'Содержит', description: null });
        sourse.push({ id: 'DoesNotContain', text: 'Не содержит', description: null });
        sourse.push({ id: 'GreaterThan', text: 'Больше', description: null });
        sourse.push({ id: 'GreaterThanOrEqualTo', text: 'Больше или равно', description: null });
        sourse.push({ id: 'LessThan', text: 'Меньше', description: null });
        sourse.push({ id: 'LessThanOrEqualTo', text: 'Меньше или равно', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    getValidToUnit() {
        const sourse = new Array();
        sourse.push({ id: 'D', text: 'День', description: null });
        sourse.push({ id: 'HH', text: 'Час', description: null });
        sourse.push({ id: 'mm', text: 'Минута', description: null });
        sourse.push({ id: 'ss', text: 'Секунда', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getSettingFieldTypes() {
        const sourse = new Array();
        sourse.push({ id: 'String', text: 'Строка', description: null });
        sourse.push({ id: 'Int', text: 'Целое число', description: null });
        sourse.push({ id: 'Decimal', text: 'Дробное число', description: null });
        sourse.push({ id: 'Bool', text: 'Битовое значение', description: null });
        sourse.push({ id: 'DateTime', text: 'Дата и время', description: null });
        sourse.push({ id: 'CustomField', text: 'Таблица разрешенных IP-адресов', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getSimpleFieldTypes() {
        const sourse = new Array();
        sourse.push({ id: 1, text: 'Строка', description: null });
        sourse.push({ id: 2, text: 'Целое число', description: null });
        sourse.push({ id: 4, text: 'Дробное число', description: null });
        sourse.push({ id: 3, text: 'Битовое значение', description: null });
        sourse.push({ id: 5, text: 'Дата и время', description: null });
        sourse.push({ id: 7, text: 'Список', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getAdminParticipations() {
        const sourse = new Array();
        sourse.push({ id: 100, text: 'Администратор', description: null });
        sourse.push({ id: 101, text: 'Оператор', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getDataSourceSelectorComboboxValues() {
        const sourse = new Array();
        sourse.push({ id: 3, text: 'Должности в организации', description: null });
        sourse.push({ id: 1, text: 'Группы статусов системы', description: null });
        sourse.push({ id: 4, text: 'Подразделения в организации', description: null });
        sourse.push({ id: 2, text: 'Статусы системы', description: null });
        sourse.push({ id: 5, text: 'Типы файлов', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getFileTypesVersionLevels() {
        const sourse = new Array();
        sourse.push({ id: 1, text: 'Уровень системы', description: null });
        sourse.push({ id: 2, text: 'Уровень организации', description: null });
        sourse.push({ id: 3, text: 'Уровень пользователя', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getDirectoryColumn() {
        const sourse = new Array();
        sourse.push({ id: 0, text: 'Не импортировать', description: null });
        sourse.push({ id: 1, text: 'Ключ', description: null });
        sourse.push({ id: 2, text: 'Наименование', description: null });
        sourse.push({ id: 3, text: 'Описание', description: null });
        sourse.push({ id: 4, text: 'Метаданные', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getFrequencyValues() {
        const sourse = new Array();
        sourse.push({ id: 3, text: 'Ежедневно', description: null });
        sourse.push({ id: 4, text: 'Еженедельно', description: null });
        sourse.push({ id: 5, text: 'Ежемесячно', description: null });
        sourse.push({ id: 6, text: 'Ежегодно', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getDaysOfWeek() {
        const sourse = new Array();
        sourse.push({ id: 0, text: 'Воскресенье', description: null });
        sourse.push({ id: 1, text: 'Понедельник', description: null });
        sourse.push({ id: 2, text: 'Вторник', description: null });
        sourse.push({ id: 3, text: 'Среда', description: null });
        sourse.push({ id: 4, text: 'Четверг', description: null });
        sourse.push({ id: 5, text: 'Пятница', description: null });
        sourse.push({ id: 6, text: 'Суббота', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    _getOrganizationMandates() {
        const sourse = new Array();
        sourse.push({ id: 1, text: 'Команда', description: null });
        sourse.push({ id: 2, text: 'Неподтвержденная организация', description: null });
        sourse.push({ id: 3, text: 'Подтвержденная организация', description: null });
        return of({ isSuccess: true, message: '', entity: sourse });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreComboboxService, deps: [{ token: 'ComboboxUriDescriptionService' }, { token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreComboboxService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreComboboxService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: ['ComboboxUriDescriptionService']
                }] }, { type: Startup }, { type: AjaxService }] });

class CoreSelectSearchComponent extends CoreBaseDestroyComponent {
    get value() {
        return this._value;
    }
    constructor(matSelect, changeDetectorRef) {
        super();
        this.matSelect = matSelect;
        this.changeDetectorRef = changeDetectorRef;
        this.placeholderLabel = 'Поиск';
        this.noEntriesFoundLabel = 'Нет доступных значений';
        /** Whether the backdrop class has been set */
        this.overlayClassSet = false;
        /** Event that emits when the current value changes */
        this.change = new EventEmitter();
        this.onChange = (_) => { };
        this.onTouched = (_) => { };
    }
    ngOnInit() {
        // set custom panel class
        const panelClass = 'core-select-search-panel';
        if (this.matSelect.panelClass) {
            if (Array.isArray(this.matSelect.panelClass)) {
                this.matSelect.panelClass.push(panelClass);
            }
            else if (typeof this.matSelect.panelClass === 'string') {
                this.matSelect.panelClass = [this.matSelect.panelClass, panelClass];
            }
            else if (typeof this.matSelect.panelClass === 'object') {
                this.matSelect.panelClass[panelClass] = true;
            }
        }
        else {
            this.matSelect.panelClass = panelClass;
        }
        // when the select dropdown panel is opened or closed
        this.matSelect.openedChange
            .pipe(this.takeUntilDestroyed())
            .subscribe((opened) => {
            if (opened) {
                // focus the search field when opening
                this._focus();
            }
            else {
                // clear it when closing
                this._reset();
            }
        });
        // set the first item active after the options changed
        this.matSelect.openedChange
            .pipe(take(1))
            .pipe(this.takeUntilDestroyed())
            .subscribe((opened) => {
            this._options = this.matSelect.options;
            this._options.changes
                .pipe(this.takeUntilDestroyed())
                .subscribe(() => {
                const keyManager = this.matSelect._keyManager;
                if (keyManager && this.matSelect.panelOpen) {
                    // avoid "expression has been changed" error
                    setTimeout(() => {
                        keyManager.setFirstItemActive();
                    });
                }
                // Обновляем отображение подсказки "Нет доступных значений"
                // при каждом изменении списка опций.
                this.changeDetectorRef.detectChanges();
            });
            if (opened) {
                this._focus();
            }
            else {
                this._reset();
            }
        });
        // detect changes when the input changes
        this.change
            .pipe(this.takeUntilDestroyed())
            .subscribe(() => {
            this.changeDetectorRef.detectChanges();
        });
        this.initMultipleHandling();
    }
    ngAfterViewInit() {
        this.setOverlayClass();
    }
    /**
     * Handles the key down event with MatSelect.
     * Allows e.g. selecting with enter key, navigation with arrow keys, etc.
     */
    _handleKeydown(event) {
        if (event.key === ' ') {
            // do not propagate spaces to MatSelect, as this would select the currently active option
            event.stopPropagation();
        }
    }
    writeValue(value) {
        const valueChanged = value !== this._value;
        if (valueChanged) {
            this._value = value;
            this.change.emit(value);
        }
    }
    onInputChange(value) {
        const valueChanged = value !== this._value;
        if (valueChanged) {
            this._value = value;
            this.onChange(value);
            this.change.emit(value);
        }
    }
    onPaste(event) {
        const text = event.clipboardData?.getData('text') ?? '';
        const valueChanged = text !== this._value;
        if (valueChanged) {
            this._value = text;
            this.onChange(text);
            this.change.emit(text);
        }
    }
    onBlur(value) {
        this.writeValue(value);
        this.onTouched();
    }
    registerOnChange(fn) {
        this.onChange = fn;
    }
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    /**
     * Focuses the search input field
     */
    _focus() {
        if (!this.searchSelectInput) {
            return;
        }
        // focus
        setTimeout(() => {
            this.searchSelectInput.nativeElement.focus();
        });
        // save and restore scrollTop of panel, since it will be reset by focus()
        // note: this is hacky
        if (!this.matSelect.panel || !this.matSelect.panel.nativeElement) {
            // focus without restoring scroll if panel is not available
            this.searchSelectInput.nativeElement.focus();
            return;
        }
        const panel = this.matSelect.panel.nativeElement;
        const scrollTop = panel.scrollTop;
        panel.scrollTop = scrollTop;
    }
    /**
     * Resets the current search value
     */
    _reset(focus) {
        if (!this.searchSelectInput) {
            return;
        }
        this.searchSelectInput.nativeElement.value = '';
        this.onInputChange(undefined);
        if (focus) {
            this._focus();
        }
    }
    /**
     * Sets the overlay class  to correct offsetY
     * so that the selected option is at the position of the select box when opening
     */
    setOverlayClass() {
        if (this.overlayClassSet) {
            return;
        }
        const overlayClass = 'cdk-overlay-pane-select-search';
        /*this.matSelect.overlayDir.attach
            .pipe(this.takeUntilDestroyed())
            .subscribe(() => {
                // note: this is hacky, but currently there is no better way to do this
                this.searchSelectInput.nativeElement.parentElement.parentElement
                    .parentElement.parentElement.parentElement.classList.add(overlayClass);
            });
*/
        this.overlayClassSet = true;
    }
    /**
     * Initializes handling <mat-select [multiple]="true">
     * Note: to improve this code, mat-select should be extended to allow disabling resetting the selection while filtering.
     */
    initMultipleHandling() {
        // if <mat-select [multiple]="true">
        // store previously selected values and restore them when they are deselected
        // because the option is not available while we are currently filtering
        this.matSelect.valueChange
            .pipe(this.takeUntilDestroyed())
            .subscribe((values) => {
            if (this.matSelect.multiple) {
                let restoreSelectedValues = false;
                if (this._value && this._value.length
                    && this.previousSelectedValues && Array.isArray(this.previousSelectedValues)) {
                    if (!values || !Array.isArray(values)) {
                        values = [];
                    }
                    const optionValues = this.matSelect.options.map(option => option.value);
                    this.previousSelectedValues.forEach(previousValue => {
                        if (values.indexOf(previousValue) === -1 && optionValues.indexOf(previousValue) === -1) {
                            // if a value that was selected before is deselected and not found in the options, it was deselected
                            // due to the filtering, so we restore it.
                            values.push(previousValue);
                            restoreSelectedValues = true;
                        }
                    });
                }
                if (restoreSelectedValues) {
                    this.matSelect._onChange(values);
                }
                this.previousSelectedValues = values;
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreSelectSearchComponent, deps: [{ token: MatSelect }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreSelectSearchComponent, isStandalone: false, selector: "core-select-search", inputs: { placeholderLabel: "placeholderLabel", noEntriesFoundLabel: "noEntriesFoundLabel" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreSelectSearchComponent),
                multi: true
            }
        ], viewQueries: [{ propertyName: "searchSelectInput", first: true, predicate: ["searchSelectInput"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: "<input matInput class=\"core-select-search-input core-select-search-hidden\" />\n<div class=\"core-select-search-inner\" [ngClass]=\"{'core-select-search-inner-multiple': matSelect.multiple}\">\n  <input \n  matInput \n  #searchSelectInput \n  (keydown)=\"_handleKeydown($event)\" \n  (input)=\"onInputChange($event.target.value)\" \n  (paste)=\"onPaste($event)\"\n  (blur)=\"onBlur($event.target.value)\" \n  [placeholder]=\"placeholderLabel\" \n  \u0441lass=\"core-select-search-input\" />\n</div>\n@if (noEntriesFoundLabel && value && _options?.length === 0) {\n  <div class=\"core-select-search-no-entries-found\">\n    {{noEntriesFoundLabel}}\n  </div>\n}\n", styles: [".core-select-search-hidden{visibility:hidden}.core-select-search-inner{position:absolute;top:0;width:100%;border-bottom:1px solid #cccccc;background:#fff;z-index:100;padding:5px 15px}.core-select-search-inner.core-select-search-inner-multiple{width:100%}.core-select-search-inner input{font-family:var(--font-medium);color:var(--DARK-GREY);font-size:15px}.core-select-search-input{padding:16px 36px 16px 16px!important;box-sizing:border-box}.core-select-search-no-entries-found{padding:0 7px!important;color:var(--DARK-GREY)}.core-select-search-clear{position:absolute;right:0;top:4px}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreSelectSearchComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-select-search', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreSelectSearchComponent),
                            multi: true
                        }
                    ], changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<input matInput class=\"core-select-search-input core-select-search-hidden\" />\n<div class=\"core-select-search-inner\" [ngClass]=\"{'core-select-search-inner-multiple': matSelect.multiple}\">\n  <input \n  matInput \n  #searchSelectInput \n  (keydown)=\"_handleKeydown($event)\" \n  (input)=\"onInputChange($event.target.value)\" \n  (paste)=\"onPaste($event)\"\n  (blur)=\"onBlur($event.target.value)\" \n  [placeholder]=\"placeholderLabel\" \n  \u0441lass=\"core-select-search-input\" />\n</div>\n@if (noEntriesFoundLabel && value && _options?.length === 0) {\n  <div class=\"core-select-search-no-entries-found\">\n    {{noEntriesFoundLabel}}\n  </div>\n}\n", styles: [".core-select-search-hidden{visibility:hidden}.core-select-search-inner{position:absolute;top:0;width:100%;border-bottom:1px solid #cccccc;background:#fff;z-index:100;padding:5px 15px}.core-select-search-inner.core-select-search-inner-multiple{width:100%}.core-select-search-inner input{font-family:var(--font-medium);color:var(--DARK-GREY);font-size:15px}.core-select-search-input{padding:16px 36px 16px 16px!important;box-sizing:border-box}.core-select-search-no-entries-found{padding:0 7px!important;color:var(--DARK-GREY)}.core-select-search-clear{position:absolute;right:0;top:4px}\n"] }]
        }], ctorParameters: () => [{ type: i4$3.MatSelect, decorators: [{
                    type: Inject,
                    args: [MatSelect]
                }] }, { type: i0.ChangeDetectorRef }], propDecorators: { placeholderLabel: [{
                type: Input
            }], noEntriesFoundLabel: [{
                type: Input
            }], searchSelectInput: [{
                type: ViewChild,
                args: ['searchSelectInput', { read: ElementRef }]
            }] } });

class CoreFieldTypeComboboxComponent extends CoreAbstractAccessorComponent {
    set master(v) {
        if (v !== this._master) {
            const previous = this._master;
            this._master = v;
            // Если master изменился:
            // - при переходе из непустого в пустой (old -> null/undefined)
            // - или при смене непустого значения на другое (old.id != new.id)
            // то сразу сбрасываем текущее значение для каскадного обновления зависимых контролов.
            if (!Utility.isEmpty(previous)) {
                if (Utility.isEmpty(v) || (!Utility.isEmpty(v?.id) && v.id !== previous.id)) {
                    this.value = null;
                    this._componentComboboxFilter.setValue(undefined);
                }
            }
            // Если master изменился (включая первую установку), загружаем новый список.
            // Для смены master это основной источник данных,
            // а финальная проверка валидности текущего значения выполняется в handleReadResult.
            this.loadValues(undefined, undefined, false);
        }
    }
    get isHasTemplate() {
        return this.templateRef !== undefined;
    }
    get emptyText() {
        return this.settings.emptyText ?? "Пусто";
    }
    get isTextEmpty() {
        return Utility.isEmpty(this.value?.text);
    }
    constructor(_comboboxService) {
        super();
        this._comboboxService = _comboboxService;
        this._onEmptyExpression = undefined;
        this._onEmptyForseReload = undefined;
        this._componentCombobox = new UntypedFormControl();
        this._componentComboboxFilter = new UntypedFormControl();
        this._filteredValues = new ReplaySubject(1);
        this._filteredValuesData = [];
        this.multiple = false;
        this.dataSource = undefined;
        this.excludedValues = [];
        this._setEmptyFilteredValues();
    }
    _setEmptyFilteredValues() {
        this._filteredValuesData = [{ id: null, text: 'Загрузка данных...' }];
        this._filteredValues.next(this._filteredValuesData);
    }
    registerOnValidatorChange(fn) {
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
        // если поле обязательно, то зачем показывать пустой вариант?
        if (this.settings.isRequired && !this.settings.emptyText) {
            this.settings.hideEmpty = true;
        }
        //если задан ручной источник данных, то очевидно что искать в нем на сервере не получится
        if (this.dataSource) {
            this.settings.hideSearch = true;
        }
        if (this.disabled !== true) {
            this._componentComboboxFilter.valueChanges
                .pipe(this.takeUntilDestroyed())
                .subscribe((z) => {
                // 1) Не дергаем загрузку, если панель закрыта
                if (!this.comboboxSelect?.panelOpen) {
                    this._onEmptyExpression = undefined;
                    this._onEmptyForseReload = undefined;
                    return;
                }
                // 2) Вся остальная логика — только когда панель реально открыта (пользователь вводит текст)
                this.loadValues(this._onEmptyExpression, this._onEmptyForseReload, true);
                this._onEmptyExpression = undefined;
                this._onEmptyForseReload = undefined;
            });
            setTimeout(() => {
                // если включен выбор первого значения по умолчанию и нет значения
                // или если выбрано значение но нет text для отображения или ключ = text (кейс с фльтрами гридов)
                // нужно загрузить дата сет
                const emptyValue = Utility.isEmpty(this.value);
                const case1 = emptyValue && this.settings.selectFirst === true;
                const case2 = !emptyValue && (this.isTextEmpty || this.value.id === this.value.text);
                if (case1 || case2) {
                    this.loadValues(undefined, true, false);
                }
            }, 500);
        }
    }
    ngAfterViewInit() {
        this.setInitialValue();
    }
    setDefault() {
        super.setDefault();
        if (!this.settings.leftHint) {
            this.settings.leftHint = '';
        }
        if (!this.settings.sourceCode) {
            this.settings.sourceCode = '';
        }
        if (!this.settings.masterD) {
            this.settings.masterD = '';
        }
        if (!this.settings.expressionD) {
            this.settings.expressionD = new Array();
        }
    }
    validate({ value }) {
        if (this.settings?.isRequired) {
            if (value === null || value === undefined) {
                return { 'required': true };
            }
            if (Utility.isEmpty(value.id)) {
                return { 'required': true };
            }
        }
        return null;
    }
    formatValue(model) {
        return model;
    }
    writeLogic(model) {
        if (!Utility.isEmpty(model) && !Utility.isEmpty(model.text)) {
            this._componentComboboxFilter.setValue(model.text);
            if (!Utility.isEmpty(model)) {
                this._filteredValuesData = [model];
                this._filteredValues.next(this._filteredValuesData);
            }
        }
    }
    disabledLogic(isDisabled) {
        if (isDisabled === true) {
            this._componentCombobox.disable();
            if (!Utility.isEmpty(this.value)) {
                this._filteredValuesData = [this.value];
                this._filteredValues.next(this._filteredValuesData);
            }
        }
        if (isDisabled === false) {
            this._componentCombobox.enable();
        }
    }
    onEmpty(expression, forse) {
        this.value = null;
        this._onEmptyExpression = expression;
        this._onEmptyForseReload = forse;
        this._componentComboboxFilter.setValue(undefined);
    }
    loadValues(expression, forse, isFromFilterChange = false) {
        if (this.settings) {
            // если в настройках expressionD есть элементы с флагом skipIfEmpty === true
            // и их value пустой, то не выполняем загрузку данных
            if (this.settings.expressionD && this.settings.expressionD.length > 0) {
                const hasEmptyRequiredExpression = this.settings.expressionD.some(x => x?.skipIfEmpty === true && Utility.isEmpty(x.value));
                if (hasEmptyRequiredExpression) {
                    return;
                }
            }
            this.internalLoadValues((filter) => {
                const descriptor = { text: filter, expression: [] };
                if (!Utility.isEmpty(this.settings.masterD)) {
                    descriptor.expression.push({
                        key: this.settings.masterD,
                        value: this._master
                            ? !Number.isNaN(Number(this._master.id)) ? Number(this._master.id) : this._master.id
                            : undefined
                    });
                }
                if (this.settings.expressionD && this.settings.expressionD.length > 0) {
                    for (let i = 0; i < this.settings.expressionD.length; i++) {
                        if (Array.isArray(this.settings.expressionD[i].value)) {
                            this.settings.expressionD[i].value.forEach(x => {
                                descriptor.expression.push({
                                    key: this.settings.expressionD[i].key,
                                    value: x
                                });
                            });
                        }
                        else {
                            descriptor.expression.push({
                                key: this.settings.expressionD[i].key,
                                value: this.settings.expressionD[i].value
                            });
                        }
                    }
                }
                if (expression && expression.length > 0) {
                    for (let i = 0; i < expression.length; i++) {
                        descriptor.expression.push({
                            key: expression[i].key,
                            value: expression[i].value
                        });
                    }
                }
                const observable = this.settings.sourceCode === 'DataSource'
                    ? this.dataSource
                    : this._comboboxService.loadValues(this.settings.sourceCode, descriptor, this.settings.recordCount, this.settings.module);
                return observable;
            }, forse, isFromFilterChange);
        }
    }
    internalLoadValues(sourceFunc, forse, isFromFilterChange = false) {
        let filter = this._componentComboboxFilter.value;
        if (filter) {
            if (typeof filter === 'string' || filter instanceof String) {
                filter = filter.toLowerCase();
            }
            else {
                filter = filter?.text?.toLowerCase();
            }
        }
        if (!Utility.isEmpty(filter) || !!forse) {
            this.handleReadResult(sourceFunc(filter), isFromFilterChange);
        }
    }
    handleReadResult(observable, isFromFilterChange = false) {
        observable.pipe(catchError(() => of([])), finalize(() => { }))
            .subscribe((response) => {
            if (response.isSuccess === true) {
                let serverItems = response.entity || [];
                // логика с исключаемыми значениями
                if (this.excludedValues && this.excludedValues.length > 0) {
                    if (!Utility.isEmpty(this._componentCombobox.value)) {
                        const excludedValues = this.excludedValues.filter(x => x.id !== this._componentCombobox.value.id);
                        if (excludedValues.length > 0) {
                            serverItems = serverItems.filter(x => !excludedValues.some(y => y.id === x.id));
                        }
                    }
                    else {
                        serverItems = serverItems.filter(x => !this.excludedValues.some(y => y.id === x.id));
                    }
                }
                // Формируем данные для отображения
                // Добавляем выбранное значение в отображение, если его нет в списке с сервера
                let displayItems = [...serverItems];
                if (this.multiple) {
                    // Для multiple: value может быть массивом или null
                    const selectedArray = Array.isArray(this.value) ? this.value : [];
                    if (selectedArray.length > 0) {
                        const serverIds = new Set(serverItems.map(i => i.id));
                        const selectedNotInServer = selectedArray.filter(sel => sel && sel.id !== undefined && !serverIds.has(sel.id));
                        // Выбранные значения (которые не вернул сервер) добавляем в конец
                        if (selectedNotInServer.length > 0) {
                            displayItems = [...displayItems, ...selectedNotInServer];
                        }
                    }
                }
                else {
                    if (this.value && !Utility.isEmpty(this.value.id)) {
                        const isInServerList = serverItems.some(item => item.id === this.value.id);
                        if (!isInServerList) {
                            // Добавляем выбранное значение в начало списка для отображения
                            displayItems = [...displayItems, this.value];
                        }
                    }
                }
                if (this.settings.selectFirst === true && Utility.isEmpty(this.value)) {
                    this.value = serverItems?.length > 0 ? serverItems[0] : undefined;
                }
                // Выполняем каскадную проверку только если компонент зависит от master (settings.masterD установлен)
                // и загрузка НЕ была вызвана изменением фильтра (пользовательского ввода в строку поиска).
                // Для вызовов, идущих от фильтрации, текущее значение сохраняем, даже если сервер вернул пустой список.
                // Проверяем, что текущее выбранное значение есть в новом списке (после изменения master)
                // Если нет - сбрасываем значение для каскадного обновления зависимых контролов         
                if (!isFromFilterChange && !Utility.isEmpty(this.settings.masterD) && !Utility.isEmpty(this.value) && response.entity) {
                    if (serverItems.length === 0) {
                        // Если новый список пуст, сбрасываем значение
                        this.value = null;
                        this._componentComboboxFilter.setValue(undefined);
                    }
                    else if (this.multiple) {
                        // Для множественного выбора проверяем каждый элемент
                        const currentIds = Array.isArray(this.value) ? this.value.map(v => v?.id) : [this.value?.id];
                        const availableIds = serverItems.map(e => e.id);
                        const hasInvalidValues = currentIds.some(id => id !== undefined && !availableIds.includes(id));
                        if (hasInvalidValues) {
                            // Оставляем только валидные значения
                            const validValues = Array.isArray(this.value)
                                ? this.value.filter(v => v?.id && availableIds.includes(v.id))
                                : [];
                            this.value = validValues.length > 0 ? validValues : null;
                            if (validValues.length === 0) {
                                this._componentComboboxFilter.setValue(undefined);
                            }
                        }
                    }
                    else {
                        // Для одиночного выбора проверяем наличие текущего значения в новом списке
                        const currentId = this.value?.id;
                        const isValueInList = serverItems.some(item => item.id === currentId);
                        if (!isValueInList) {
                            this.value = null;
                            this._componentComboboxFilter.setValue(undefined);
                        }
                    }
                }
                this._filteredValuesData = displayItems;
                this._filteredValues.next(this._filteredValuesData);
            }
            else {
                throw Error(response.message);
            }
            if (this.multiple) {
                this.comboboxSelect._scrollStrategy.enable();
            }
        });
    }
    onOpenedChange(isOpen) {
        if (isOpen) {
            this.loadValues(undefined, true, false);
        }
        else {
            if (this._filteredValuesData.length === 0) {
                this._setEmptyFilteredValues();
            }
        }
    }
    setInitialValue() {
        this._filteredValues
            .pipe(take(1), this.takeUntilDestroyed())
            .subscribe((_) => {
            this.comboboxSelect.compareWith = (a, b) => {
                if (Utility.isEmpty(b)) {
                    return false;
                }
                if (a.id === b.id) {
                    // если заполнение данных по id, то лучше проставить тестовые значения в value аналогично
                    if (Utility.isEmpty(b.text)) {
                        this.value.text = a.text;
                        this.value.description = a.description;
                    }
                    return true;
                }
                return false;
            };
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeComboboxComponent, deps: [{ token: CoreComboboxService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTypeComboboxComponent, isStandalone: false, selector: "core-field-combobox", inputs: { multiple: "multiple", master: "master", dataSource: "dataSource", excludedValues: "excludedValues" }, providers: [
            { provide: MAT_SELECT_SCROLL_STRATEGY, useFactory: scrollFactory, deps: [Overlay] },
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTypeComboboxComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFieldTypeComboboxComponent,
                multi: true
            }
        ], queries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "comboboxSelect", first: true, predicate: ["comboboxSelect"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }}\" class=\"sln-core-field-combobox\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <mat-select #comboboxSelect [(ngModel)]=\"value\" [formControl]=\"_componentCombobox\" [placeholder]=\"placeholder\"\n      [required]=\"settings.isRequired\" [disabled]=\"disabled\" [attr.name]=\"fieldName\" [attr.fieldName]=\"fieldName\" \n      (openedChange)=\"onOpenedChange($event)\"  (selectionChange)=\"onUnfocused($event)\">\n      <mat-select-trigger>\n\n        @if (isTextEmpty === false) {\n          <span class=\"mat-select-custom-placeholder\">{{ value?.text }}</span>\n        }\n        @if (isTextEmpty === true) {\n          @for (item of _filteredValues | async | filterCmbx:value?.id; track item) {\n            <span class=\"mat-select-custom-placeholder\" style=\"color: #77809b\">\n              {{ item.text }}\n            </span>\n          }\n        }\n      </mat-select-trigger>\n      @if (!(settings.hideSearch ?? false)) {\n        <core-select-search [formControl]=\"_componentComboboxFilter\" class=\"sln-select-search\"></core-select-search>\n      }\n      @if (!(settings.hideEmpty ?? false)) {\n        <mat-option (click)=\"onEmpty()\" class=\"sln-empty-field\">{{emptyText}}</mat-option>\n      }\n      @for (item of _filteredValues | async; track item) {\n        <mat-option [value]=\"item\">\n          @if (!isHasTemplate) {\n            @if (!item.description) {\n              <span>{{item.text}}</span>\n            }\n            @if (item.description) {\n              <div style=\"margin: 0px; height: 20px\">\n                {{item.text}}\n              </div>\n            }\n            @if (item.description) {\n              <div>\n                <span class=\"small\"> {{item.description}} </span>\n              </div>\n            }\n          }\n          <div #content>\n            <ng-template [ngTemplateOutlet]=\"templateRef\" [ngTemplateOutletContext]=\"{$implicit: item}\"></ng-template>\n          </div>\n        </mat-option>\n      }\n    </mat-select>\n    @if (settings.leftHint?.length > 0) {\n      <mat-hint>{{ settings.leftHint }}</mat-hint>\n    }\n  </mat-form-field>\n  @if (settings.useInformer) {\n    <div class=\"sln-core-field-combobox-p-info\">\n      <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.informerIcon === 'question') {\n          <div class=\"sln-control-question\"></div>\n        }\n        @if (settings.informerIcon === 'alert') {\n          <div class=\"sln-control-mistake\"></div>\n        }\n      </div>\n    </div>\n  }\n</div>\n", styles: [".sln-core-field-combobox-p-info{position:absolute;right:var(--FIELD-INFO-RIGHT, 7px);top:var(--FIELD-INFO-TOP, 19px)}::ng-deep .mat-mdc-form-field .mat-mdc-select.mat-mdc-select-disabled .mat-mdc-select-arrow{display:none}\n"], dependencies: [{ kind: "component", type: i2$3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "component", type: i4$3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i4$3.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "component", type: CoreSelectSearchComponent, selector: "core-select-search", inputs: ["placeholderLabel", "noEntriesFoundLabel"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterCmbxPipe, name: "filterCmbx" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeComboboxComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-combobox', encapsulation: ViewEncapsulation.Emulated, providers: [
                        { provide: MAT_SELECT_SCROLL_STRATEGY, useFactory: scrollFactory, deps: [Overlay] },
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTypeComboboxComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFieldTypeComboboxComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }}\" class=\"sln-core-field-combobox\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <mat-select #comboboxSelect [(ngModel)]=\"value\" [formControl]=\"_componentCombobox\" [placeholder]=\"placeholder\"\n      [required]=\"settings.isRequired\" [disabled]=\"disabled\" [attr.name]=\"fieldName\" [attr.fieldName]=\"fieldName\" \n      (openedChange)=\"onOpenedChange($event)\"  (selectionChange)=\"onUnfocused($event)\">\n      <mat-select-trigger>\n\n        @if (isTextEmpty === false) {\n          <span class=\"mat-select-custom-placeholder\">{{ value?.text }}</span>\n        }\n        @if (isTextEmpty === true) {\n          @for (item of _filteredValues | async | filterCmbx:value?.id; track item) {\n            <span class=\"mat-select-custom-placeholder\" style=\"color: #77809b\">\n              {{ item.text }}\n            </span>\n          }\n        }\n      </mat-select-trigger>\n      @if (!(settings.hideSearch ?? false)) {\n        <core-select-search [formControl]=\"_componentComboboxFilter\" class=\"sln-select-search\"></core-select-search>\n      }\n      @if (!(settings.hideEmpty ?? false)) {\n        <mat-option (click)=\"onEmpty()\" class=\"sln-empty-field\">{{emptyText}}</mat-option>\n      }\n      @for (item of _filteredValues | async; track item) {\n        <mat-option [value]=\"item\">\n          @if (!isHasTemplate) {\n            @if (!item.description) {\n              <span>{{item.text}}</span>\n            }\n            @if (item.description) {\n              <div style=\"margin: 0px; height: 20px\">\n                {{item.text}}\n              </div>\n            }\n            @if (item.description) {\n              <div>\n                <span class=\"small\"> {{item.description}} </span>\n              </div>\n            }\n          }\n          <div #content>\n            <ng-template [ngTemplateOutlet]=\"templateRef\" [ngTemplateOutletContext]=\"{$implicit: item}\"></ng-template>\n          </div>\n        </mat-option>\n      }\n    </mat-select>\n    @if (settings.leftHint?.length > 0) {\n      <mat-hint>{{ settings.leftHint }}</mat-hint>\n    }\n  </mat-form-field>\n  @if (settings.useInformer) {\n    <div class=\"sln-core-field-combobox-p-info\">\n      <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.informerIcon === 'question') {\n          <div class=\"sln-control-question\"></div>\n        }\n        @if (settings.informerIcon === 'alert') {\n          <div class=\"sln-control-mistake\"></div>\n        }\n      </div>\n    </div>\n  }\n</div>\n", styles: [".sln-core-field-combobox-p-info{position:absolute;right:var(--FIELD-INFO-RIGHT, 7px);top:var(--FIELD-INFO-TOP, 19px)}::ng-deep .mat-mdc-form-field .mat-mdc-select.mat-mdc-select-disabled .mat-mdc-select-arrow{display:none}\n"] }]
        }], ctorParameters: () => [{ type: CoreComboboxService }], propDecorators: { comboboxSelect: [{
                type: ViewChild,
                args: ['comboboxSelect']
            }], templateRef: [{
                type: ContentChild,
                args: [TemplateRef]
            }], multiple: [{
                type: Input
            }], master: [{
                type: Input
            }], dataSource: [{
                type: Input
            }], excludedValues: [{
                type: Input
            }] } });
function scrollFactory(overlay) {
    return () => overlay.scrollStrategies.noop();
}

class RuDateAdapter extends NativeDateAdapter {
    constructor() {
        super(...arguments);
        this._devimetr = '.';
    }
    parse(value) {
        if ((typeof value === 'string') && (value.indexOf(this._devimetr) > -1)) {
            const str = value.split(this._devimetr);
            const year = Number(str[2]);
            const month = Number(str[1]) - 1;
            const date = Number(str[0]);
            return new Date(Date.UTC(year, month, date, 0, 0, 0, 0));
        }
        const timestamp = typeof value === 'number' ? value : Date.parse(value);
        return isNaN(timestamp) ? null : new Date(timestamp);
    }
    getFirstDayOfWeek() {
        return 1;
    }
    format(date, displayFormat) {
        if (displayFormat === 'input') {
            const day = date.getDate();
            const month = date.getMonth() + 1;
            const year = date.getFullYear();
            return this._to2digit(day) + this._devimetr + this._to2digit(month) + this._devimetr + year;
        }
        else if (displayFormat === 'inputMonth') {
            const month = date.getMonth() + 1;
            const year = date.getFullYear();
            return this._to2digit(month) + this._devimetr + year;
        }
        else {
            return date.toDateString();
        }
    }
    createDate(year, month, date) {
        return new Date(Date.UTC(year, month, date, 0, 0, 0, 0));
    }
    _to2digit(n) {
        return ('00' + n).slice(-2);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RuDateAdapter, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RuDateAdapter }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RuDateAdapter, decorators: [{
            type: Injectable
        }] });
const APP_DATE_FORMATS = {
    parse: {
        dateInput: { month: 'short', year: 'numeric', day: 'numeric' }
    },
    display: {
        // dateInput: { month: 'short', year: 'numeric', day: 'numeric' },
        dateInput: 'input',
        // monthYearLabel: { month: 'short', year: 'numeric', day: 'numeric' },
        monthYearLabel: 'inputMonth',
        dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
        monthYearA11yLabel: { year: 'numeric', month: 'long' },
    }
};

class DateMaskDirective {
    constructor(elementRef) {
        this.elementRef = elementRef;
        this.format = 'DD.MM.YYYY';
        this.onChange = () => { };
        this.onTouched = () => { };
        this.previousValue = '';
        this.modelValue = null;
        this.el = this.elementRef.nativeElement;
    }
    ngOnInit() {
        this.setupInputListener();
    }
    ngOnChanges(changes) {
        if (changes['format'] && !changes['format'].firstChange) {
            this.updateInputValue(this.modelValue);
        }
    }
    isTimeMaskFormat() {
        return this.format === 'hh:mm';
    }
    /** Разделитель маски: дата — '.' или '/', время — ':'. */
    getMaskSeparatorChar() {
        if (this.isTimeMaskFormat())
            return ':';
        if (this.format.includes('.'))
            return '.';
        return '/';
    }
    // Конвертация из модели (ISO) в отображаемый формат
    modelToDisplay(value) {
        if (!value)
            return '';
        let date;
        if (typeof value === 'string') {
            // Парсим ISO строку
            date = new Date(value);
            if (isNaN(date.getTime()))
                return '';
        }
        else if (value instanceof Date) {
            date = value;
        }
        else {
            return '';
        }
        return DateExtension.format(date, this.format);
    }
    // Конвертация из отображаемого формата в модель (ISO)
    displayToModel(displayValue) {
        if (!displayValue)
            return null;
        if (!DateExtension.isValidInput(displayValue, this.format))
            return null;
        const parsed = DateExtension.parse(displayValue, this.format);
        if (!parsed)
            return null;
        // Возвращаем ISO строку
        return parsed.toISOString();
    }
    // Настройка слушателя ввода с валидацией
    setupInputListener() {
        this.el.addEventListener('input', (e) => {
            const input = e.target;
            let value = input.value;
            // Ограничиваем длину (максимум 10 символов для DD.MM.YYYY)
            const maxLength = this.format.length;
            if (value.length > maxLength) {
                value = value.slice(0, maxLength);
            }
            // Валидация на лету: только цифры и разделители
            const sep = this.getMaskSeparatorChar();
            const sepInClass = sep === '.' ? '\\.' : sep === ':' ? ':' : '/';
            const regex = new RegExp(`^[0-9${sepInClass}]*$`);
            if (!regex.test(value)) {
                input.value = this.previousValue;
                return;
            }
            // Нормализация ручного ввода (например, 4 + 2 -> 04.02)
            const cleanValue = value.replace(/\D/g, '');
            const formatted = this.isTimeMaskFormat()
                ? this.normalizeTimeInputValue(cleanValue)
                : this.normalizeInputValue(cleanValue);
            input.value = formatted;
            this.previousValue = formatted;
            // Обновляем модель
            const modelValue = this.displayToModel(formatted);
            this.onChange(modelValue);
            this.onTouched();
        });
        this.el.addEventListener('blur', () => {
            this.onTouched();
            // Дополнительная валидация при потере фокуса
            const value = this.el.value;
            if (value && value.length === this.format.length) {
                if (!DateExtension.isValidInput(value, this.format)) {
                    this.el.value = '';
                    this.previousValue = '';
                    this.onChange(null);
                    return;
                }
                const parsed = DateExtension.parse(value, this.format);
                if (!parsed || isNaN(parsed.getTime())) {
                    this.el.value = '';
                    this.previousValue = '';
                    this.onChange(null);
                }
            }
        });
        this.el.addEventListener('paste', (e) => {
            e.preventDefault();
            const pastedText = e.clipboardData?.getData('text') ?? '';
            const normalized = this.normalizePastedValue(pastedText);
            if (!normalized) {
                return;
            }
            this.el.value = normalized;
            this.previousValue = normalized;
            const modelValue = this.displayToModel(normalized);
            this.onChange(modelValue);
            this.onTouched();
        });
        // Запрещаем ввод нечисловых символов на лету
        this.el.addEventListener('keydown', (e) => {
            const allowedKeys = ['Backspace', 'Delete', 'Tab', 'Escape', 'Enter', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'];
            // Разрешаем системные сочетания (Ctrl/Meta + C/V/X/A и т.п.)
            if (e.ctrlKey || e.metaKey)
                return;
            if (allowedKeys.includes(e.key))
                return;
            const separator = this.getMaskSeparatorChar();
            if (e.key === separator) {
                e.preventDefault();
                return;
            }
            if (!/^[0-9]$/.test(e.key)) {
                e.preventDefault();
            }
        });
    }
    /** Маска ЧЧ:ММ (24 ч), до 4 цифр. Разбор часы/минуты и ведущий ноль в часы — только со второй цифры. */
    normalizeTimeInputValue(digits) {
        const d = digits.slice(0, 4);
        if (!d.length)
            return '';
        // Первая цифра без дальнейшего анализа (иначе «2» сразу превращалось в «02», как при вводе «24»)
        if (d.length === 1) {
            return d;
        }
        let i = 0;
        const h1 = d[i++];
        let hour = h1;
        if (h1 > '2') {
            hour = `0${h1}`;
        }
        else if (i < d.length) {
            const h2 = d[i];
            const n = parseInt(h1 + h2, 10);
            if (n <= 23) {
                hour = h1 + h2;
                i++;
            }
        }
        const rest = d.slice(i);
        if (!rest.length) {
            return hour;
        }
        const hourPadded = hour.padStart(2, '0');
        const m1 = rest[0];
        let minute = m1;
        if (m1 > '5') {
            minute = `0${m1}`;
        }
        else if (rest.length >= 2) {
            minute = m1 + rest[1];
        }
        return `${hourPadded}:${minute}`;
    }
    normalizeInputValue(cleanValue) {
        const separator = this.getMaskSeparatorChar();
        const formatParts = this.format.split(separator);
        let result = '';
        let charIndex = 0;
        for (let i = 0; i < formatParts.length; i++) {
            const partType = formatParts[i];
            const remaining = cleanValue.slice(charIndex);
            if (!remaining)
                break;
            let partValue = '';
            let expectedLength = partType.length;
            if (partType === 'DD' || partType === 'MM') {
                const first = remaining[0];
                const second = remaining[1];
                const autoPadNeeded = (partType === 'DD' && first > '3') ||
                    (partType === 'MM' && first > '1');
                if (autoPadNeeded) {
                    partValue = `0${first}`;
                    charIndex += 1;
                }
                else if (second) {
                    partValue = `${first}${second}`;
                    charIndex += 2;
                }
                else {
                    partValue = first;
                    charIndex += 1;
                }
            }
            else {
                partValue = remaining.slice(0, expectedLength);
                charIndex += partValue.length;
            }
            result += partValue;
            const isPartComplete = partValue.length === expectedLength;
            if (i < formatParts.length - 1 && isPartComplete && charIndex < cleanValue.length) {
                result += separator;
            }
        }
        return result;
    }
    normalizePastedValue(rawValue) {
        const trimmed = rawValue.trim();
        if (!trimmed)
            return '';
        if (this.isTimeMaskFormat()) {
            const colonParts = trimmed.split(':');
            if (colonParts.length >= 2) {
                const hDigits = colonParts[0].replace(/\D/g, '');
                const mDigits = colonParts[1].replace(/\D/g, '');
                return this.normalizeTimeInputValue((hDigits + mDigits).slice(0, 4));
            }
            return this.normalizeTimeInputValue(trimmed.replace(/\D/g, ''));
        }
        const separator = this.format.includes('.') ? '.' : '/';
        // Поддерживаем вставку с разделителями: '.', '/', '-'
        const parts = trimmed.split(/[./-]/).filter(Boolean);
        if (parts.length >= 3) {
            const dayNum = parseInt(parts[0], 10);
            const monthNum = parseInt(parts[1], 10);
            const yearNum = parseInt(parts[2], 10);
            if (Number.isNaN(dayNum) || Number.isNaN(monthNum) || Number.isNaN(yearNum)) {
                return '';
            }
            const day = dayNum.toString().padStart(2, '0');
            const month = monthNum.toString().padStart(2, '0');
            const year = yearNum.toString().slice(0, 4);
            return `${day}${separator}${month}${separator}${year}`;
        }
        // Фолбэк: если вставили только цифры, прогоняем через общий нормализатор
        const digitsOnly = trimmed.replace(/\D/g, '');
        return this.normalizeInputValue(digitsOnly);
    }
    // Обновление значения из модели
    updateInputValue(value) {
        const displayValue = this.modelToDisplay(value);
        this.el.value = displayValue;
        this.previousValue = displayValue;
    }
    // ControlValueAccessor методы
    writeValue(value) {
        this.modelValue = value;
        this.updateInputValue(value);
    }
    registerOnChange(fn) {
        this.onChange = fn;
    }
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    setDisabledState(isDisabled) {
        this.el.disabled = isDisabled;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DateMaskDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: DateMaskDirective, isStandalone: false, selector: "input[dateMask]", inputs: { format: ["dateMask", "format"] }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => DateMaskDirective),
                multi: true
            }
        ], usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DateMaskDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: 'input[dateMask]',
                    standalone: false,
                    providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => DateMaskDirective),
                            multi: true
                        }
                    ]
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { format: [{
                type: Input,
                args: ['dateMask']
            }] } });

class CoreFieldTypeDateTimeComponent extends CoreAbstractAccessorComponent {
    constructor(_cd) {
        super();
        this._cd = _cd;
        this.isCalendarOpen = false;
        this.calendarPanelTop = null;
        this.calendarPanelLeft = null;
    }
    ngAfterViewInit() {
        this._attachCalendarPanelToBody();
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
        if (this.settings.minCount) {
            const minDate = DateExtension.addDays(new Date(), this.settings.minCount * -1);
            this.settings.minD = minDate;
        }
        if (this.settings.maxCount) {
            const maxDate = DateExtension.addDays(new Date(), this.settings.maxCount);
            this.settings.maxD = maxDate;
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    setDefault() {
        super.setDefault();
        if (!this.settings.leftHint) {
            this.settings.leftHint = '';
        }
        if (!this.settings.minD) {
            this.settings.minD = new Date(1920, 0, 1);
        }
        if (!this.settings.maxD) {
            this.settings.maxD = null;
        }
        if (!this.settings.minCount) {
            this.settings.minCount = null;
        }
        if (!this.settings.maxCount) {
            this.settings.maxCount = null;
        }
    }
    ngOnChanges(changes) {
        if (changes.settings) {
            this.setDefault();
            if (this.settings.minCount) {
                const minDate = DateExtension.addDays(new Date(), this.settings.minCount * -1);
                this.settings.minD = minDate;
            }
            if (this.settings.maxCount) {
                const maxDate = DateExtension.addDays(new Date(), this.settings.maxCount);
                this.settings.maxD = maxDate;
            }
        }
    }
    toggleCalendar(event) {
        event.stopPropagation();
        this.isCalendarOpen = !this.isCalendarOpen;
        if (this.isCalendarOpen) {
            this._setCalendarPanelPosition();
        }
    }
    closeCalendar() {
        this.isCalendarOpen = false;
    }
    onDocumentClick(event) {
        if (!this.isCalendarOpen) {
            return;
        }
        const target = event.target;
        if (target && (this._calendarHost?.nativeElement?.contains(target) || this._calendarPanel?.nativeElement?.contains(target))) {
            return;
        }
        this.closeCalendar();
    }
    onWindowResize() {
        if (this.isCalendarOpen) {
            this._setCalendarPanelPosition();
        }
    }
    onDocumentScroll() {
        if (this.isCalendarOpen) {
            this._setCalendarPanelPosition();
        }
    }
    onCalendarSelected(model) {
        this.onValueChange(model);
        this.onUnfocused(model);
        this.closeCalendar();
        this._cd.detectChanges();
    }
    ngOnDestroy() {
        this._detachCalendarPanelFromBody();
    }
    _setCalendarPanelPosition() {
        const host = this._calendarHost?.nativeElement;
        const dateInput = this._dateInput?.nativeElement;
        if (!host && !dateInput) {
            return;
        }
        const panelWidth = 296;
        const panelHeight = 354;
        const offset = 2;
        const viewportPadding = 8;
        const hostRect = host?.getBoundingClientRect() ?? dateInput.getBoundingClientRect();
        const formFieldEl = dateInput?.closest('.mat-mdc-form-field');
        const formFieldRect = formFieldEl?.getBoundingClientRect() ?? dateInput?.getBoundingClientRect() ?? hostRect;
        // Горизонтально равняем по правой границе самого контрола.
        let left = formFieldRect.right - panelWidth;
        if (left < viewportPadding) {
            left = viewportPadding;
        }
        if (left + panelWidth > window.innerWidth - viewportPadding) {
            left = window.innerWidth - panelWidth - viewportPadding;
        }
        // Вертикально привязываем к нижней границе самого контрола.
        let top = formFieldRect.bottom + offset;
        if (top + panelHeight > window.innerHeight - viewportPadding) {
            top = formFieldRect.top - panelHeight - offset;
        }
        if (top < viewportPadding) {
            top = viewportPadding;
        }
        this.calendarPanelLeft = `${left}px`;
        this.calendarPanelTop = `${top}px`;
    }
    _attachCalendarPanelToBody() {
        const panel = this._calendarPanel?.nativeElement;
        if (!panel || panel.parentElement === document.body) {
            return;
        }
        document.body.appendChild(panel);
    }
    _detachCalendarPanelFromBody() {
        const panel = this._calendarPanel?.nativeElement;
        if (!panel || panel.parentElement !== document.body) {
            return;
        }
        panel.remove();
    }
    dateIsValid(date, model) {
        if (!date || date === ' ') {
            this._dateInput.nativeElement.value = '';
            if (!this.settings?.isRequired) {
                model.control.setErrors(null);
            }
            return;
        }
        const dateArr = date.split('.');
        const toDateFormat = new Date(+dateArr[2], +dateArr[1] - 1, +dateArr[0]);
        model.control.markAsTouched();
        const errors = {};
        let hasErrors = false;
        if (toDateFormat.getMonth() !== +dateArr[1] - 1) {
            errors['incorrect'] = true;
            hasErrors = true;
        }
        if (this.settings.minD) {
            const minDate = DateExtension.getDatePart(new Date(this.settings.minD));
            const valueDate = DateExtension.getDatePart(toDateFormat);
            if (valueDate < minDate) {
                errors['matDatepickerMin'] = { min: this.settings.minD };
                hasErrors = true;
            }
        }
        if (this.settings.maxD && toDateFormat > this.settings.maxD) {
            errors['matDatepickerMax'] = { max: this.settings.maxD };
            hasErrors = true;
        }
        if (hasErrors) {
            model.control.setErrors(errors);
        }
        else {
            model.control.setErrors(null);
        }
        this.onUnfocused(model);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeDateTimeComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTypeDateTimeComponent, isStandalone: false, selector: "core-field-date", host: { listeners: { "document:click": "onDocumentClick($event)", "window:resize": "onWindowResize()", "document:scroll": "onDocumentScroll()" } }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTypeDateTimeComponent),
                multi: true
            },
            { provide: DateAdapter, useClass: RuDateAdapter },
            { provide: MAT_DATE_LOCALE, useValue: 'ru-RU' },
            { provide: MAT_DATE_FORMATS, useValue: APP_DATE_FORMATS },
        ], viewQueries: [{ propertyName: "_dateInput", first: true, predicate: ["dateInput"], descendants: true }, { propertyName: "_calendarHost", first: true, predicate: ["calendarHost"], descendants: true }, { propertyName: "_calendarPanel", first: true, predicate: ["calendarPanel"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }} sln-datetime\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input class=\"sln-date-input\" matInput #dateInput #control=\"ngModel\" \n      [(ngModel)]=\"value\" \n      name=\"{{ fieldName }}\"\n      placeholder=\"\u0414\u0414.\u041C\u041C.\u0413\u0413\u0413\u0413\"\n      [attr.fieldName]=\"fieldName\"\n      [required]=\"settings.isRequired\"\n      [readonly]=\"settings.isReadonly ? settings.isReadonly : null\"\n      [min]=\"settings.isRequired || value ? (settings.minD !== null ? settings.minD : null) : null\"\n      [max]=\"settings.isRequired || value ? (settings.maxD !== null ? settings.maxD : null) : null\"\n      [disabled]=\"disabled\"\n\n      dateMask=\"DD.MM.YYYY\"\n      \n      (blur)=\"dateIsValid(dateInput.value, control)\" \n      (ngModelChange)=\"onValueChange($event)\"\n    />\n      \n\n\n        <div class=\"mat-hint\">\n          @if (settings.leftHint?.length > 0) {\n            <mat-hint>{{ settings.leftHint }}</mat-hint>\n          }\n        </div>\n      </mat-form-field>\n      <div class=\"sln-core-field-datetime-p-info\">\n        <div class=\"sln-core-field-datetime-d-toggle\" #calendarHost>\n          <button type=\"button\" class=\"sln-calendar-toggle-btn\" [disabled]=\"disabled || (settings.isReadonly ? settings.isReadonly : false)\" (click)=\"toggleCalendar($event)\">\n            <div class=\"sln-common-calendar\"></div>\n          </button>\n          <div #calendarPanel class=\"sln-calendar-panel\" [class.sln-calendar-panel--open]=\"isCalendarOpen\"\n            [ngStyle]=\"{ top: calendarPanelTop, left: calendarPanelLeft }\"\n            (click)=\"$event.stopPropagation()\">\n            <mat-calendar\n              [selected]=\"value\"\n              [minDate]=\"settings.minD !== null ? settings.minD : null\"\n              [maxDate]=\"settings.maxD !== null ? settings.maxD : null\"\n              (selectedChange)=\"onCalendarSelected($event)\">\n            </mat-calendar>\n          </div>\n        </div>\n        <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"   class=\"sln-info-informers\">\n          @if (settings.useInformer && settings.informerIcon === 'question') {\n            <div class=\"sln-control-question\"></div>\n          }\n          @if (settings.useInformer && settings.informerIcon === 'alert') {\n            <div class=\"sln-control-mistake\"></div>\n          }\n        </div>\n        @if (control.hasError('incorrect')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u0443\u044E \u0434\u0430\u0442\u0443\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (settings.maxD !== null && control.hasError('matDatepickerMax')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u0414\u0430\u0442\u0430 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 {{ control.errors['matDatepickerMax']?.max | dateRu }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (settings.minD !== null && control.hasError('matDatepickerMin')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u0414\u0430\u0442\u0430 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u043C\u0435\u043D\u044C\u0448\u0435 {{ control.errors['matDatepickerMin']?.min | dateRu }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n", styles: ["@charset \"UTF-8\";.sln-date-input{background:transparent!important}input.sln-timepicker-mat-bridge{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;width:1px;margin:0;padding:0;overflow:hidden;position:absolute;white-space:nowrap;border:0;opacity:0;pointer-events:none}.sln-core-field-datetime-d-toggle{position:relative;display:flex;align-items:center;margin-left:5px}.sln-calendar-toggle-btn{border:none;background:transparent;padding:0;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:#0000008a}.sln-calendar-toggle-btn:disabled{cursor:default;opacity:.4}.sln-calendar-panel{display:none;position:fixed;z-index:5000;width:296px;height:354px;background:#fff;border:1px solid rgba(0,0,0,.12);border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.sln-calendar-panel.sln-calendar-panel--open{display:block}.sln-calendar-panel mat-calendar{display:block;width:296px;height:354px}.sln-field-layout{position:relative}.sln-core-field-datetime-p-info{display:flex;align-items:center;flex-direction:row-reverse;position:absolute;top:var(--FIELD-INFO-TOP-DATETIME, 18px);right:var(--FIELD-INFO-RIGHT, 7px)}\n"], dependencies: [{ kind: "component", type: i1$6.MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: DigitMaxDirective, selector: "[max]", inputs: ["max"] }, { kind: "directive", type: DigitMinDirective, selector: "[min]", inputs: ["min"] }, { kind: "directive", type: DateMaskDirective, selector: "input[dateMask]", inputs: ["dateMask"] }, { kind: "pipe", type: RuDatePipe, name: "dateRu" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeDateTimeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-date', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTypeDateTimeComponent),
                            multi: true
                        },
                        { provide: DateAdapter, useClass: RuDateAdapter },
                        { provide: MAT_DATE_LOCALE, useValue: 'ru-RU' },
                        { provide: MAT_DATE_FORMATS, useValue: APP_DATE_FORMATS },
                    ], standalone: false, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }} sln-datetime\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input class=\"sln-date-input\" matInput #dateInput #control=\"ngModel\" \n      [(ngModel)]=\"value\" \n      name=\"{{ fieldName }}\"\n      placeholder=\"\u0414\u0414.\u041C\u041C.\u0413\u0413\u0413\u0413\"\n      [attr.fieldName]=\"fieldName\"\n      [required]=\"settings.isRequired\"\n      [readonly]=\"settings.isReadonly ? settings.isReadonly : null\"\n      [min]=\"settings.isRequired || value ? (settings.minD !== null ? settings.minD : null) : null\"\n      [max]=\"settings.isRequired || value ? (settings.maxD !== null ? settings.maxD : null) : null\"\n      [disabled]=\"disabled\"\n\n      dateMask=\"DD.MM.YYYY\"\n      \n      (blur)=\"dateIsValid(dateInput.value, control)\" \n      (ngModelChange)=\"onValueChange($event)\"\n    />\n      \n\n\n        <div class=\"mat-hint\">\n          @if (settings.leftHint?.length > 0) {\n            <mat-hint>{{ settings.leftHint }}</mat-hint>\n          }\n        </div>\n      </mat-form-field>\n      <div class=\"sln-core-field-datetime-p-info\">\n        <div class=\"sln-core-field-datetime-d-toggle\" #calendarHost>\n          <button type=\"button\" class=\"sln-calendar-toggle-btn\" [disabled]=\"disabled || (settings.isReadonly ? settings.isReadonly : false)\" (click)=\"toggleCalendar($event)\">\n            <div class=\"sln-common-calendar\"></div>\n          </button>\n          <div #calendarPanel class=\"sln-calendar-panel\" [class.sln-calendar-panel--open]=\"isCalendarOpen\"\n            [ngStyle]=\"{ top: calendarPanelTop, left: calendarPanelLeft }\"\n            (click)=\"$event.stopPropagation()\">\n            <mat-calendar\n              [selected]=\"value\"\n              [minDate]=\"settings.minD !== null ? settings.minD : null\"\n              [maxDate]=\"settings.maxD !== null ? settings.maxD : null\"\n              (selectedChange)=\"onCalendarSelected($event)\">\n            </mat-calendar>\n          </div>\n        </div>\n        <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"   class=\"sln-info-informers\">\n          @if (settings.useInformer && settings.informerIcon === 'question') {\n            <div class=\"sln-control-question\"></div>\n          }\n          @if (settings.useInformer && settings.informerIcon === 'alert') {\n            <div class=\"sln-control-mistake\"></div>\n          }\n        </div>\n        @if (control.hasError('incorrect')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u0443\u044E \u0434\u0430\u0442\u0443\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (settings.maxD !== null && control.hasError('matDatepickerMax')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u0414\u0430\u0442\u0430 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 {{ control.errors['matDatepickerMax']?.max | dateRu }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (settings.minD !== null && control.hasError('matDatepickerMin')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u0414\u0430\u0442\u0430 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u043C\u0435\u043D\u044C\u0448\u0435 {{ control.errors['matDatepickerMin']?.min | dateRu }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n", styles: ["@charset \"UTF-8\";.sln-date-input{background:transparent!important}input.sln-timepicker-mat-bridge{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;width:1px;margin:0;padding:0;overflow:hidden;position:absolute;white-space:nowrap;border:0;opacity:0;pointer-events:none}.sln-core-field-datetime-d-toggle{position:relative;display:flex;align-items:center;margin-left:5px}.sln-calendar-toggle-btn{border:none;background:transparent;padding:0;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:#0000008a}.sln-calendar-toggle-btn:disabled{cursor:default;opacity:.4}.sln-calendar-panel{display:none;position:fixed;z-index:5000;width:296px;height:354px;background:#fff;border:1px solid rgba(0,0,0,.12);border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.sln-calendar-panel.sln-calendar-panel--open{display:block}.sln-calendar-panel mat-calendar{display:block;width:296px;height:354px}.sln-field-layout{position:relative}.sln-core-field-datetime-p-info{display:flex;align-items:center;flex-direction:row-reverse;position:absolute;top:var(--FIELD-INFO-TOP-DATETIME, 18px);right:var(--FIELD-INFO-RIGHT, 7px)}\n"] }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { _dateInput: [{
                type: ViewChild,
                args: ['dateInput']
            }], _calendarHost: [{
                type: ViewChild,
                args: ['calendarHost']
            }], _calendarPanel: [{
                type: ViewChild,
                args: ['calendarPanel']
            }], onDocumentClick: [{
                type: HostListener,
                args: ['document:click', ['$event']]
            }], onWindowResize: [{
                type: HostListener,
                args: ['window:resize']
            }], onDocumentScroll: [{
                type: HostListener,
                args: ['document:scroll']
            }] } });

class CoreFieldTypeMultipleComboboxComponent extends CoreFieldTypeComboboxComponent {
    constructor(_comboboxService) {
        super(_comboboxService);
        this.anyChecked = false;
        this.allComplete = false;
        this.multiple = true;
    }
    ngOnInit() {
        this.value = [];
        super.ngOnInit();
    }
    // переопределение из-за того, что не выводятся значения при редактировании объекта
    ngAfterViewInit() {
        this.setInitialMultiValue();
    }
    validate({ value }) {
        if (this.settings?.isRequired && (!value || value.length === 0)) {
            return { 'required': true };
        }
        return null;
    }
    changeComboBoxValue($event) {
    }
    onOpenedChange(isOpen) {
        super.onOpenedChange(isOpen);
    }
    getChipValue({ text }) {
        return text;
    }
    someComplete() {
        if (Utility.isEmpty(this.value) || this.value.length === 0) {
            return false;
        }
        this._filteredValues.subscribe(set => {
            this.anyChecked = set.length !== this.value.length && !this.allComplete;
        });
        return this.anyChecked;
    }
    updateAllComplete() {
        this._filteredValues.subscribe(set => {
            this.allComplete = set.length === this.value.length;
        });
    }
    unselectItem(item) {
        this.value = this.value.filter(z => z.id !== item.id);
    }
    selectAll($event) {
        this.value = [];
        this.allComplete = $event;
        if ($event === true) {
            this._filteredValues.subscribe(set => {
                if (set && set.length > 0) {
                    set.forEach(x => { this.value.push(x); });
                }
            });
        }
    }
    setInitialMultiValue() {
        this._filteredValues
            .pipe(take(1), this.takeUntilDestroyed())
            .subscribe(() => {
            this.comboboxSelect.compareWith = (a, b) => {
                if (Utility.isEmpty(b)) {
                    return false;
                }
                if (a.id === b.id) {
                    this.value = this.value.filter(item => item.id !== a.id);
                    this.value.push(a);
                    return true;
                }
                return false;
            };
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeMultipleComboboxComponent, deps: [{ token: CoreComboboxService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTypeMultipleComboboxComponent, isStandalone: false, selector: "core-field-multiple-combobox", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTypeMultipleComboboxComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFieldTypeMultipleComboboxComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }}\" class=\"sln-core-field-combobox\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <mat-select #comboboxSelect [(ngModel)]=\"value\" [formControl]=\"_componentCombobox\" [placeholder]=\"placeholder\"\n      [required]=\"settings.isRequired\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\" [multiple]=\"true\"\n      (openedChange)=\"onOpenedChange($event)\" (closed)=\"onUnfocused(value)\">\n      <mat-select-trigger>\n        @if (!isTextEmpty) {\n          <div></div>\n        }\n        @if (isTextEmpty) {\n          <div>\n            @if (!!value) {\n              <mat-chip-listbox>\n                @for (val of value; track val) {\n                  <mat-chip removable=\"true\" (removed)=\"unselectItem(val)\">\n                    {{ getChipValue(val) }}\n              <mat-icon matChipRemove class=\"fas fa-times pointer\" title=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\">\n                <div alt=\"delete-search\" class=\"sln-common-cross-table\"></div>\n              </mat-icon>\n                  </mat-chip>\n                }\n              </mat-chip-listbox>\n            }\n          </div>\n        }\n      </mat-select-trigger>\n      @if (!(settings.hideSearch ?? false)) {\n        <core-select-search [formControl]=\"_componentComboboxFilter\" class=\"sln-select-search\"></core-select-search>\n      }\n      <span class=\"sln-multiselect sln-select-search\">\n        <mat-checkbox\n          [checked]=\"allComplete\"\n          [indeterminate]=\"someComplete()\"\n          (change)=\"selectAll($event.checked)\"\n        class=\"sln-mat-checkbox\">\u0412\u044B\u0434\u0435\u043B\u0438\u0442\u044C \u0432\u0441\u0435</mat-checkbox>\n      </span>\n      @for (item of _filteredValues | async; track item) {\n        <mat-option [value]=\"item\" (click)=\"updateAllComplete()\">\n          @if (!item.description) {\n            <span>{{item.text}}</span>\n          }\n          @if (item.description) {\n            <div class=\"sln-name-per\">\n              <span>{{item.text}}</span>\n            </div>\n          }\n          @if (item.description) {\n            <div class=\"sln-name-email\">\n              <span class=\"small\"> {{item.description}} </span>\n            </div>\n          }\n        </mat-option>\n      }\n    </mat-select>\n    @if (settings.leftHint?.length > 0) {\n      <mat-hint>{{ settings.leftHint }}</mat-hint>\n    }\n  </mat-form-field>\n  @if (settings.useInformer) {\n    <div class=\"sln-core-field-multicombobox-p-info\">\n      <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.informerIcon === 'question') {\n          <div class=\"sln-control-question\"></div>\n        }\n        @if (settings.informerIcon === 'alert') {\n          <div class=\"sln-control-mistake\"></div>\n        }\n      </div>\n    </div>\n  }\n</div>\n", styles: [".sln-name-per{margin:0;height:15px;color:var(--DARK-GREY)}.sln-name-per span{font-family:var(--font-medium);letter-spacing:.01em}.sln-multiselect{padding-left:15px}.sln-name-email .small{color:var(--GRAY-SOFT);font-family:var(--font);letter-spacing:.01em}.sln-core-field-multicombobox-p-info{position:absolute;right:var(--FIELD-INFO-RIGHT, 5px);top:var(--FIELD-INFO-TOP, 19px)}::ng-deep .mat-mdc-form-field .mat-mdc-select.mat-mdc-select-disabled .mat-mdc-select-arrow{display:none}.sln-common-cross-table{background-size:13px;width:13px;height:13px;padding:14px 13px 13px}\n"], dependencies: [{ kind: "component", type: i2$3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4$4.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["role", "id", "aria-label", "aria-description", "value", "color", "removable", "highlighted", "disableRipple", "disabled"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "component", type: i4$4.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "directive", type: i4$4.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "component", type: i4$3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i4$3.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "component", type: CoreSelectSearchComponent, selector: "core-select-search", inputs: ["placeholderLabel", "noEntriesFoundLabel"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeMultipleComboboxComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-multiple-combobox', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTypeMultipleComboboxComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFieldTypeMultipleComboboxComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }}\" class=\"sln-core-field-combobox\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <mat-select #comboboxSelect [(ngModel)]=\"value\" [formControl]=\"_componentCombobox\" [placeholder]=\"placeholder\"\n      [required]=\"settings.isRequired\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\" [multiple]=\"true\"\n      (openedChange)=\"onOpenedChange($event)\" (closed)=\"onUnfocused(value)\">\n      <mat-select-trigger>\n        @if (!isTextEmpty) {\n          <div></div>\n        }\n        @if (isTextEmpty) {\n          <div>\n            @if (!!value) {\n              <mat-chip-listbox>\n                @for (val of value; track val) {\n                  <mat-chip removable=\"true\" (removed)=\"unselectItem(val)\">\n                    {{ getChipValue(val) }}\n              <mat-icon matChipRemove class=\"fas fa-times pointer\" title=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\">\n                <div alt=\"delete-search\" class=\"sln-common-cross-table\"></div>\n              </mat-icon>\n                  </mat-chip>\n                }\n              </mat-chip-listbox>\n            }\n          </div>\n        }\n      </mat-select-trigger>\n      @if (!(settings.hideSearch ?? false)) {\n        <core-select-search [formControl]=\"_componentComboboxFilter\" class=\"sln-select-search\"></core-select-search>\n      }\n      <span class=\"sln-multiselect sln-select-search\">\n        <mat-checkbox\n          [checked]=\"allComplete\"\n          [indeterminate]=\"someComplete()\"\n          (change)=\"selectAll($event.checked)\"\n        class=\"sln-mat-checkbox\">\u0412\u044B\u0434\u0435\u043B\u0438\u0442\u044C \u0432\u0441\u0435</mat-checkbox>\n      </span>\n      @for (item of _filteredValues | async; track item) {\n        <mat-option [value]=\"item\" (click)=\"updateAllComplete()\">\n          @if (!item.description) {\n            <span>{{item.text}}</span>\n          }\n          @if (item.description) {\n            <div class=\"sln-name-per\">\n              <span>{{item.text}}</span>\n            </div>\n          }\n          @if (item.description) {\n            <div class=\"sln-name-email\">\n              <span class=\"small\"> {{item.description}} </span>\n            </div>\n          }\n        </mat-option>\n      }\n    </mat-select>\n    @if (settings.leftHint?.length > 0) {\n      <mat-hint>{{ settings.leftHint }}</mat-hint>\n    }\n  </mat-form-field>\n  @if (settings.useInformer) {\n    <div class=\"sln-core-field-multicombobox-p-info\">\n      <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.informerIcon === 'question') {\n          <div class=\"sln-control-question\"></div>\n        }\n        @if (settings.informerIcon === 'alert') {\n          <div class=\"sln-control-mistake\"></div>\n        }\n      </div>\n    </div>\n  }\n</div>\n", styles: [".sln-name-per{margin:0;height:15px;color:var(--DARK-GREY)}.sln-name-per span{font-family:var(--font-medium);letter-spacing:.01em}.sln-multiselect{padding-left:15px}.sln-name-email .small{color:var(--GRAY-SOFT);font-family:var(--font);letter-spacing:.01em}.sln-core-field-multicombobox-p-info{position:absolute;right:var(--FIELD-INFO-RIGHT, 5px);top:var(--FIELD-INFO-TOP, 19px)}::ng-deep .mat-mdc-form-field .mat-mdc-select.mat-mdc-select-disabled .mat-mdc-select-arrow{display:none}.sln-common-cross-table{background-size:13px;width:13px;height:13px;padding:14px 13px 13px}\n"] }]
        }], ctorParameters: () => [{ type: CoreComboboxService }] });

class CoreFieldTypeNumberComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
        if (this.isInt === true) {
            this.settings.decimals = 0;
        }
        if (this.settings.isMoney === true && Utility.isEmpty(this.settings.minN)) {
            this.settings.minN = 0;
        }
        if (this.settings.isPercentage === true && Utility.isEmpty(this.settings.minN)) {
            this.settings.minN = 0;
        }
        if (this.settings.isPercentage === true && Utility.isEmpty(this.settings.maxN)) {
            this.settings.maxN = 100;
        }
    }
    setDefault() {
        super.setDefault();
        if (!this.settings.leftHint) {
            this.settings.leftHint = '';
        }
        if (!this.settings.minN) {
            this.settings.minN = null;
        }
        if (!this.settings.maxN) {
            this.settings.maxN = null;
        }
        if (!this.settings.isMoney) {
            this.settings.isMoney = false;
        }
        if (!this.settings.isPercentage) {
            this.settings.isPercentage = false;
        }
        if (!this.settings.decimals) {
            this.settings.decimals = 2;
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model || model === 0) {
            if (model === '-' || model === 'NaN') {
                return model;
            }
            return Number(model);
        }
        return undefined;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeNumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTypeNumberComponent, isStandalone: false, selector: "core-field-number", inputs: { isInt: "isInt" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTypeNumberComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }}\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" [placeholder]=\"placeholder\" (ngModelChange)=\"onValueChange($event)\" (blur)=\"onUnfocused($event)\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [min]=\"settings.minN !== null ? settings.minN : null\"\n      [max]=\"settings.maxN !== null ? settings.maxN : null\" [attr.fieldName]=\"fieldName\" [mask]=\"'separator.' + settings.decimals\" [allowNegativeNumbers]=\"true\" decimalMarker=\",\" [disabled]=\"disabled\" name=\"{{ fieldName }}\" />\n      <div class=\"mat-hint\">\n        @if (settings.leftHint?.length > 0) {\n          <mat-hint>{{ settings.leftHint }}</mat-hint>\n        }\n      </div>\n    </mat-form-field>\n    <div class=\"sln-core-field-number-p-info\">\n      <div class=\"sln-control-rub\" matTooltip=\"{{ settings.moneyText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.isMoney) {\n          <div class=\"sln-common-control-rub\"></div>\n        }\n      </div>\n      <div matTooltip=\"{{ settings.percentageText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.isPercentage) {\n          <div class=\"sln-control-percent\"></div>\n        }\n      </div>\n      <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.useInformer && settings.informerIcon === 'question') {\n          <div class=\"sln-control-question\"></div>\n        }\n        @if (settings.useInformer && settings.informerIcon === 'alert') {\n          <div class=\"sln-control-mistake\"></div>\n        }\n      </div>\n      @if (settings.maxN !== null && control.hasError('max')) {\n        <mat-error>\n          <div matTooltip=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 {{ control.errors['max']?.max }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-mistake\"></div>\n          </div>\n        </mat-error>\n      }\n      @if (settings.minN !== null && control.hasError('min')) {\n        <mat-error>\n          <div matTooltip=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043C\u0435\u043D\u044C\u0448\u0435 {{ control.errors['min']?.min }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-mistake\"></div>\n          </div>\n        </mat-error>\n      }\n    </div>\n  </div>\n", styles: [".sln-core-field-number-p-info{position:absolute;top:var(--FIELD-INFO-TOP, 19px);right:var(--FIELD-INFO-RIGHT, 7px);display:flex;align-items:center}.sln-core-field-number-p-info img{margin-left:5px}.sln-core-field-number-p-info mat-error{position:relative;min-width:20px}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: DigitMaxDirective, selector: "[max]", inputs: ["max"] }, { kind: "directive", type: DigitMinDirective, selector: "[min]", inputs: ["min"] }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeNumberComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-number', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTypeNumberComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }}\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" [placeholder]=\"placeholder\" (ngModelChange)=\"onValueChange($event)\" (blur)=\"onUnfocused($event)\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [min]=\"settings.minN !== null ? settings.minN : null\"\n      [max]=\"settings.maxN !== null ? settings.maxN : null\" [attr.fieldName]=\"fieldName\" [mask]=\"'separator.' + settings.decimals\" [allowNegativeNumbers]=\"true\" decimalMarker=\",\" [disabled]=\"disabled\" name=\"{{ fieldName }}\" />\n      <div class=\"mat-hint\">\n        @if (settings.leftHint?.length > 0) {\n          <mat-hint>{{ settings.leftHint }}</mat-hint>\n        }\n      </div>\n    </mat-form-field>\n    <div class=\"sln-core-field-number-p-info\">\n      <div class=\"sln-control-rub\" matTooltip=\"{{ settings.moneyText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.isMoney) {\n          <div class=\"sln-common-control-rub\"></div>\n        }\n      </div>\n      <div matTooltip=\"{{ settings.percentageText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.isPercentage) {\n          <div class=\"sln-control-percent\"></div>\n        }\n      </div>\n      <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n        @if (settings.useInformer && settings.informerIcon === 'question') {\n          <div class=\"sln-control-question\"></div>\n        }\n        @if (settings.useInformer && settings.informerIcon === 'alert') {\n          <div class=\"sln-control-mistake\"></div>\n        }\n      </div>\n      @if (settings.maxN !== null && control.hasError('max')) {\n        <mat-error>\n          <div matTooltip=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 {{ control.errors['max']?.max }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-mistake\"></div>\n          </div>\n        </mat-error>\n      }\n      @if (settings.minN !== null && control.hasError('min')) {\n        <mat-error>\n          <div matTooltip=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043C\u0435\u043D\u044C\u0448\u0435 {{ control.errors['min']?.min }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-mistake\"></div>\n          </div>\n        </mat-error>\n      }\n    </div>\n  </div>\n", styles: [".sln-core-field-number-p-info{position:absolute;top:var(--FIELD-INFO-TOP, 19px);right:var(--FIELD-INFO-RIGHT, 7px);display:flex;align-items:center}.sln-core-field-number-p-info img{margin-left:5px}.sln-core-field-number-p-info mat-error{position:relative;min-width:20px}\n"] }]
        }], ctorParameters: () => [], propDecorators: { isInt: [{
                type: Input
            }] } });

class CoreFieldTypeStringComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (!Utility.isEmpty(model)) {
            if (model?.indexOf('\\') !== -1) {
                model = model.replace('\\', '/');
            }
            model = model.trim();
        }
        return model;
    }
    setDefault() {
        super.setDefault();
        if (!this.settings.leftHint) {
            this.settings.leftHint = '';
        }
        if (!this.settings.maxLength) {
            this.settings.maxLength = 250;
        }
        if (!this.settings.defaultText) {
            this.settings.defaultText = '';
        }
        if (!this.settings.useMask) {
            this.settings.useMask = false;
        }
        if (!this.settings.maskExpression) {
            this.settings.maskExpression = null;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeStringComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTypeStringComponent, isStandalone: false, selector: "core-field-string", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTypeStringComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field  class=\"{{ cmpClass }}\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" placeholder=\"{{ settings.defaultText }}\" (ngModelChange)=\"onValueChange($event)\" (blur)=\"onUnfocused($event)\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\"\n      [mask]=\"settings.useMask ? settings.maskExpression : null\" [attr.maxlength]=\"settings.maxLength > 0 ? settings.maxLength : 250\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n      }\n      @if (!disabled && !settings.useMask && !settings.rightHintHide) {\n        <mat-hint align=\"end\">{{ control.value?.length || 0 }} / {{settings.maxLength || 250}}</mat-hint>\n      }\n    </mat-form-field>\n    <div class=\"sln-core-field-string-p-info\">\n      @if (settings.useInformer) {\n        <div>\n          <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            @if (settings.informerIcon === 'question') {\n              <div class=\"sln-control-question\"></div>\n            }\n            @if (settings.informerIcon === 'alert') {\n              <div class=\"sln-control-mistake\"></div>\n            }\n          </div>\n        </div>\n      }\n      @if (settings.useMask && control.hasError('mask')) {\n        <mat-error>\n          <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-mistake\"></div>\n          </div>\n        </mat-error>\n      }\n    </div>\n  </div>\n", styles: [".sln-core-field-string-p-info{position:absolute;right:var(--FIELD-INFO-RIGHT, 7px);top:var(--FIELD-INFO-TOP, 19px)}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeStringComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-string', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTypeStringComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field  class=\"{{ cmpClass }}\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" placeholder=\"{{ settings.defaultText }}\" (ngModelChange)=\"onValueChange($event)\" (blur)=\"onUnfocused($event)\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\"\n      [mask]=\"settings.useMask ? settings.maskExpression : null\" [attr.maxlength]=\"settings.maxLength > 0 ? settings.maxLength : 250\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n      }\n      @if (!disabled && !settings.useMask && !settings.rightHintHide) {\n        <mat-hint align=\"end\">{{ control.value?.length || 0 }} / {{settings.maxLength || 250}}</mat-hint>\n      }\n    </mat-form-field>\n    <div class=\"sln-core-field-string-p-info\">\n      @if (settings.useInformer) {\n        <div>\n          <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            @if (settings.informerIcon === 'question') {\n              <div class=\"sln-control-question\"></div>\n            }\n            @if (settings.informerIcon === 'alert') {\n              <div class=\"sln-control-mistake\"></div>\n            }\n          </div>\n        </div>\n      }\n      @if (settings.useMask && control.hasError('mask')) {\n        <mat-error>\n          <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-mistake\"></div>\n          </div>\n        </mat-error>\n      }\n    </div>\n  </div>\n", styles: [".sln-core-field-string-p-info{position:absolute;right:var(--FIELD-INFO-RIGHT, 7px);top:var(--FIELD-INFO-TOP, 19px)}\n"] }]
        }], ctorParameters: () => [] });

class ExternalRedirectComponent extends CoreAbstractComponent {
    constructor(_startUpM, _route) {
        super();
        this._startUpM = _startUpM;
        this._route = _route;
    }
    ngOnInit() {
        const path = this._startUpM.getByKey('APP_URL_BASE');
        window.location.href = path + this._route.snapshot.data.url;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ExternalRedirectComponent, deps: [{ token: Startup }, { token: i1$7.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: ExternalRedirectComponent, isStandalone: false, selector: "core-redirect", usesInheritance: true, ngImport: i0, template: 'redirecting...', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ExternalRedirectComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'core-redirect',
                    template: 'redirecting...',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: Startup }, { type: i1$7.ActivatedRoute }] });

class CoreUserIconComponent extends CoreAbstractComponent {
    constructor() {
        super(...arguments);
        this.requestLitter = '';
        this.surnameLetter = '';
        this.nameLetter = '';
        this.fullNameValue = '';
        this.useInChat = false;
        this.sizeSuffix = 'small';
    }
    set fullName(value) {
        if (!value) {
            return;
        }
        this.requestLitter = '';
        this.fullNameValue = value;
        if (value.indexOf('Заявка') !== -1 || value.indexOf('Request') !== -1) {
            const patern = /\d{6}/g;
            const numbers = value.match(patern)[0] ?? '';
            let zero = false;
            for (let index = 0; index < numbers.length; index++) {
                if ((numbers[index] === '0' && zero !== false) || numbers[index] !== '0') {
                    this.requestLitter += numbers[index].toString();
                    zero = true;
                }
            }
        }
        else {
            const splitName = value.split(' ').filter(x => !Utility.isEmpty(x));
            this.surnameLetter = splitName[0][0];
            if (splitName[1]) {
                this.nameLetter = splitName[1][0];
            }
        }
    }
    get avatarStyle() {
        if (Utility.isEmpty(this.url)) {
            const color = Utility.isEmpty(this.backColor)
                ? 'rgb(' + this.getColorString(this.surnameLetter, this.nameLetter) + ')'
                : this.backColor;
            return {
                'background': color,
                'font-weight': 'bold',
                'border': '2px solid',
                'border-color': color
            };
        }
        else {
            return {
                'background-image': 'url(' + this.url + ')',
                'background-size': 'contain',
                'border': '2px solid',
                'border-color': this.backColor
            };
        }
    }
    letterNumber(ch) {
        let pos;
        const dict = [
            'abcdefghijklmnopqrstuvwxyz',
            'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
            'абвгдеёжзийклмнопрстуфхцчшщъыьэюя',
            'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ',
        ];
        for (let i = 0; i < dict.length && (pos = dict[i].indexOf(ch)) < 0; ++i) { }
        return pos + 1;
    }
    getColorString(letter1, letter2) {
        const coef = 7.7;
        const coef2 = 3.4; // 3.6 если возможен белый фон
        const B = this.letterNumber(letter1) % 2 ? this.letterNumber(letter1) * coef : 0;
        const G = !(this.letterNumber(letter2) % 2) && B !== 0
            ? 0
            : this.letterNumber(letter2) * coef;
        const R = (this.letterNumber(letter2) + this.letterNumber(letter1)) * coef2;
        return R + ',' + G + ',' + B;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUserIconComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreUserIconComponent, isStandalone: false, selector: "core-user-icon", inputs: { useInChat: "useInChat", sizeSuffix: "sizeSuffix", url: "url", backColor: "backColor", fullName: "fullName" }, usesInheritance: true, ngImport: i0, template: "<div matTooltip=\"{{ useInChat === true ? fullNameValue : null }}\" matTooltipPosition=\"above\"  >\n\n  <div class=\"sln-user-icon sln-user-icon-{{ useInChat === true ? 'big' : sizeSuffix }}\" [ngStyle]=\"avatarStyle\">\n    @if ((url?.length ?? 0)  === 0 && (requestLitter?.length ?? 0) === 0 ) {\n      <h4 class=\"sln-user-icon-bage sln-user-icon-letteral-{{ useInChat === true ? 'big' : sizeSuffix }}\">{{surnameLetter + nameLetter}}</h4>\n    }\n    @if ((url?.length ?? 0) === 0 && requestLitter?.length > 0) {\n      <small class=\"sln-user-icon-bage sln-user-icon-request\"> {{ requestLitter }}</small>\n    }\n  </div>\n\n</div>\n", styles: [".sln-user-icon{width:100%;height:100%;border-radius:50%;display:flex;justify-content:center}.sln-user-icon.sln-user-icon-small{width:40px;height:40px}.sln-user-icon.sln-user-icon-big{width:60px;height:60px}.sln-user-icon.sln-user-icon-preview{width:100px;height:100px;border:1px solid #abb1c2}.sln-user-icon-bage{color:#fff;text-align:center;letter-spacing:2px;width:100%;margin-top:0;margin-left:auto}.sln-user-icon-bage.sln-user-icon-letteral-small{padding-top:4px;font-size:14px}.sln-user-icon-bage.sln-user-icon-letteral-small:after{content:\"_\";display:flex;margin-top:-26px;margin-left:9px}.sln-user-icon-bage.sln-user-icon-letteral-big{padding-top:16px;font-size:20px}.sln-user-icon-bage.sln-user-icon-letteral-big:after{content:\"_\";display:flex;margin-top:-23px;margin-left:16px}.sln-user-icon-bage.sln-user-icon-letteral-preview{padding-top:30px;font-size:40px}.sln-user-icon-bage.sln-user-icon-letteral-preview:after{content:\"_\";display:flex;margin-top:-27px;margin-left:24px}.sln-user-icon-bage.sln-user-icon-request{padding-top:23px;font-size:12px}\n"], dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUserIconComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-user-icon', standalone: false, template: "<div matTooltip=\"{{ useInChat === true ? fullNameValue : null }}\" matTooltipPosition=\"above\"  >\n\n  <div class=\"sln-user-icon sln-user-icon-{{ useInChat === true ? 'big' : sizeSuffix }}\" [ngStyle]=\"avatarStyle\">\n    @if ((url?.length ?? 0)  === 0 && (requestLitter?.length ?? 0) === 0 ) {\n      <h4 class=\"sln-user-icon-bage sln-user-icon-letteral-{{ useInChat === true ? 'big' : sizeSuffix }}\">{{surnameLetter + nameLetter}}</h4>\n    }\n    @if ((url?.length ?? 0) === 0 && requestLitter?.length > 0) {\n      <small class=\"sln-user-icon-bage sln-user-icon-request\"> {{ requestLitter }}</small>\n    }\n  </div>\n\n</div>\n", styles: [".sln-user-icon{width:100%;height:100%;border-radius:50%;display:flex;justify-content:center}.sln-user-icon.sln-user-icon-small{width:40px;height:40px}.sln-user-icon.sln-user-icon-big{width:60px;height:60px}.sln-user-icon.sln-user-icon-preview{width:100px;height:100px;border:1px solid #abb1c2}.sln-user-icon-bage{color:#fff;text-align:center;letter-spacing:2px;width:100%;margin-top:0;margin-left:auto}.sln-user-icon-bage.sln-user-icon-letteral-small{padding-top:4px;font-size:14px}.sln-user-icon-bage.sln-user-icon-letteral-small:after{content:\"_\";display:flex;margin-top:-26px;margin-left:9px}.sln-user-icon-bage.sln-user-icon-letteral-big{padding-top:16px;font-size:20px}.sln-user-icon-bage.sln-user-icon-letteral-big:after{content:\"_\";display:flex;margin-top:-23px;margin-left:16px}.sln-user-icon-bage.sln-user-icon-letteral-preview{padding-top:30px;font-size:40px}.sln-user-icon-bage.sln-user-icon-letteral-preview:after{content:\"_\";display:flex;margin-top:-27px;margin-left:24px}.sln-user-icon-bage.sln-user-icon-request{padding-top:23px;font-size:12px}\n"] }]
        }], propDecorators: { useInChat: [{
                type: Input
            }], sizeSuffix: [{
                type: Input
            }], url: [{
                type: Input
            }], backColor: [{
                type: Input
            }], fullName: [{
                type: Input
            }] } });

class CoreFieldTypeTextareaComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (!Utility.isEmpty(model)) {
            model = model.trim();
        }
        return model;
    }
    setDefault() {
        super.setDefault();
        if (!this.settings.leftHint) {
            this.settings.leftHint = '';
        }
        if (!this.settings.maxLength) {
            this.settings.maxLength = 1000;
        }
        if (!this.settings.defaultText) {
            this.settings.defaultText = '';
        }
        if (!this.settings.rowCount) {
            this.settings.rowCount = 6;
        }
        if (!this.settings.useMask) {
            this.settings.useMask = false;
        }
        if (!this.settings.maskExpression) {
            this.settings.maskExpression = null;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeTextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTypeTextareaComponent, isStandalone: false, selector: "core-field-textarea", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTypeTextareaComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field  class=\"{{ cmpClass }}\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <textarea matInput [(ngModel)]=\"value\" #control=\"ngModel\" placeholder=\"{{ settings.defaultText }}\" (ngModelChange)=\"onValueChange($event)\" (blur)=\"onUnfocused($event)\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.rows]=\"settings.rowCount > 0 ? settings.rowCount : null\"\n      [attr.maxlength]=\"settings.maxLength > 0 ? settings.maxLength : null\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\">\n    </textarea>\n    @if (settings.leftHint?.length > 0) {\n      <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n    }\n    @if (!disabled && !settings.useMask && !settings.rightHintHide) {\n      <mat-hint align=\"end\">{{ control.value?.length || 0 }} / {{settings.maxLength || 250}}</mat-hint>\n    }\n  </mat-form-field>\n  <div class=\"sln-core-field-string-multi-p-info\">\n    @if (settings.useInformer) {\n      <div>\n        <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n          @if (settings.informerIcon === 'question') {\n            <div class=\"sln-control-question\"></div>\n          }\n          @if (settings.informerIcon === 'alert') {\n            <div class=\"sln-control-mistake\"></div>\n          }\n        </div>\n      </div>\n    }\n    @if (settings.useMask && control.hasError('mask')) {\n      <mat-error>\n        <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n          <div class=\"sln-control-mistake\"></div>\n        </div>\n      </mat-error>\n    }\n  </div>\n</div>\n", styles: [".sln-core-field-string-multi-p-info{position:absolute;right:var(--FIELD-INFO-RIGHT, 10px);top:var(--FIELD-INFO-TOP-TEXTAREA, 19px)}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeTextareaComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-textarea', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTypeTextareaComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field  class=\"{{ cmpClass }}\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <textarea matInput [(ngModel)]=\"value\" #control=\"ngModel\" placeholder=\"{{ settings.defaultText }}\" (ngModelChange)=\"onValueChange($event)\" (blur)=\"onUnfocused($event)\" [required]=\"settings.isRequired\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\" [attr.rows]=\"settings.rowCount > 0 ? settings.rowCount : null\"\n      [attr.maxlength]=\"settings.maxLength > 0 ? settings.maxLength : null\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\">\n    </textarea>\n    @if (settings.leftHint?.length > 0) {\n      <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n    }\n    @if (!disabled && !settings.useMask && !settings.rightHintHide) {\n      <mat-hint align=\"end\">{{ control.value?.length || 0 }} / {{settings.maxLength || 250}}</mat-hint>\n    }\n  </mat-form-field>\n  <div class=\"sln-core-field-string-multi-p-info\">\n    @if (settings.useInformer) {\n      <div>\n        <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n          @if (settings.informerIcon === 'question') {\n            <div class=\"sln-control-question\"></div>\n          }\n          @if (settings.informerIcon === 'alert') {\n            <div class=\"sln-control-mistake\"></div>\n          }\n        </div>\n      </div>\n    }\n    @if (settings.useMask && control.hasError('mask')) {\n      <mat-error>\n        <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n          <div class=\"sln-control-mistake\"></div>\n        </div>\n      </mat-error>\n    }\n  </div>\n</div>\n", styles: [".sln-core-field-string-multi-p-info{position:absolute;right:var(--FIELD-INFO-RIGHT, 10px);top:var(--FIELD-INFO-TOP-TEXTAREA, 19px)}\n"] }]
        }], ctorParameters: () => [] });

class CoreFieldIpComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
        this.withSubnetMask = false;
        if (!!this.withSubnetMask) {
            this.mask = '099.099.099.099/09';
            this.pattern = '(^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)|(([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$)';
        }
        else {
            this.mask = '099.099.099.099';
            this.pattern = '^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$';
        }
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'IP-адрес';
        }
        if (!this.settings) {
            this.settings = { isRequired: false };
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldIpComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldIpComponent, isStandalone: false, selector: "core-field-ip", inputs: { withSubnetMask: "withSubnetMask" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldIpComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\"\n    [placeholder]=\"placeholder\"\n    [required]=\"settings.isRequired\"\n    [readonly]=\"settings.isReadonly ? settings.isReadonly : null\"\n    [disabled]=\"disabled\"\n    [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\"\n    [dropSpecialCharacters]=\"false\"\n    type=\"text\"\n    [mask]=\"\"\n    [pattern]=\"pattern\"/>\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('pattern')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 IPv4\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n\n    <div class=\"mat-hint\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldIpComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-ip', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldIpComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\"\n    [placeholder]=\"placeholder\"\n    [required]=\"settings.isRequired\"\n    [readonly]=\"settings.isReadonly ? settings.isReadonly : null\"\n    [disabled]=\"disabled\"\n    [attr.fieldName]=\"fieldName\"\n    name=\"{{ fieldName }}\"\n    [dropSpecialCharacters]=\"false\"\n    type=\"text\"\n    [mask]=\"\"\n    [pattern]=\"pattern\"/>\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('pattern')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 IPv4\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n\n    <div class=\"mat-hint\">\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint>{{ settings.leftHint }}</mat-hint>\n      }\n    </div>\n  </mat-form-field>\n" }]
        }], ctorParameters: () => [], propDecorators: { withSubnetMask: [{
                type: Input
            }] } });

class CoreFieldTypeTimeComponent extends CoreAbstractAccessorComponent {
    constructor(_cd) {
        super();
        this._cd = _cd;
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
        if (this.settings.minCount) {
            const minDate = DateExtension.addDays(new Date(), this.settings.minCount * -1);
            this.settings.minD = minDate;
        }
        if (this.settings.maxCount) {
            const maxDate = DateExtension.addDays(new Date(), this.settings.maxCount);
            this.settings.maxD = maxDate;
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    setDefault() {
        super.setDefault();
        if (!this.settings.leftHint) {
            this.settings.leftHint = '';
        }
        if (!this.settings.minD) {
            this.settings.minD = null;
        }
        if (!this.settings.maxD) {
            this.settings.maxD = null;
        }
        if (!this.settings.minCount) {
            this.settings.minCount = null;
        }
        if (!this.settings.maxCount) {
            this.settings.maxCount = null;
        }
    }
    dateIsValid(date, model) {
        if (!date || date === ' ') {
            this._dateInput.nativeElement.value = '';
            if (!this.settings?.isRequired) {
                model.control.setErrors(null);
            }
            return;
        }
        model.control.markAsTouched();
        const errors = {};
        let hasErrors = false;
        if (!DateExtension.isValidInput(date, 'hh:mm')) {
            errors['incorrect'] = true;
            hasErrors = true;
        }
        else {
            const parsed = DateExtension.parse(date, 'hh:mm');
            if (this.settings.minD && parsed < this.settings.minD) {
                errors['matDatepickerMin'] = { min: this.settings.minD };
                hasErrors = true;
            }
            if (this.settings.maxD && parsed > this.settings.maxD) {
                errors['matDatepickerMax'] = { max: this.settings.maxD };
                hasErrors = true;
            }
        }
        if (hasErrors) {
            model.control.setErrors(errors);
        }
        else {
            model.control.setErrors(null);
        }
        this.onUnfocused(model);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeTimeComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTypeTimeComponent, isStandalone: false, selector: "core-field-time", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTypeTimeComponent),
                multi: true
            },
            provideNativeDateTimeAdapter(),
            { provide: MAT_TIME_LOCALE, useValue: "ru-RU" }
        ], viewQueries: [{ propertyName: "_dateInput", first: true, predicate: ["dateInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }}\" class=\"sln-datetime\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input class=\"sln-date-input\" matInput #dateInput #control=\"ngModel\" \n      [(ngModel)]=\"value\"\n      [attr.fieldName]=\"fieldName\" \n      placeholder=\"\u0427\u0427:\u041C\u041C\"\n      name=\"{{ fieldName }}\"\n      [required]=\"settings.isRequired\"\n      [readonly]=\"settings.isReadonly ? settings.isReadonly : null\"\n      [min]=\"settings.isRequired || value ? (settings.minD !== null ? settings.minD : null) : null\"\n      [max]=\"settings.isRequired || value ? (settings.maxD !== null ? settings.maxD : null) : null\"\n      [disabled]=\"disabled\" \n\n      dateMask=\"hh:mm\"\n\n      (blur)=\"dateIsValid(dateInput.value, control)\"\n      (ngModelChange)=\"onValueChange($event)\"\n    />\n\n    <!-- \u0421\u0432\u044F\u0437\u043A\u0430 \u0441 mat-timepicker \u0431\u0435\u0437 \u0432\u0442\u043E\u0440\u043E\u0433\u043E CVA \u043D\u0430 \u0432\u0438\u0434\u0438\u043C\u043E\u043C input (dateMask + MatTimepickerInput \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u0443\u044E\u0442) -->\n    <input\n      class=\"sln-timepicker-mat-bridge\"\n      [matTimepicker]=\"timepicker\"\n      [ngModel]=\"value\"\n      (ngModelChange)=\"onValueChange($event)\"\n      [ngModelOptions]=\"{standalone: true}\"\n      [min]=\"settings.isRequired || value ? (settings.minD !== null ? settings.minD : null) : null\"\n      [max]=\"settings.isRequired || value ? (settings.maxD !== null ? settings.maxD : null) : null\"\n      [disabled]=\"disabled\"\n      tabindex=\"-1\"\n      aria-hidden=\"true\"\n    />\n\n    <!-- <input class=\"sln-date-masked-input mat-mdc-form-field-input-control\" #maskedInput placeholder=\"\u0427\u0427:\u041C\u041C\" [ngModelOptions]=\"{standalone: true}\" (focus)=\"onValueChangeMaskInput(dateInput.value)\" [(ngModel)]=\"dateInput.value\" [leadZeroDateTime]=\"true\" (input)=\"dispatch(dateInput)\"\n           [dropSpecialCharacters]=\"false\"\n        [showMaskTyped]=\"false\" mask=\"Hh:m0\" />\n--> \n        <div class=\"mat-hint\">\n          @if (settings.leftHint?.length > 0) {\n            <mat-hint>{{ settings.leftHint }}</mat-hint>\n          }\n        </div>\n      </mat-form-field>\n      <div class=\"sln-core-field-datetime-p-info\">\n        <div class=\"sln-core-field-datetime-d-toggle\">\n          <button\n            type=\"button\"\n            class=\"sln-calendar-toggle-btn\"\n            [disabled]=\"disabled || (settings.isReadonly ? settings.isReadonly : false)\"\n            (click)=\"$event.stopPropagation(); timepicker.open()\"\n            aria-label=\"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0440\u0435\u043C\u044F\"\n          >\n            <div class=\"sln-control-time\" aria-hidden=\"true\"></div>\n          </button>\n          <mat-timepicker #timepicker format=\"24h\"></mat-timepicker>\n        </div>\n        <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"   class=\"sln-info-informers\">\n          @if (settings.useInformer && settings.informerIcon === 'question') {\n            <div class=\"sln-control-question\"></div>\n          }\n          @if (settings.useInformer && settings.informerIcon === 'alert') {\n            <div class=\"sln-control-mistake\"></div>\n          }\n        </div>\n        @if (control.hasError('incorrect')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u0443\u044E \u0434\u0430\u0442\u0443\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (settings.maxD !== null && control.hasError('matDatepickerMax')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u0414\u0430\u0442\u0430 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 {{ control.errors['matDatepickerMax']?.max | dateRu }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (settings.minD !== null && control.hasError('matDatepickerMin')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u0414\u0430\u0442\u0430 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u043C\u0435\u043D\u044C\u0448\u0435 {{ control.errors['matDatepickerMin']?.min | dateRu }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>", styles: ["@charset \"UTF-8\";.sln-date-input{background:transparent!important}input.sln-timepicker-mat-bridge{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;width:1px;margin:0;padding:0;overflow:hidden;position:absolute;white-space:nowrap;border:0;opacity:0;pointer-events:none}.sln-core-field-datetime-d-toggle{position:relative;display:flex;align-items:center;margin-left:5px}.sln-calendar-toggle-btn{border:none;background:transparent;padding:0;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:#0000008a}.sln-calendar-toggle-btn:disabled{cursor:default;opacity:.4}.sln-calendar-panel{display:none;position:fixed;z-index:5000;width:296px;height:354px;background:#fff;border:1px solid rgba(0,0,0,.12);border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.sln-calendar-panel.sln-calendar-panel--open{display:block}.sln-calendar-panel mat-calendar{display:block;width:296px;height:354px}.sln-field-layout{position:relative}.sln-core-field-datetime-p-info{display:flex;align-items:center;flex-direction:row-reverse;position:absolute;top:var(--FIELD-INFO-TOP-DATETIME, 18px);right:var(--FIELD-INFO-RIGHT, 7px)}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: MatTimepicker, selector: "mat-timepicker", exportAs: ["matTimepicker"] }, { kind: "directive", type: MatTimepickerInput, selector: "input[matTimepicker]", inputs: ["matTimepicker", "min", "max"], exportAs: ["matTimepickerInput"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: DigitMaxDirective, selector: "[max]", inputs: ["max"] }, { kind: "directive", type: DigitMinDirective, selector: "[min]", inputs: ["min"] }, { kind: "directive", type: DateMaskDirective, selector: "input[dateMask]", inputs: ["dateMask"] }, { kind: "pipe", type: RuDatePipe, name: "dateRu" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTypeTimeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-time', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTypeTimeComponent),
                            multi: true
                        },
                        provideNativeDateTimeAdapter(),
                        { provide: MAT_TIME_LOCALE, useValue: "ru-RU" }
                    ], standalone: false, template: "<div provideParentForm class=\"sln-field-layout\">\n  <mat-form-field class=\"{{ cmpClass }}\" class=\"sln-datetime\" [hideRequiredMarker]=\"hideRequiredMarker\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input class=\"sln-date-input\" matInput #dateInput #control=\"ngModel\" \n      [(ngModel)]=\"value\"\n      [attr.fieldName]=\"fieldName\" \n      placeholder=\"\u0427\u0427:\u041C\u041C\"\n      name=\"{{ fieldName }}\"\n      [required]=\"settings.isRequired\"\n      [readonly]=\"settings.isReadonly ? settings.isReadonly : null\"\n      [min]=\"settings.isRequired || value ? (settings.minD !== null ? settings.minD : null) : null\"\n      [max]=\"settings.isRequired || value ? (settings.maxD !== null ? settings.maxD : null) : null\"\n      [disabled]=\"disabled\" \n\n      dateMask=\"hh:mm\"\n\n      (blur)=\"dateIsValid(dateInput.value, control)\"\n      (ngModelChange)=\"onValueChange($event)\"\n    />\n\n    <!-- \u0421\u0432\u044F\u0437\u043A\u0430 \u0441 mat-timepicker \u0431\u0435\u0437 \u0432\u0442\u043E\u0440\u043E\u0433\u043E CVA \u043D\u0430 \u0432\u0438\u0434\u0438\u043C\u043E\u043C input (dateMask + MatTimepickerInput \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u0443\u044E\u0442) -->\n    <input\n      class=\"sln-timepicker-mat-bridge\"\n      [matTimepicker]=\"timepicker\"\n      [ngModel]=\"value\"\n      (ngModelChange)=\"onValueChange($event)\"\n      [ngModelOptions]=\"{standalone: true}\"\n      [min]=\"settings.isRequired || value ? (settings.minD !== null ? settings.minD : null) : null\"\n      [max]=\"settings.isRequired || value ? (settings.maxD !== null ? settings.maxD : null) : null\"\n      [disabled]=\"disabled\"\n      tabindex=\"-1\"\n      aria-hidden=\"true\"\n    />\n\n    <!-- <input class=\"sln-date-masked-input mat-mdc-form-field-input-control\" #maskedInput placeholder=\"\u0427\u0427:\u041C\u041C\" [ngModelOptions]=\"{standalone: true}\" (focus)=\"onValueChangeMaskInput(dateInput.value)\" [(ngModel)]=\"dateInput.value\" [leadZeroDateTime]=\"true\" (input)=\"dispatch(dateInput)\"\n           [dropSpecialCharacters]=\"false\"\n        [showMaskTyped]=\"false\" mask=\"Hh:m0\" />\n--> \n        <div class=\"mat-hint\">\n          @if (settings.leftHint?.length > 0) {\n            <mat-hint>{{ settings.leftHint }}</mat-hint>\n          }\n        </div>\n      </mat-form-field>\n      <div class=\"sln-core-field-datetime-p-info\">\n        <div class=\"sln-core-field-datetime-d-toggle\">\n          <button\n            type=\"button\"\n            class=\"sln-calendar-toggle-btn\"\n            [disabled]=\"disabled || (settings.isReadonly ? settings.isReadonly : false)\"\n            (click)=\"$event.stopPropagation(); timepicker.open()\"\n            aria-label=\"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0440\u0435\u043C\u044F\"\n          >\n            <div class=\"sln-control-time\" aria-hidden=\"true\"></div>\n          </button>\n          <mat-timepicker #timepicker format=\"24h\"></mat-timepicker>\n        </div>\n        <div matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"   class=\"sln-info-informers\">\n          @if (settings.useInformer && settings.informerIcon === 'question') {\n            <div class=\"sln-control-question\"></div>\n          }\n          @if (settings.useInformer && settings.informerIcon === 'alert') {\n            <div class=\"sln-control-mistake\"></div>\n          }\n        </div>\n        @if (control.hasError('incorrect')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u0443\u044E \u0434\u0430\u0442\u0443\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (settings.maxD !== null && control.hasError('matDatepickerMax')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u0414\u0430\u0442\u0430 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0431\u043E\u043B\u044C\u0448\u0435 {{ control.errors['matDatepickerMax']?.max | dateRu }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (settings.minD !== null && control.hasError('matDatepickerMin')) {\n          <mat-error class=\"sln-datepicker-err\">\n            <div matTooltip=\"\u0414\u0430\u0442\u0430 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u043C\u0435\u043D\u044C\u0448\u0435 {{ control.errors['matDatepickerMin']?.min | dateRu }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>", styles: ["@charset \"UTF-8\";.sln-date-input{background:transparent!important}input.sln-timepicker-mat-bridge{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;width:1px;margin:0;padding:0;overflow:hidden;position:absolute;white-space:nowrap;border:0;opacity:0;pointer-events:none}.sln-core-field-datetime-d-toggle{position:relative;display:flex;align-items:center;margin-left:5px}.sln-calendar-toggle-btn{border:none;background:transparent;padding:0;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:#0000008a}.sln-calendar-toggle-btn:disabled{cursor:default;opacity:.4}.sln-calendar-panel{display:none;position:fixed;z-index:5000;width:296px;height:354px;background:#fff;border:1px solid rgba(0,0,0,.12);border-radius:4px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.sln-calendar-panel.sln-calendar-panel--open{display:block}.sln-calendar-panel mat-calendar{display:block;width:296px;height:354px}.sln-field-layout{position:relative}.sln-core-field-datetime-p-info{display:flex;align-items:center;flex-direction:row-reverse;position:absolute;top:var(--FIELD-INFO-TOP-DATETIME, 18px);right:var(--FIELD-INFO-RIGHT, 7px)}\n"] }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { _dateInput: [{
                type: ViewChild,
                args: ['dateInput']
            }] } });

class CoreFieldColorComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'Цвет';
        }
        if (!this.settings) {
            this.settings = { isRequired: false, maxLength: 8 };
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    insertColor(val) {
        this.value = val;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldColorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldColorComponent, isStandalone: false, selector: "core-field-color", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldColorComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-field-color-block\">\n  <mat-form-field provideParentForm>\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"true\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n      name=\"{{ fieldName }}\" />\n      <div class=\"sln-informer-icongroup\">\n        @if (settings.useInformer) {\n          <div class=\"sln-informer\">\n            <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-question  \"></div>\n            </div>\n          </div>\n        }\n        <div class=\"sln-position-informer\">\n          @if (control.hasError('pattern') || control.hasError('inn')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n        </div>\n      </div>\n      <div class=\"mat-hint\">\n        @if (settings.leftHint?.length > 0) {\n          <mat-hint>{{ settings.leftHint }}</mat-hint>\n        }\n      </div>\n    </mat-form-field>\n    <button matTooltip=\"\u0417\u0430\u0434\u0430\u0442\u044C \u0446\u0432\u0435\u0442\" class=\"sln-add-button\" (click)=\"fgInput.click()\">\n      <span class=\"sln-add-plus sln-add-plus-position\"></span>\n    </button>\n    <input class=\"sln-field-color-block-input\" name=\"hidden-blockTitleBackgroundColor\" type=\"color\" (change)=\"insertColor(fgInput.value)\" #fgInput>\n  </div>\n\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldColorComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-color', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldColorComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<div class=\"sln-field-color-block\">\n  <mat-form-field provideParentForm>\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [readonly]=\"true\" [disabled]=\"disabled\" [attr.fieldName]=\"fieldName\"\n      name=\"{{ fieldName }}\" />\n      <div class=\"sln-informer-icongroup\">\n        @if (settings.useInformer) {\n          <div class=\"sln-informer\">\n            <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-question  \"></div>\n            </div>\n          </div>\n        }\n        <div class=\"sln-position-informer\">\n          @if (control.hasError('pattern') || control.hasError('inn')) {\n            <mat-error matSuffix>\n              <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n        </div>\n      </div>\n      <div class=\"mat-hint\">\n        @if (settings.leftHint?.length > 0) {\n          <mat-hint>{{ settings.leftHint }}</mat-hint>\n        }\n      </div>\n    </mat-form-field>\n    <button matTooltip=\"\u0417\u0430\u0434\u0430\u0442\u044C \u0446\u0432\u0435\u0442\" class=\"sln-add-button\" (click)=\"fgInput.click()\">\n      <span class=\"sln-add-plus sln-add-plus-position\"></span>\n    </button>\n    <input class=\"sln-field-color-block-input\" name=\"hidden-blockTitleBackgroundColor\" type=\"color\" (change)=\"insertColor(fgInput.value)\" #fgInput>\n  </div>\n\n" }]
        }], ctorParameters: () => [] });

class CustomDatepickerIntl extends MatDatepickerIntl {
    constructor() {
        super();
        this.calendarLabel = 'Календарь';
        this.openCalendarLabel = 'Открыть календарь';
        this.prevMonthLabel = 'Предыдущий месяц';
        this.nextMonthLabel = 'Следующий месяц';
        this.prevYearLabel = 'Предыдущий год';
        this.nextYearLabel = 'Следующий год';
        this.switchToMonthViewLabel = 'Выбрать месяц';
        this.switchToMultiYearViewLabel = 'Выбрать год';
        this.changes.next();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CustomDatepickerIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CustomDatepickerIntl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CustomDatepickerIntl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class CoreControlModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreControlModule, declarations: [CoreSelectSearchComponent,
            ExternalRedirectComponent,
            CoreFieldTypeBoolComponent,
            CoreFieldTypeComboboxComponent,
            CoreFieldTypeMultipleComboboxComponent,
            CoreFieldTypeDateTimeComponent,
            CoreFieldTypeTimeComponent,
            CoreFieldTypeNumberComponent,
            CoreFieldTypeStringComponent,
            CoreFieldTypeTextareaComponent,
            CoreUserIconComponent,
            // //TODO refact
            CoreFieldInnComponent,
            CoreFieldKppComponent,
            CoreFieldOgrnComponent,
            CoreFieldPasswordComponent,
            CoreFieldSnilsComponent,
            CoreFieldColorComponent,
            CoreLabelComponent,
            CardPanelComponent,
            CardEditButtonsComponent,
            CoreFieldIpComponent,
            DateMaskDirective], imports: [CoreMatModule,
            CoreBaseModule,
            CorePipeModule,
            CoreDirectiveModule,
            NgxMaskDirective,
            NgxMaskPipe], exports: [CoreUserIconComponent,
            CoreSelectSearchComponent,
            ExternalRedirectComponent,
            CoreFieldTypeBoolComponent,
            CoreFieldTypeComboboxComponent,
            CoreFieldTypeDateTimeComponent,
            CoreFieldTypeTimeComponent,
            CoreFieldTypeNumberComponent,
            CoreFieldTypeStringComponent,
            CoreFieldTypeTextareaComponent,
            CoreFieldTypeMultipleComboboxComponent,
            CoreFieldInnComponent,
            CoreFieldKppComponent,
            CoreFieldOgrnComponent,
            CoreFieldPasswordComponent,
            CoreFieldSnilsComponent,
            CoreFieldColorComponent,
            CoreLabelComponent,
            CardPanelComponent,
            CardEditButtonsComponent,
            CoreFieldIpComponent,
            DateMaskDirective] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreControlModule, providers: [
            FilterCmbxPipe,
            provideNgxMask({
                decimalMarker: ','
            }),
            { provide: MatDatepickerIntl, useClass: CustomDatepickerIntl },
        ], imports: [CoreMatModule,
            CoreBaseModule,
            CorePipeModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreControlModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreSelectSearchComponent,
                        ExternalRedirectComponent,
                        CoreFieldTypeBoolComponent,
                        CoreFieldTypeComboboxComponent,
                        CoreFieldTypeMultipleComboboxComponent,
                        CoreFieldTypeDateTimeComponent,
                        CoreFieldTypeTimeComponent,
                        CoreFieldTypeNumberComponent,
                        CoreFieldTypeStringComponent,
                        CoreFieldTypeTextareaComponent,
                        CoreUserIconComponent,
                        // //TODO refact
                        CoreFieldInnComponent,
                        CoreFieldKppComponent,
                        CoreFieldOgrnComponent,
                        CoreFieldPasswordComponent,
                        CoreFieldSnilsComponent,
                        CoreFieldColorComponent,
                        CoreLabelComponent,
                        CardPanelComponent,
                        CardEditButtonsComponent,
                        CoreFieldIpComponent,
                        DateMaskDirective
                    ],
                    imports: [
                        CoreMatModule,
                        CoreBaseModule,
                        CorePipeModule,
                        CoreDirectiveModule,
                        NgxMaskDirective,
                        NgxMaskPipe
                    ],
                    providers: [
                        FilterCmbxPipe,
                        provideNgxMask({
                            decimalMarker: ','
                        }),
                        { provide: MatDatepickerIntl, useClass: CustomDatepickerIntl },
                    ],
                    exports: [
                        CoreUserIconComponent,
                        CoreSelectSearchComponent,
                        ExternalRedirectComponent,
                        CoreFieldTypeBoolComponent,
                        CoreFieldTypeComboboxComponent,
                        CoreFieldTypeDateTimeComponent,
                        CoreFieldTypeTimeComponent,
                        CoreFieldTypeNumberComponent,
                        CoreFieldTypeStringComponent,
                        CoreFieldTypeTextareaComponent,
                        CoreFieldTypeMultipleComboboxComponent,
                        CoreFieldInnComponent,
                        CoreFieldKppComponent,
                        CoreFieldOgrnComponent,
                        CoreFieldPasswordComponent,
                        CoreFieldSnilsComponent,
                        CoreFieldColorComponent,
                        CoreLabelComponent,
                        CardPanelComponent,
                        CardEditButtonsComponent,
                        CoreFieldIpComponent,
                        DateMaskDirective
                    ]
                }]
        }] });

class TopicRequest {
    constructor(topic, data) {
        this.topic = topic;
        this.data = data;
    }
}
class TopicSubject {
    constructor(topic) {
        this.topic = topic;
        this.data = new Subject();
    }
}
class DefaultQueueService {
    constructor() {
        this._subjects = new Array();
    }
    subscribeForTopic(topic) {
        const exists = this._subjects.find(q => q.topic === topic);
        if (!exists) {
            this._subjects.push(new TopicSubject(topic));
        }
        return this.get(topic);
    }
    notify(request, delayMs = 0) {
        if (delayMs) {
            const self = this;
            setTimeout(function () { self._subjects.find(q => q.topic === request.topic).data.next(request.data); }, delayMs);
        }
        else {
            this._subjects.find(q => q.topic === request.topic).data.next(request.data);
        }
    }
    clean(topic) {
        this._subjects.find(q => q.topic === topic).data.next(null);
    }
    get(topic) {
        return this._subjects.find(q => q.topic === topic).data.asObservable();
    }
}

const CORE_NOTIFICATION_DATA_TOKEN = new InjectionToken('CORE_NOTIFICATION_DATA_TOKEN_KEY');
/** конфигурация по умолчанию контейнера сообщения */
const CoreNotificationBaseOverlayConfig = {
    hasBackdrop: false,
    backdropClass: 'Core-notification-backdor',
    panelClass: 'Core-notification-overlay',
};
const CoreNotificationUIConfig = {
    success: 'Успешно',
    warning: 'Предупреждение',
    info: 'Уведомление',
    error: 'Ошибка'
};

class CoreNotificationQueueService extends DefaultQueueService {
    static { this.Topics = {
        INIT: 'CORE_NOTIFICATION_INIT',
        CLOSE: 'CORE_NOTIFICATION_CLOSE',
    }; }
    constructor() {
        super();
        this._subjects.push(new TopicSubject(CoreNotificationQueueService.Topics.INIT));
        this._subjects.push(new TopicSubject(CoreNotificationQueueService.Topics.CLOSE));
    }
    getServiceId() {
        return 'SELLAN_CORE_NOTIFICATION_QUEUE_SERVICE';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationQueueService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationQueueService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationQueueService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [] });

class СoreNotificationComponent extends CoreAbstractComponent {
    constructor(data, _queueService) {
        super();
        this.data = data;
        this._queueService = _queueService;
        this.settings = {};
        this.timerIsBlocked = false;
    }
    ngOnInit() {
        requestAnimationFrame(() => requestAnimationFrame(() => this.settings.visible = true));
        this._queueService.notify(new TopicRequest(CoreNotificationQueueService.Topics.INIT, this.data.overlayRef));
        this.startCloseTimer();
    }
    timerBlock(block) {
        this.timerIsBlocked = block;
        if (this.timerIsBlocked) {
            clearTimeout(this.timer);
        }
        else {
            this.startCloseTimer();
        }
    }
    startCloseTimer() {
        const timerTime = 10000; // = moveWidth в scss
        this.timer = setTimeout(() => {
            if (!this.timerIsBlocked) {
                this.onCloseClick();
            }
        }, timerTime);
    }
    onCloseClick() {
        this.settings.closing = true;
        this.settings.visible = false;
    }
    getSubject() {
        if (!!this.data.message.subject) {
            return this.data.message.subject;
        }
        return CoreNotificationUIConfig[this.data.type];
    }
    onTransitionEnd($event) {
        if (this.settings.closing === true) {
            this._queueService.notify(new TopicRequest(CoreNotificationQueueService.Topics.CLOSE, this.data.overlayRef));
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: СoreNotificationComponent, deps: [{ token: CORE_NOTIFICATION_DATA_TOKEN }, { token: CoreNotificationQueueService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: СoreNotificationComponent, isStandalone: false, selector: "core-notification", usesInheritance: true, ngImport: i0, template: "<div class=\"core-notification\" \n  [attr.tid]=\"data.type === 'success' ? 'notification_success' : data.type === 'error' ? 'notification_error' : null\"\n  (mouseover)=\"timerBlock(true)\" \n  (mouseout)=\"timerBlock(false)\" \n  [ngClass]=\"{\n      'core-notification-visible': settings.visible,\n      'core-notification-closing': settings.closing,\n      'core-notification_error': data.type === 'error',\n      'core-notification_warning': data.type === 'warning',\n      'core-notification_info': data.type === 'info',\n      'core-notification_success': data.type === 'success'\n    }\" \n    (transitionend)=\"onTransitionEnd($event)\">\n  <div class=\"core-notification__content\">\n    <div class=\"head_notification\">\n      <div class=\"core-notification__subject\">\n        <p [ngClass]=\"{'error': data.type === 'error', 'info': data.type === 'info', 'warning' : data.type === 'warning', 'success' : data.type === 'success'}\">{{ getSubject() }}</p>\n      </div>\n      <div class=\"core-notification__btn\" [ngClass]=\"{ 'core-notification__btn_error': data.type === 'error', 'core-notification__btn_warning': data.type === 'warning', 'core-notification__btn_success': data.type === 'success', 'core-notification__btn_info': data.type === 'info' }\">\n        <div (click)=\"onCloseClick()\" class=\"sln-common-cross-table\" alt=\"\u0417\u0430\u043A\u0440\u044B\u0442\u044C\"></div>\n      </div>\n    </div>\n    <div class=\"body-notification\" [ngClass]=\"{'boder-error': data.type === 'error', 'boder-info': data.type === 'info', 'boder-warning' : data.type === 'warning', 'boder-success' : data.type === 'success'}\">\n      <div class=\"core-notification__icon\">\n        @if (data.type === 'warning') {\n          <div class=\"sln-notificate-warn sln-notificate-position\"></div>\n        }\n        @if (data.type === 'error') {\n          <div class=\"sln-notificate-err sln-notificate-position\"></div>\n        }\n        @if (data.type === 'success') {\n          <div class=\"sln-notificate-ok sln-notificate-position\"></div>\n        }\n        @if (data.type === 'info') {\n          <div class=\"sln-notificate-info sln-notificate-position\"></div>\n        }\n      </div>\n      <div class=\"core-notification__text\">\n        @if (data.message?.useHtml) {\n          <div style=\"margin-left:20px;\" [innerHTML]=\"data.message?.text\"></div>\n        } @else {\n          <span>{{ data.message?.text }}</span>\n        }\n      </div>\n    </div>\n  </div>\n</div>\n@if (!settings.closing) {\n  <div [ngClass]=\"{\n      'core-notification__timer_line_animation': !timerIsBlocked, \n      'core-notification__timer_line': timerIsBlocked,\n      'line-error': data.type === 'error',\n      'line-warning': data.type === 'warning',\n      'line-success': data.type === 'success',\n      'line-info': data.type === 'info'\n      }\">\n  </div>\n}\n", styles: [".core-notification__timer_line{height:10px;width:95.4%;position:relative;top:-15.3px;border-radius:5px}.core-notification__timer_line_animation{height:10px;width:95.4%;position:relative;top:-15.3px;border-radius:5px;-webkit-animation:moveWidth 10s;animation:moveWidth 10s}@-webkit-keyframes moveWidth{to{width:1px;display:none}}@keyframes moveWidth{to{width:1px;display:none}}.core-notification__text{width:375px;padding-left:15px;display:block}.core-notification{box-sizing:border-box;transition:all .2s;width:560px;padding:5px 0 15px;border-radius:5px;box-shadow:0 0 4px #00000024,0 4px 8px #00000047;font-size:14px;color:#000;margin-right:20px;margin-bottom:5px;position:relative}.core-notification_error,.core-notification_warning,.core-notification_success,.core-notification_info{background-color:#fff}.core-notification__content{width:100%}.core-notification__subject{margin-bottom:6px;margin-top:6px;width:100%;word-wrap:break-word;display:flex;justify-content:space-between}.core-notification__subject p{font-size:17px;letter-spacing:.01em;text-transform:uppercase;font-family:var(--font-medium)}.core-notification__text{width:100%;word-wrap:break-word;letter-spacing:.01em;color:var(--MIDLE-GRAY);white-space:pre-line}.core-notification__btn{cursor:pointer}.core-notification-visible{opacity:1}.core-notification-closing{transform:translate(560px)}.head_notification{padding:0 15px 0 40px;display:flex;align-items:center}.body-notification{background:#fff7ef;padding:5px 40px;display:flex;align-items:center;position:relative}.error{color:var(--DANGER)}.warning{color:var(--WARNING)}.success{color:var(--SUCCESS)}.line-error{background-color:var(--DANGER)}.line-warning{background-color:var(--WARNING)}.line-success{background-color:var(--SUCCESS)}.boder-warning:before{content:\"\";border-left:4px solid var(--WARNING);position:absolute;left:-2px;top:0%;height:100%;border-radius:5px 0 0 5px}.boder-warning:after{content:\"\";border-right:4px solid var(--WARNING);position:absolute;right:-3px;top:0%;height:100%;border-radius:0 5px 5px 0}.boder-success:before{content:\"\";border-left:4px solid var(--SUCCESS);position:absolute;left:-2px;top:0%;height:100%;border-radius:5px 0 0 5px}.boder-success:after{content:\"\";border-right:4px solid var(--SUCCESS);position:absolute;right:-3px;top:0%;height:100%;border-radius:0 5px 5px 0}.boder-error:before{content:\"\";border-left:4px solid var(--DANGER);position:absolute;left:-2px;top:0%;height:100%;border-radius:5px 0 0 5px}.boder-error:after{content:\"\";border-right:4px solid var(--DANGER);position:absolute;right:-3px;top:0%;height:100%;border-radius:0 5px 5px 0}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: СoreNotificationComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-notification', standalone: false, template: "<div class=\"core-notification\" \n  [attr.tid]=\"data.type === 'success' ? 'notification_success' : data.type === 'error' ? 'notification_error' : null\"\n  (mouseover)=\"timerBlock(true)\" \n  (mouseout)=\"timerBlock(false)\" \n  [ngClass]=\"{\n      'core-notification-visible': settings.visible,\n      'core-notification-closing': settings.closing,\n      'core-notification_error': data.type === 'error',\n      'core-notification_warning': data.type === 'warning',\n      'core-notification_info': data.type === 'info',\n      'core-notification_success': data.type === 'success'\n    }\" \n    (transitionend)=\"onTransitionEnd($event)\">\n  <div class=\"core-notification__content\">\n    <div class=\"head_notification\">\n      <div class=\"core-notification__subject\">\n        <p [ngClass]=\"{'error': data.type === 'error', 'info': data.type === 'info', 'warning' : data.type === 'warning', 'success' : data.type === 'success'}\">{{ getSubject() }}</p>\n      </div>\n      <div class=\"core-notification__btn\" [ngClass]=\"{ 'core-notification__btn_error': data.type === 'error', 'core-notification__btn_warning': data.type === 'warning', 'core-notification__btn_success': data.type === 'success', 'core-notification__btn_info': data.type === 'info' }\">\n        <div (click)=\"onCloseClick()\" class=\"sln-common-cross-table\" alt=\"\u0417\u0430\u043A\u0440\u044B\u0442\u044C\"></div>\n      </div>\n    </div>\n    <div class=\"body-notification\" [ngClass]=\"{'boder-error': data.type === 'error', 'boder-info': data.type === 'info', 'boder-warning' : data.type === 'warning', 'boder-success' : data.type === 'success'}\">\n      <div class=\"core-notification__icon\">\n        @if (data.type === 'warning') {\n          <div class=\"sln-notificate-warn sln-notificate-position\"></div>\n        }\n        @if (data.type === 'error') {\n          <div class=\"sln-notificate-err sln-notificate-position\"></div>\n        }\n        @if (data.type === 'success') {\n          <div class=\"sln-notificate-ok sln-notificate-position\"></div>\n        }\n        @if (data.type === 'info') {\n          <div class=\"sln-notificate-info sln-notificate-position\"></div>\n        }\n      </div>\n      <div class=\"core-notification__text\">\n        @if (data.message?.useHtml) {\n          <div style=\"margin-left:20px;\" [innerHTML]=\"data.message?.text\"></div>\n        } @else {\n          <span>{{ data.message?.text }}</span>\n        }\n      </div>\n    </div>\n  </div>\n</div>\n@if (!settings.closing) {\n  <div [ngClass]=\"{\n      'core-notification__timer_line_animation': !timerIsBlocked, \n      'core-notification__timer_line': timerIsBlocked,\n      'line-error': data.type === 'error',\n      'line-warning': data.type === 'warning',\n      'line-success': data.type === 'success',\n      'line-info': data.type === 'info'\n      }\">\n  </div>\n}\n", styles: [".core-notification__timer_line{height:10px;width:95.4%;position:relative;top:-15.3px;border-radius:5px}.core-notification__timer_line_animation{height:10px;width:95.4%;position:relative;top:-15.3px;border-radius:5px;-webkit-animation:moveWidth 10s;animation:moveWidth 10s}@-webkit-keyframes moveWidth{to{width:1px;display:none}}@keyframes moveWidth{to{width:1px;display:none}}.core-notification__text{width:375px;padding-left:15px;display:block}.core-notification{box-sizing:border-box;transition:all .2s;width:560px;padding:5px 0 15px;border-radius:5px;box-shadow:0 0 4px #00000024,0 4px 8px #00000047;font-size:14px;color:#000;margin-right:20px;margin-bottom:5px;position:relative}.core-notification_error,.core-notification_warning,.core-notification_success,.core-notification_info{background-color:#fff}.core-notification__content{width:100%}.core-notification__subject{margin-bottom:6px;margin-top:6px;width:100%;word-wrap:break-word;display:flex;justify-content:space-between}.core-notification__subject p{font-size:17px;letter-spacing:.01em;text-transform:uppercase;font-family:var(--font-medium)}.core-notification__text{width:100%;word-wrap:break-word;letter-spacing:.01em;color:var(--MIDLE-GRAY);white-space:pre-line}.core-notification__btn{cursor:pointer}.core-notification-visible{opacity:1}.core-notification-closing{transform:translate(560px)}.head_notification{padding:0 15px 0 40px;display:flex;align-items:center}.body-notification{background:#fff7ef;padding:5px 40px;display:flex;align-items:center;position:relative}.error{color:var(--DANGER)}.warning{color:var(--WARNING)}.success{color:var(--SUCCESS)}.line-error{background-color:var(--DANGER)}.line-warning{background-color:var(--WARNING)}.line-success{background-color:var(--SUCCESS)}.boder-warning:before{content:\"\";border-left:4px solid var(--WARNING);position:absolute;left:-2px;top:0%;height:100%;border-radius:5px 0 0 5px}.boder-warning:after{content:\"\";border-right:4px solid var(--WARNING);position:absolute;right:-3px;top:0%;height:100%;border-radius:0 5px 5px 0}.boder-success:before{content:\"\";border-left:4px solid var(--SUCCESS);position:absolute;left:-2px;top:0%;height:100%;border-radius:5px 0 0 5px}.boder-success:after{content:\"\";border-right:4px solid var(--SUCCESS);position:absolute;right:-3px;top:0%;height:100%;border-radius:0 5px 5px 0}.boder-error:before{content:\"\";border-left:4px solid var(--DANGER);position:absolute;left:-2px;top:0%;height:100%;border-radius:5px 0 0 5px}.boder-error:after{content:\"\";border-right:4px solid var(--DANGER);position:absolute;right:-3px;top:0%;height:100%;border-radius:0 5px 5px 0}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [CORE_NOTIFICATION_DATA_TOKEN]
                }] }, { type: CoreNotificationQueueService }] });

var NotificationInfoType;
(function (NotificationInfoType) {
    NotificationInfoType["Success"] = "success";
    NotificationInfoType["Warning"] = "warning";
    NotificationInfoType["Info"] = "info";
    NotificationInfoType["Error"] = "error";
})(NotificationInfoType || (NotificationInfoType = {}));

class CoreNotificationService {
    constructor(_overlay, _parentInjector, _queueService, _appRef) {
        this._overlay = _overlay;
        this._parentInjector = _parentInjector;
        this._queueService = _queueService;
        this._appRef = _appRef;
        /**
         * Сопоставление "токена" из очереди (передаётся как overlayRef в данных компонента)
         * и реально созданного компонента.
         */
        this._notificationEntries = [];
        this._overlayConfig = CoreNotificationBaseOverlayConfig;
        this._queueService
            .subscribeForTopic(CoreNotificationQueueService.Topics.INIT)
            .subscribe(() => {
            // Позиционирование/стек теперь делает контейнер (flex-column),
            // так что пересчёт координат не требуется.
        });
        this._queueService
            .subscribeForTopic(CoreNotificationQueueService.Topics.CLOSE)
            .subscribe((ref) => this._close(ref));
    }
    _ensureContainer() {
        if (this._containerOverlayRef) {
            return;
        }
        // Позиционируем один раз в правом нижнем углу.
        this._overlayConfig.positionStrategy = this._overlay
            .position()
            .global()
            .right()
            .bottom('0px');
        this._containerOverlayRef = this._overlay.create(this._overlayConfig);
        // На практике у некоторых сборок/тем стили overlay-панели могут переопределяться,
        // из-за чего элемент оказывается в top-left. Принудительно фиксируем позицию.
        const overlayEl = this._containerOverlayRef.overlayElement;
        overlayEl.style.position = 'fixed';
        overlayEl.style.right = '0px';
        overlayEl.style.bottom = '0px';
        overlayEl.style.left = 'auto';
        overlayEl.style.top = 'auto';
        overlayEl.style.margin = '0';
        const doc = this._containerOverlayRef.overlayElement.ownerDocument;
        const container = doc.createElement('div');
        // Надёжный стек уведомлений без сложных пересчётов высот.
        container.style.display = 'flex';
        container.style.flexDirection = 'column';
        container.style.alignItems = 'flex-end';
        container.style.pointerEvents = 'auto';
        this._containerOverlayRef.overlayElement.appendChild(container);
        this._containerElement = container;
    }
    _show(message, type) {
        const notificationData = {
            message: message,
            type: type,
        };
        this._ensureContainer();
        // Компонент уведомления использует overlayRef только как идентификатор,
        // который отправляется в очередь на CLOSE. Реальный OverlayRef нам не нужен.
        const overlayRefToken = {};
        notificationData.overlayRef = overlayRefToken;
        const options = {
            providers: [{ provide: CORE_NOTIFICATION_DATA_TOKEN, useValue: notificationData }],
            parent: this._parentInjector
        };
        const injector = Injector.create(options);
        // Важно: убираем overlayRef.attach(ComponentPortal(...)) полностью.
        // Ошибка "Attempting to attach an unknown Portal type" появляется из-за несовпадения экземпляров CDK Portal
        // (часто в монорепах/микрофронтендах). Создаем компонент динамически и добавляем его в overlay DOM напрямую.
        const hostElement = this._containerElement?.ownerDocument.createElement('div');
        if (!hostElement || !this._containerElement) {
            return;
        }
        this._containerElement.appendChild(hostElement);
        const componentRef = createComponent(СoreNotificationComponent, {
            environmentInjector: this._appRef.injector,
            hostElement,
            elementInjector: injector
        });
        this._appRef.attachView(componentRef.hostView);
        // Прогоняем первую CD-итерацию, чтобы ngOnInit с таймером успел стартовать
        componentRef.changeDetectorRef.detectChanges();
        this._notificationEntries.push({ overlayRefToken, componentRef });
    }
    _close(ref) {
        const entry = this._notificationEntries.find(e => e.overlayRefToken === ref);
        if (entry) {
            // Сначала отсоединяем view из ApplicationRef, потом уничтожаем компонент
            this._appRef.detachView(entry.componentRef.hostView);
            const hostEl = entry.componentRef.location.nativeElement;
            entry.componentRef.destroy();
            hostEl?.remove();
            this._notificationEntries = this._notificationEntries.filter(e => e.overlayRefToken !== ref);
        }
        // Если больше нет уведомлений — можно освободить контейнер.
        if (!this._notificationEntries.length) {
            this._containerOverlayRef?.dispose();
            this._containerOverlayRef = undefined;
            this._containerElement = undefined;
        }
    }
    _getMessage(message) {
        if (typeof (message) === 'object') {
            return message;
        }
        if (typeof (message) === 'string') {
            return { text: message };
        }
    }
    /** закрыть все отображенные сообщения */
    closeAll() {
        this._notificationEntries.forEach(e => {
            this._appRef.detachView(e.componentRef.hostView);
            const hostEl = e.componentRef.location.nativeElement;
            e.componentRef.destroy();
            hostEl?.remove();
        });
        this._notificationEntries = [];
        this._containerOverlayRef?.dispose();
        this._containerOverlayRef = undefined;
        this._containerElement = undefined;
    }
    /** отобразить информационное сообщение */
    showInfo(message) {
        this._show(this._getMessage(message), NotificationInfoType.Info);
    }
    /** отобразить сообщение об ошибке */
    showError(message) {
        this._show(this._getMessage(message), NotificationInfoType.Error);
    }
    /**отобразить массив ошибок*/
    showErrors(errors) {
        if (errors && errors.length > 0) {
            errors.forEach(err => this._show({ text: err, subject: 'Ошибка' }, NotificationInfoType.Error));
        }
    }
    /**отобразить уведомление*/
    showNotification(text, typeNotification, subject, useHtml = false) {
        this._show({ text: text, subject: subject ?? CoreNotificationUIConfig[typeNotification], useHtml }, typeNotification);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationService, deps: [{ token: i1$4.Overlay }, { token: i0.Injector }, { token: CoreNotificationQueueService }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: i1$4.Overlay }, { type: i0.Injector }, { type: CoreNotificationQueueService }, { type: i0.ApplicationRef }] });

class NotificationDetailService {
    constructor(injector, _notificationSrv) {
        this._notificationSrv = _notificationSrv;
        this.VM = injector.get(VisualSettingManager);
    }
    stopNewRequestAction() {
        const warning = 'Для подачи заявок необходимо ';
        const where = ' в разделе "Рабочий стол".';
        if (this.VM.Setting.common.isSystemReglamentSigned === false) {
            this._notificationSrv.showNotification(warning + 'подписать заявление о присоединении к Правилам Платформы "DOCPLAT"' + where, NotificationInfoType.Warning);
            return true;
        }
        if (this.VM.isEmailMustVerify === true && this.VM.Setting.verification.isEmailVerificated === false) {
            this._notificationSrv.showNotification(warning + 'подтвердить электронную почту' + where, NotificationInfoType.Warning);
            return true;
        }
        if (this.VM.isPhoneMustVerify === true && this.VM.Setting.verification.isPhoneVerificated === false) {
            this._notificationSrv.showNotification(warning + 'подтвердить телефонный номер' + where, NotificationInfoType.Warning);
            return true;
        }
        return false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NotificationDetailService, deps: [{ token: i0.Injector }, { token: CoreNotificationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NotificationDetailService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: NotificationDetailService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: CoreNotificationService }] });

class CoreNotificationModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationModule, declarations: [СoreNotificationComponent], imports: [CoreBaseModule,
            CoreMatModule], exports: [СoreNotificationComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationModule, providers: [
            CoreNotificationQueueService,
            CoreNotificationService,
            NotificationDetailService
        ], imports: [CoreBaseModule,
            CoreMatModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotificationModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        СoreNotificationComponent
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule
                    ],
                    providers: [
                        CoreNotificationQueueService,
                        CoreNotificationService,
                        NotificationDetailService
                    ],
                    exports: [
                        СoreNotificationComponent,
                    ],
                }]
        }] });

class CoreNotification {
    static success(message, useHtml = false) {
        this.showNotification(message, NotificationInfoType.Success, useHtml);
    }
    static warning(message, useHtml = false) {
        this.showNotification(message, NotificationInfoType.Warning, useHtml);
    }
    static info(message, useHtml = false) {
        this.showNotification(message, NotificationInfoType.Info, useHtml);
    }
    static error(message, useHtml = false) {
        this.showNotification(message, NotificationInfoType.Error, useHtml);
    }
    static showNotification(message, type, useHtml = false) {
        const notification = window.sellan_injector_instance.get(CoreNotificationService);
        notification.showNotification(message, type, undefined, useHtml);
    }
}

// константы закрытия диалога
class DialogConfirmReason {
    static { this.cancel = 'cancellation'; }
}
class CoreConfirmDialogWindow extends CoreAbstractComponent {
    // dialogRef используется на форме
    constructor(dialogRef, data) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
        dialogRef.disableClose = true;
        dialogRef.backdropClick().subscribe(() => {
            dialogRef.close(false);
        });
    }
    onEsc() {
        this.dialogRef.close(false);
    }
    ngOnInit() {
        if (!this.data) {
            this.data = {
                message: undefined,
                button: undefined,
                cancel: undefined
            };
        }
        if (Utility.isEmpty(this.data.message)) {
            this.data.message = 'Если вы хотите выполнить действие нажмите кнопку <strong>\'Подтвердить\'</strong>.'
                + ' <br />В случае отказа от действия нажмите <strong>\[ Х ]\ </strong>';
        }
        if (Utility.isEmpty(this.data.button)) {
            this.data.button = 'Подтвердить';
        }
        if (Utility.isEmpty(this.data.cancel)) {
            this.data.cancel = 'X';
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreConfirmDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreConfirmDialogWindow, isStandalone: false, selector: "ng-component", inputs: { beforeClosed: "beforeClosed" }, host: { listeners: { "window:keydown.esc": "onEsc()" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"modal inmodal sln-core-info-dialog\">\n    <div class=\"modal-dialog\">\n        <div class=\"modal-content animated fadeIn sln-auth-dialog\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\">\u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435</h4>\n            </div>\n            <div class=\"modal-body\" [innerHTML]=\"data.message\">\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn-primary\" (click)=\"dialogRef.close(true)\">{{data.button}}</button>\n                <button type=\"button\" class=\"sln-cancel-close\" (click)=\"dialogRef.close(false)\" mat-dialog-close>{{data.cancel}}</button>\n            </div>\n        </div>\n    </div>\n</div>", styles: [".inmodal{max-width:650px}.close{outline:none;border:none;background:transparent;cursor:pointer}button{outline:none}button .sr-only{font-size:25px;font-family:var(--font-bold);color:var(--DARK-GREY)}\n"], dependencies: [{ kind: "directive", type: i1$8.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreConfirmDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<div class=\"modal inmodal sln-core-info-dialog\">\n    <div class=\"modal-dialog\">\n        <div class=\"modal-content animated fadeIn sln-auth-dialog\">\n            <div class=\"modal-header\">\n                <h4 class=\"modal-title\">\u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435</h4>\n            </div>\n            <div class=\"modal-body\" [innerHTML]=\"data.message\">\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn-primary\" (click)=\"dialogRef.close(true)\">{{data.button}}</button>\n                <button type=\"button\" class=\"sln-cancel-close\" (click)=\"dialogRef.close(false)\" mat-dialog-close>{{data.cancel}}</button>\n            </div>\n        </div>\n    </div>\n</div>", styles: [".inmodal{max-width:650px}.close{outline:none;border:none;background:transparent;cursor:pointer}button{outline:none}button .sr-only{font-size:25px;font-family:var(--font-bold);color:var(--DARK-GREY)}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }], propDecorators: { beforeClosed: [{
                type: Input
            }], onEsc: [{
                type: HostListener,
                args: ['window:keydown.esc']
            }] } });

var InfoType;
(function (InfoType) {
    InfoType["Success"] = "success";
    InfoType["Danger"] = "danger";
    InfoType["Warning"] = "warning";
    InfoType["Info"] = "info";
    InfoType["ValidationError"] = "validation";
})(InfoType || (InfoType = {}));
class InfoDiologConfig {
    constructor(type, message) {
        this.type = type;
        this.message = message;
    }
}
class CoreInfoDialogWindow extends CoreAbstractComponent {
    constructor(dialogRef, data) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
    }
    ngOnInit() {
        if (!this.data.type) {
            this.data.type = InfoType.Success;
        }
        if (!this.data.message) {
            this.data.message = 'Операция выполнена успешно';
        }
    }
    ngAfterViewInit() {
        Promise.resolve(null).then(() => {
            switch (this.data.type) {
                case InfoType.Success:
                    this.dialogTitle = 'Выполнено успешно';
                    break;
                case InfoType.Danger:
                    this.dialogTitle = 'Ошибка';
                    break;
                case InfoType.Warning:
                    this.dialogTitle = 'Внимание';
                    break;
                case InfoType.ValidationError:
                    this.dialogTitle = 'Ошибка валидации входящих данных';
                    break;
                default:
                    this.dialogTitle = 'Информация';
                    break;
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreInfoDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreInfoDialogWindow, isStandalone: false, selector: "core-info-dialog", usesInheritance: true, ngImport: i0, template: "<div class=\"modal inmodal sln-core-info-dialog\">\n    <div class=\"modal-dialog\">\n        <div class=\"modal-content animated fadeIn\">\n            <div class=\"modal-header\">\n                <!-- <button type=\"button\" class=\"close\" mat-dialog-close><span aria-hidden=\"true\" class=\"sr-only\">\u00D7</span></button> -->\n                <h4 class=\"modal-title\">{{dialogTitle}}</h4>\n            </div>\n            <div class=\"modal-text\">\n                <div class=\"alert-{{data.type}}\" [innerHTML]=\"data.message\">\n                </div>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn-primary btn-white\" style=\"width: 100px;\" mat-dialog-close>OK</button>\n            </div>\n        </div>\n    </div>\n</div>", styles: [".btn:active:focus,.btn:focus{outline:none}button{outline:none}button .sr-only{font-size:25px;font-family:var(--font-bold);color:var(--DARK-GREY)}\n"], dependencies: [{ kind: "directive", type: i1$8.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreInfoDialogWindow, decorators: [{
            type: Component,
            args: [{ selector: 'core-info-dialog', standalone: false, template: "<div class=\"modal inmodal sln-core-info-dialog\">\n    <div class=\"modal-dialog\">\n        <div class=\"modal-content animated fadeIn\">\n            <div class=\"modal-header\">\n                <!-- <button type=\"button\" class=\"close\" mat-dialog-close><span aria-hidden=\"true\" class=\"sr-only\">\u00D7</span></button> -->\n                <h4 class=\"modal-title\">{{dialogTitle}}</h4>\n            </div>\n            <div class=\"modal-text\">\n                <div class=\"alert-{{data.type}}\" [innerHTML]=\"data.message\">\n                </div>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn-primary btn-white\" style=\"width: 100px;\" mat-dialog-close>OK</button>\n            </div>\n        </div>\n    </div>\n</div>", styles: [".btn:active:focus,.btn:focus{outline:none}button{outline:none}button .sr-only{font-size:25px;font-family:var(--font-bold);color:var(--DARK-GREY)}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: InfoDiologConfig, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class CoreDialog {
    static { this.stack = []; }
    static notificate(msg, type) {
        if (Utility.isEmpty(type)) {
            type = InfoType.Info;
        }
        const dialog = window.sellan_injector_instance.get(MatDialog);
        dialog.open(CoreInfoDialogWindow, {
            data: new InfoDiologConfig(type, msg)
        });
    }
    static confirm(action, faild, options) {
        const dialog = window.sellan_injector_instance.get(MatDialog);
        if (CoreDialog._pushStack(CoreConfirmDialogWindow)) {
            const confirmDialogRef = dialog.open(CoreConfirmDialogWindow, { disableClose: false, data: options });
            const dialogSub = confirmDialogRef.afterClosed().subscribe(result => {
                if (result === true) {
                    action();
                }
                else if (result === false) {
                    if (!Utility.isEmpty(faild)) {
                        faild();
                    }
                }
                CoreDialog._popStack();
                dialogSub.unsubscribe();
            });
        }
    }
    static window(component, data, action, faild) {
        const dialog = window.sellan_injector_instance.get(MatDialog);
        if (CoreDialog._pushStack(component)) {
            const dialogRef = dialog.open(component, { data: data });
            const sub = dialogRef.afterClosed().subscribe((result) => {
                if (result && result.state !== DialogReason.cancel) {
                    if (!Utility.isEmpty(action)) {
                        action(result);
                    }
                }
                else {
                    if (!Utility.isEmpty(faild)) {
                        faild(result);
                    }
                }
                CoreDialog._popStack();
                sub.unsubscribe();
            });
            return dialogRef;
        }
        return undefined;
    }
    static _pushStack(component) {
        if (CoreDialog.stack.length === 0) {
            CoreDialog.stack.push(component);
        }
        else {
            if (CoreDialog.stack[CoreDialog.stack.length - 1] === component) {
                return false;
            }
            else {
                CoreDialog.stack.push(component);
            }
        }
        return true;
    }
    static _popStack() {
        if (CoreDialog.stack.length === 0) {
            throw Error('Underflow: stack is empty');
        }
        return CoreDialog.stack.pop();
    }
}

// константы закрытия диалога
class DialogReason {
    static { this.cancel = 'cancellation'; }
}
class CoreDialogWindow extends CoreAbstractComponent {
    toggTicketsVersions() {
        this.showTicketsVersions = !this.showTicketsVersions;
    }
    styleWidth() {
        if (this.fullScreen) {
            return {
                height: (window.innerHeight - 30).toString() + 'px',
                width: (window.innerWidth - 30).toString() + 'px',
                maxWidth: "100%",
                maxHeight: "100%"
            };
        }
        return { width: !this.width ? 'auto' : this.width.toString() + 'px',
            minWidth: !this.minWidth ? '500' : this.minWidth.toString() + 'px' };
    }
    constructor(_dialogRef, _dialog) {
        super();
        this._dialogRef = _dialogRef;
        this._dialog = _dialog;
        this.hasCansel = true;
        this.canselText = 'X';
        this.hasFooter = true;
        this.fullScreen = false;
        this.hasTitle = true;
        this.leftMenu = false;
        this.resizeble = false;
        this.showTicketsVersions = false;
        // окно предупреждения о закрытии
        this.showCloseConfirmDialog = false;
        // разрешение на перетаскивание окна
        this.cdkDragDisabled = true;
        _dialogRef.disableClose = true;
        _dialogRef.backdropClick().subscribe(_ => {
            this._closingLogic('backdrop');
        });
    }
    onKeyUp() {
        const openDialogs = this._dialog.openDialogs;
        if (openDialogs.length > 0 && openDialogs[openDialogs.length - 1] === this._dialogRef) {
            this._closingLogic('esc');
        }
    }
    ngOnInit() {
        if (!this.dialogTitle) {
            throw new Error('Dialog must have a dialogTitle.');
        }
        this.prepareDialogNativeElement();
    }
    prepareDialogNativeElement() {
        let nativeElement = this._dialogRef._ref.overlayRef._pane;
        if (this.resizeble) {
            nativeElement.setAttribute('class', 'resizeble-dialog cdk-overlay-pane');
            nativeElement.setAttribute('style', 'max-width: 100%; width: ' + this.minWidth + 'px');
            return;
        }
        nativeElement.setAttribute('class', 'unresizeble-dialog cdk-overlay-pane');
        if (this.fullScreen) {
            nativeElement.setAttribute('style', 'max-width: 100%;');
        }
    }
    close($event) {
        this._closingLogic('close');
    }
    _closingLogic(emmiter) {
        const confirmClose = () => {
            this._dialogRef.close({ state: DialogReason.cancel, emmiter: emmiter });
        };
        const cancelClose = () => {
            console.log('Закрытие отменено пользователем.');
        };
        const confirmationOptions = {
            message: 'Вы уверены, что хотите закрыть окно? Несохраненные данные будут потеряны.',
            button: 'Закрыть'
        };
        if (!this.showCloseConfirmDialog) {
            // Если предупреждение выключено, просто закрываем диалог
            this._dialogRef.close({ state: DialogReason.cancel, emmiter });
            return;
        }
        if (this.beforeClosed) {
            this.beforeClosed({ state: DialogReason.cancel, emmiter });
        }
        else {
            CoreDialog.confirm(confirmClose, cancelClose, confirmationOptions);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: i1$8.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreDialogWindow, isStandalone: false, selector: "core-dialog", inputs: { dialogTitle: "dialogTitle", hasCansel: "hasCansel", canselText: "canselText", hasFooter: "hasFooter", fullScreen: "fullScreen", width: "width", minWidth: "minWidth", hasTitle: "hasTitle", leftMenu: "leftMenu", resizeble: "resizeble", showTicketsVersions: "showTicketsVersions", showCloseConfirmDialog: "showCloseConfirmDialog", beforeClosed: "beforeClosed", cdkDragDisabled: "cdkDragDisabled" }, host: { listeners: { "window:keydown.esc": "onKeyUp()" } }, viewQueries: [{ propertyName: "matDialogRef", first: true, predicate: ["mat-dialog-container"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"modal inmodal sln-core-dialog-modal\">\n  <div class=\"modal-dialog sln-modal-dialog\" [ngStyle]=\"styleWidth()\">\n    @if (leftMenu) {\n      <div class=\"toggle-left-menu\">\n        <button (click)=\"toggTicketsVersions()\">\n          @if (showTicketsVersions) {\n            <div class=\"sln-modal-right-arrow sln-modal-right-arrow-position\"></div>\n          }\n          @if (!showTicketsVersions) {\n            <div class=\"sln-modal-right-arrow sln-modal-right-arrow-position sln-rotate-image\"></div>\n          }\n        </button>\n        @if (showTicketsVersions) {\n          <ng-content select=\"[ticketsVersionsMenu]\"></ng-content>\n        }\n        @if (!showTicketsVersions) {\n          <div  class=\"hide-left-menu\"></div>\n        }\n      </div>\n    }\n    <div class=\"modal-content animated fadeIn\">\n      @if (hasTitle) {\n        <div class=\"modal-header sln-header-search\">\n          <h4  mat-dialog-title cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" [cdkDragDisabled]=\"cdkDragDisabled\" cdkDragHandle   [ngStyle]=\"{'cursor': cdkDragDisabled ? 'default' : 'grab'}\" class=\"sln-modal-title\">{{dialogTitle}}\n          </h4>\n          <ng-content select=\"[header]\"></ng-content>\n        </div>\n      }\n      <div mat-dialog-content class=\"modal-body\">\n        <ng-content select=\"[body]\"></ng-content>\n      </div>\n      @if (hasFooter) {\n        <div mat-dialog-actions class=\"modal-footer\">\n          <ng-content select=\"[footer]\"></ng-content>\n          @if (hasCansel) {\n            <button type=\"button\" class=\"sln-cancel-close\" (click)=\"close($event)\">{{ canselText }}</button>\n          }\n        </div>\n      }\n    </div>\n  </div>\n</div>\n", styles: [".close{outline:none;border:none;background:transparent;cursor:pointer}.close .sr-only{font-size:25px;font-family:var(--font-bold);color:var(--DARK-GREY)}.sln-rotate-image{transform:rotate(180deg)}table th{font-family:var(--font);font-size:12px;letter-spacing:.02em;color:var(--GRAY-SOFT);font-weight:700}.sln-pad-license{width:100%;margin:0 auto;padding:10px 0;display:contents}::-webkit-scrollbar{width:5px;height:5px;background-color:transparent}::-webkit-scrollbar-thumb{background-color:var(--LIGHT-GRAY);border-radius:10px;cursor:auto}.toggle-left-menu{width:auto;display:flex}.toggle-left-menu button{background:var(--WHITE);border-radius:4px 0 0 4px;cursor:pointer;padding:0 13px}\n"], dependencies: [{ kind: "directive", type: i1$8.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$8.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$8.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i2$4.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2$4.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDialogWindow, decorators: [{
            type: Component,
            args: [{ selector: 'core-dialog', standalone: false, template: "<div class=\"modal inmodal sln-core-dialog-modal\">\n  <div class=\"modal-dialog sln-modal-dialog\" [ngStyle]=\"styleWidth()\">\n    @if (leftMenu) {\n      <div class=\"toggle-left-menu\">\n        <button (click)=\"toggTicketsVersions()\">\n          @if (showTicketsVersions) {\n            <div class=\"sln-modal-right-arrow sln-modal-right-arrow-position\"></div>\n          }\n          @if (!showTicketsVersions) {\n            <div class=\"sln-modal-right-arrow sln-modal-right-arrow-position sln-rotate-image\"></div>\n          }\n        </button>\n        @if (showTicketsVersions) {\n          <ng-content select=\"[ticketsVersionsMenu]\"></ng-content>\n        }\n        @if (!showTicketsVersions) {\n          <div  class=\"hide-left-menu\"></div>\n        }\n      </div>\n    }\n    <div class=\"modal-content animated fadeIn\">\n      @if (hasTitle) {\n        <div class=\"modal-header sln-header-search\">\n          <h4  mat-dialog-title cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" [cdkDragDisabled]=\"cdkDragDisabled\" cdkDragHandle   [ngStyle]=\"{'cursor': cdkDragDisabled ? 'default' : 'grab'}\" class=\"sln-modal-title\">{{dialogTitle}}\n          </h4>\n          <ng-content select=\"[header]\"></ng-content>\n        </div>\n      }\n      <div mat-dialog-content class=\"modal-body\">\n        <ng-content select=\"[body]\"></ng-content>\n      </div>\n      @if (hasFooter) {\n        <div mat-dialog-actions class=\"modal-footer\">\n          <ng-content select=\"[footer]\"></ng-content>\n          @if (hasCansel) {\n            <button type=\"button\" class=\"sln-cancel-close\" (click)=\"close($event)\">{{ canselText }}</button>\n          }\n        </div>\n      }\n    </div>\n  </div>\n</div>\n", styles: [".close{outline:none;border:none;background:transparent;cursor:pointer}.close .sr-only{font-size:25px;font-family:var(--font-bold);color:var(--DARK-GREY)}.sln-rotate-image{transform:rotate(180deg)}table th{font-family:var(--font);font-size:12px;letter-spacing:.02em;color:var(--GRAY-SOFT);font-weight:700}.sln-pad-license{width:100%;margin:0 auto;padding:10px 0;display:contents}::-webkit-scrollbar{width:5px;height:5px;background-color:transparent}::-webkit-scrollbar-thumb{background-color:var(--LIGHT-GRAY);border-radius:10px;cursor:auto}.toggle-left-menu{width:auto;display:flex}.toggle-left-menu button{background:var(--WHITE);border-radius:4px 0 0 4px;cursor:pointer;padding:0 13px}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: i1$8.MatDialog }], propDecorators: { dialogTitle: [{
                type: Input
            }], hasCansel: [{
                type: Input
            }], canselText: [{
                type: Input
            }], hasFooter: [{
                type: Input
            }], fullScreen: [{
                type: Input
            }], width: [{
                type: Input
            }], minWidth: [{
                type: Input
            }], hasTitle: [{
                type: Input
            }], leftMenu: [{
                type: Input
            }], resizeble: [{
                type: Input
            }], showTicketsVersions: [{
                type: Input
            }], showCloseConfirmDialog: [{
                type: Input
            }], beforeClosed: [{
                type: Input
            }], cdkDragDisabled: [{
                type: Input
            }], matDialogRef: [{
                type: ViewChild,
                args: ["mat-dialog-container", { static: true }]
            }], onKeyUp: [{
                type: HostListener,
                args: ['window:keydown.esc']
            }] } });

class PopupResults {
    HandleIResponse(option) {
        if (option.response.isSuccess) {
            if (option.msg) {
                CoreNotification.success(option.msg);
            }
            else if (!Utility.isEmpty(option.response.message)) {
                CoreNotification.info(option.response.message);
            }
            if (option.successCallback) {
                option.successCallback();
            }
        }
        else {
            CoreNotification.error(option.response.message);
            if (option.failCallback) {
                option.failCallback();
            }
        }
    }
    HandleIEntityResponse(option) {
        if (option.response.isSuccess) {
            if (option.msg) {
                CoreNotification.success(option.msg);
            }
            else if (!Utility.isEmpty(option.response.message)) {
                CoreNotification.info(option.response.message);
            }
            if (option.successCallback) {
                option.successCallback(option.response.entity);
            }
        }
        else {
            let message = "";
            if (option.response.type?.toString() === "Validation" || option.response.type?.toString() === "3000") {
                const errors = option.response.entity;
                if (errors.length === 1 && errors[0].errors.length === 1) {
                    message = errors[0].errors[0];
                }
                else {
                    for (let i = 0; i < errors.length; i++) {
                        for (let j = 0; j < errors[i].errors.length; j++) {
                            message += '<li>' + errors[i].errors[j] + '</li>';
                        }
                    }
                    message += '</ul>';
                }
                CoreDialog.notificate(message, InfoType.ValidationError);
            }
            else {
                CoreNotification.error(option.response.message);
            }
            if (option.failCallback) {
                option.failCallback();
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PopupResults, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PopupResults, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: PopupResults, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

class CoreDialogModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreDialogModule, declarations: [CoreConfirmDialogWindow,
            CoreInfoDialogWindow,
            CoreDialogWindow], imports: [CoreMatModule,
            DragDropModule,
            CoreControlModule,
            CoreNotificationModule,
            CoreBaseModule], exports: [CoreConfirmDialogWindow,
            CoreInfoDialogWindow,
            DragDropModule,
            CoreDialogWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDialogModule, providers: [
            PopupResults
        ], imports: [CoreMatModule,
            DragDropModule,
            CoreControlModule,
            CoreNotificationModule,
            CoreBaseModule, DragDropModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDialogModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreConfirmDialogWindow,
                        CoreInfoDialogWindow,
                        CoreDialogWindow
                    ],
                    imports: [
                        CoreMatModule,
                        DragDropModule,
                        CoreControlModule,
                        CoreNotificationModule,
                        CoreBaseModule
                    ],
                    providers: [
                        PopupResults
                    ],
                    exports: [
                        CoreConfirmDialogWindow,
                        CoreInfoDialogWindow,
                        DragDropModule,
                        CoreDialogWindow
                    ]
                }]
        }] });

class AuthBlockedUserInstructionDialogWindow extends CoreAbstractComponent {
    constructor(data) {
        super();
        this.data = data;
        this.showInstruction = false;
    }
    viewInstruction() {
        this.showInstruction = !this.showInstruction;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthBlockedUserInstructionDialogWindow, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: AuthBlockedUserInstructionDialogWindow, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"{{ showInstruction ? '\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430\u043C\u0438' : '\u0412\u044B \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u044B' }}\" width=\"800\" canselText=\"\u041F\u043E\u043D\u044F\u0442\u043D\u043E\">\n  <div body>\n    @if (!showInstruction) {\n      <div class=\"sln-blocked-instruction\">\n        <p>\u0421\u043F\u0430\u0441\u0438\u0431\u043E! \u041C\u044B \u0441\u043E\u0437\u0434\u0430\u043B\u0438 \u0432\u0430\u0448 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430 \u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0435.</p>\n        <p>\u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u043A \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0443 \u043B\u0438\u0447\u043D\u043E\u0433\u043E \u043A\u0430\u0431\u0438\u043D\u0435\u0442\u0430 ({{data}}) \u0438\u043B\u0438 \u0432 \u0442\u0435\u0445\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443 \u0434\u043B\u044F \u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 \u2013 \u0438 \u043C\u043E\u0436\u0435\u0442\u0435 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043D\u0430 \u0414\u043E\u043A\u043F\u043B\u0430\u0442!</p>\n        <br /><br />\n        <small (click)=\"viewInstruction()\">\u041A\u0430\u043A \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0430\u043A\u043A\u0430\u0443\u043D\u0442</small>\n      </div>\n    }\n    @if (showInstruction) {\n      <div class=\"sln-blocked-instruction-info\">\n        <p>\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430\u043C\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u043D\u0430 \u0414\u043E\u043A\u043F\u043B\u0430\u0442 \u043E\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043B\u044F\u0435\u0442 \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u043B\u0438\u0447\u043D\u043E\u0433\u043E \u043A\u0430\u0431\u0438\u043D\u0435\u0442\u0430. \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u043E\u043C \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043D\u0430\u0437\u043D\u0430\u0447\u0430\u0435\u0442\u0441\u044F \u043F\u0435\u0440\u0432\u044B\u0439 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u0432\u0448\u0438\u0439 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C.<br /><br /></p>\n        <span>\u0427\u0442\u043E\u0431\u044B \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0430\u043A\u043A\u0430\u0443\u043D\u0442 \u0434\u0440\u0443\u0433\u043E\u0433\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F</span>\n        <p>\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0437\u0430\u0445\u043E\u0434\u0438\u0442 \u0432 \u043B\u0438\u0447\u043D\u044B\u0439 \u043A\u0430\u0431\u0438\u043D\u0435\u0442 \u2013 \u0440\u0430\u0437\u0434\u0435\u043B \u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0438 \u0432 \u0431\u043E\u043A\u043E\u0432\u043E\u043C \u043C\u0435\u043D\u044E \u2013 \u0423\u0447\u0435\u0442\u043D\u044B\u0435 \u0437\u0430\u043F\u0438\u0441\u0438.</p>\n        <p>\u041F\u043E \u043A\u043B\u0438\u043A\u0443 \u043D\u0430 \u043B\u043E\u0433\u0438\u043D (email) \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0438\u0442 \u0432 \u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0443 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u0438 \u043C\u0435\u043D\u044F\u0435\u0442 \u0421\u0442\u0430\u0442\u0443\u0441 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438 \u043F\u043E \u043A\u043D\u043E\u043F\u043A\u0435 \u0432 \u043F\u0440\u0430\u0432\u043E\u0439 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438.</p>\n        <p>\u0423 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0433\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u043F\u0440\u043E\u043F\u0430\u0434\u0430\u0435\u0442 \u043A\u0440\u0430\u0441\u043D\u0430\u044F \u0438\u043A\u043E\u043D\u043A\u0430 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0438 \u0432 \u0448\u0430\u043F\u043A\u0435 \u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F. \u0422\u0435\u043F\u0435\u0440\u044C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043C\u043E\u0436\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0432 \u043B\u0438\u0447\u043D\u043E\u043C \u043A\u0430\u0431\u0438\u043D\u0435\u0442\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u043D\u0430 \u0414\u043E\u043A\u043F\u043B\u0430\u0442!<br /><br /></p>\n        <span>\u0427\u0442\u043E\u0431\u044B \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C/\u0441\u043C\u0435\u043D\u0438\u0442\u044C \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438</span>\n        <p>\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0437\u0430\u0445\u043E\u0434\u0438\u0442 \u0432 \u043B\u0438\u0447\u043D\u044B\u0439 \u043A\u0430\u0431\u0438\u043D\u0435\u0442 \u2013 \u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438, \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \u0421\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0438 \u043F\u043E \u043A\u043D\u043E\u043F\u043A\u0435 \u00AB+\u00BB \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u043D\u043E\u0432\u0443\u044E \u0441\u0432\u044F\u0437\u044C. \u0412\u044B\u0431\u0438\u0440\u0430\u0435\u0442 \u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u043E\u0435 \u043B\u0438\u0446\u043E \u0438 \u043F\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0435\u043C\u0443 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440.</p>\n        <p>\u041B\u044E\u0431\u043E\u0439 \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u043C\u043E\u0436\u0435\u0442 \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0440\u0430\u043D\u0435\u0435 \u0441\u043E\u0437\u0434\u0430\u043D\u043D\u044B\u0435 \u0441\u0432\u044F\u0437\u0438 \u0438 \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u043D\u043E\u0432\u044B\u0435.</p>\n      </div>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-blocked-instruction p{color:var(--DARK-GREY);margin-bottom:5px;padding:0}.sln-blocked-instruction small{color:var(--PRIMARY);font-family:var(--font-medium);font-size:14px;cursor:pointer;border-bottom:1px solid var(--PRIMARY)}.sln-blocked-instruction-info p{color:var(--DARK-GREY);margin-bottom:5px;padding:0}.sln-blocked-instruction-info span{color:var(--DARK-GREY);font-family:var(--font-bold);margin-bottom:10px;display:block}\n"], dependencies: [{ kind: "ngmodule", type: CoreDialogModule }, { kind: "component", type: 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: AuthBlockedUserInstructionDialogWindow, decorators: [{
            type: Component,
            args: [{ imports: [CoreDialogModule], template: "<core-dialog dialogTitle=\"{{ showInstruction ? '\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430\u043C\u0438' : '\u0412\u044B \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u044B' }}\" width=\"800\" canselText=\"\u041F\u043E\u043D\u044F\u0442\u043D\u043E\">\n  <div body>\n    @if (!showInstruction) {\n      <div class=\"sln-blocked-instruction\">\n        <p>\u0421\u043F\u0430\u0441\u0438\u0431\u043E! \u041C\u044B \u0441\u043E\u0437\u0434\u0430\u043B\u0438 \u0432\u0430\u0448 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430 \u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0435.</p>\n        <p>\u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u043A \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0443 \u043B\u0438\u0447\u043D\u043E\u0433\u043E \u043A\u0430\u0431\u0438\u043D\u0435\u0442\u0430 ({{data}}) \u0438\u043B\u0438 \u0432 \u0442\u0435\u0445\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443 \u0434\u043B\u044F \u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 \u2013 \u0438 \u043C\u043E\u0436\u0435\u0442\u0435 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u043D\u0430 \u0414\u043E\u043A\u043F\u043B\u0430\u0442!</p>\n        <br /><br />\n        <small (click)=\"viewInstruction()\">\u041A\u0430\u043A \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0430\u043A\u043A\u0430\u0443\u043D\u0442</small>\n      </div>\n    }\n    @if (showInstruction) {\n      <div class=\"sln-blocked-instruction-info\">\n        <p>\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430\u043C\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u043D\u0430 \u0414\u043E\u043A\u043F\u043B\u0430\u0442 \u043E\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043B\u044F\u0435\u0442 \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u043B\u0438\u0447\u043D\u043E\u0433\u043E \u043A\u0430\u0431\u0438\u043D\u0435\u0442\u0430. \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u043E\u043C \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043D\u0430\u0437\u043D\u0430\u0447\u0430\u0435\u0442\u0441\u044F \u043F\u0435\u0440\u0432\u044B\u0439 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u0432\u0448\u0438\u0439 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C.<br /><br /></p>\n        <span>\u0427\u0442\u043E\u0431\u044B \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0430\u043A\u043A\u0430\u0443\u043D\u0442 \u0434\u0440\u0443\u0433\u043E\u0433\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F</span>\n        <p>\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0437\u0430\u0445\u043E\u0434\u0438\u0442 \u0432 \u043B\u0438\u0447\u043D\u044B\u0439 \u043A\u0430\u0431\u0438\u043D\u0435\u0442 \u2013 \u0440\u0430\u0437\u0434\u0435\u043B \u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0438 \u0432 \u0431\u043E\u043A\u043E\u0432\u043E\u043C \u043C\u0435\u043D\u044E \u2013 \u0423\u0447\u0435\u0442\u043D\u044B\u0435 \u0437\u0430\u043F\u0438\u0441\u0438.</p>\n        <p>\u041F\u043E \u043A\u043B\u0438\u043A\u0443 \u043D\u0430 \u043B\u043E\u0433\u0438\u043D (email) \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0438\u0442 \u0432 \u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0443 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u0438 \u043C\u0435\u043D\u044F\u0435\u0442 \u0421\u0442\u0430\u0442\u0443\u0441 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438 \u043F\u043E \u043A\u043D\u043E\u043F\u043A\u0435 \u0432 \u043F\u0440\u0430\u0432\u043E\u0439 \u0432\u0435\u0440\u0445\u043D\u0435\u0439 \u0447\u0430\u0441\u0442\u0438.</p>\n        <p>\u0423 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0433\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u043F\u0440\u043E\u043F\u0430\u0434\u0430\u0435\u0442 \u043A\u0440\u0430\u0441\u043D\u0430\u044F \u0438\u043A\u043E\u043D\u043A\u0430 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0438 \u0432 \u0448\u0430\u043F\u043A\u0435 \u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F. \u0422\u0435\u043F\u0435\u0440\u044C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u043C\u043E\u0436\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0432 \u043B\u0438\u0447\u043D\u043E\u043C \u043A\u0430\u0431\u0438\u043D\u0435\u0442\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u043D\u0430 \u0414\u043E\u043A\u043F\u043B\u0430\u0442!<br /><br /></p>\n        <span>\u0427\u0442\u043E\u0431\u044B \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C/\u0441\u043C\u0435\u043D\u0438\u0442\u044C \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438</span>\n        <p>\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0437\u0430\u0445\u043E\u0434\u0438\u0442 \u0432 \u043B\u0438\u0447\u043D\u044B\u0439 \u043A\u0430\u0431\u0438\u043D\u0435\u0442 \u2013 \u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438, \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \u0421\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0438 \u043F\u043E \u043A\u043D\u043E\u043F\u043A\u0435 \u00AB+\u00BB \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u043D\u043E\u0432\u0443\u044E \u0441\u0432\u044F\u0437\u044C. \u0412\u044B\u0431\u0438\u0440\u0430\u0435\u0442 \u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u043E\u0435 \u043B\u0438\u0446\u043E \u0438 \u043F\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0435\u043C\u0443 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440.</p>\n        <p>\u041B\u044E\u0431\u043E\u0439 \u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u043C\u043E\u0436\u0435\u0442 \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0440\u0430\u043D\u0435\u0435 \u0441\u043E\u0437\u0434\u0430\u043D\u043D\u044B\u0435 \u0441\u0432\u044F\u0437\u0438 \u0438 \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u043D\u043E\u0432\u044B\u0435.</p>\n      </div>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-blocked-instruction p{color:var(--DARK-GREY);margin-bottom:5px;padding:0}.sln-blocked-instruction small{color:var(--PRIMARY);font-family:var(--font-medium);font-size:14px;cursor:pointer;border-bottom:1px solid var(--PRIMARY)}.sln-blocked-instruction-info p{color:var(--DARK-GREY);margin-bottom:5px;padding:0}.sln-blocked-instruction-info span{color:var(--DARK-GREY);font-family:var(--font-bold);margin-bottom:10px;display:block}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class TwoFactorService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    askAuthCode(request) {
        const url = this._startUp.apiRoot('codes/auth/ask', 'notification');
        return this._ajaxM.post({ url: url, data: request });
    }
    verifyAuthCode(challenge) {
        const url = this._startUp.apiRoot(`codes/auth/verify?challenge=${challenge}`, 'notification');
        return this._ajaxM.get({ url: url });
    }
    confirmTwoFactor(data) {
        const url = this._startUp.apiRoot('mfa/confirm', 'oauth');
        return this._ajaxM.post({ url: url, data: data });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TwoFactorService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TwoFactorService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TwoFactorService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

const CountDownTimeout = 30;
class MfaDialogWindow extends CoreBaseDestroyComponent {
    constructor(data, _dialogRef, _twoFactorService, _popupResult) {
        super();
        this.data = data;
        this._dialogRef = _dialogRef;
        this._twoFactorService = _twoFactorService;
        this._popupResult = _popupResult;
        this.showCountDown = false;
        this.countDownTimeout = CountDownTimeout;
        this.dialogTitleValue = "Подтверждение авторизации";
        this.checkThreshold = 3;
    }
    ngOnInit() {
        this.ask();
    }
    // проверка звонка
    check() {
        this._twoFactorService.verifyAuthCode(this.challenge)
            .pipe(this.takeUntilDestroyed())
            .subscribe(res => {
            this._popupResult.HandleIEntityResponse({
                response: res,
                successCallback: (entity) => {
                    this._dialogRef.close(entity);
                }
            });
        });
    }
    ask() {
        this._twoFactorService.askAuthCode(this.data)
            .pipe(this.takeUntilDestroyed())
            .subscribe(res => {
            this._popupResult.HandleIEntityResponse({
                response: res,
                successCallback: (entity) => {
                    this.setTimeout();
                    this.displayPhone = entity.displayPhone;
                    this.challenge = entity.challenge;
                },
                failCallback: (_) => {
                    this._dialogRef.close({});
                }
            });
        });
    }
    setTimeout() {
        this.showCountDown = true;
        if (this.countDownInterval) {
            clearInterval(this.countDownInterval);
        }
        this.countDownInterval = setInterval(() => {
            this.countDownTimeout--;
            if (this.checkThreshold < 1) {
                clearInterval(this.countDownInterval);
                this.showCountDown = false;
                return;
            }
            else if (this.countDownTimeout < 1) {
                this.check();
                this.checkThreshold--;
                if (this.checkThreshold) {
                    this.countDownTimeout = CountDownTimeout;
                }
            }
        }, 1000);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MfaDialogWindow, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$8.MatDialogRef }, { token: TwoFactorService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: MfaDialogWindow, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog [hasCansel]=\"false\" [width]=\"600\" [dialogTitle]=\"dialogTitleValue\">\n  <div body>\n    <div class=\"sln-mfa-dialog\">\n      <div class=\"sln-mfa-dialog-body\">\n        <p>\u0414\u043B\u044F \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043F\u043E \u043D\u043E\u043C\u0435\u0440\u0443 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0432\u043E\u043D\u043E\u043A \u043D\u0430 \u0431\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430: <a\n        href=\"tel:{{displayPhone}}\">{{ displayPhone }}</a></p>\n      </div>\n    </div>\n  </div>\n  <div footer class=\"sln-mfa-dialog-footer\">\n    <div class=\"sln-mfa-dialog-footer__title\">\n      @if (showCountDown) {\n        <p>\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0447\u0435\u0440\u0435\u0437 {{ countDownTimeout }} \u0441\u0435\u043A.</p>\n      }\n      <small>\u0421\u0438\u0441\u0442\u0435\u043C\u0430 \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u044E \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438, \u0435\u0441\u043B\u0438 \u044D\u0442\u043E\u0433\u043E \u043D\u0435 \u043F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u043E, \u0442\u043E\u0433\u0434\u0430 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \"\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0441\u0430\u043C\u043E\u0441\u0442\u043E\u044F\u0442\u0435\u043B\u044C\u043D\u043E\"</small>\n    </div>\n    <div class=\"sln-mfa-dialog-footer__link\">\n      <a type=\"button\" (click)=\"check()\">\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0441\u0430\u043C\u043E\u0441\u0442\u043E\u044F\u0442\u0435\u043B\u044C\u043D\u043E</a>\n    </div>\n  </div>\n</core-dialog>\n", styles: [".sln-mfa-dialog{max-width:600px}.sln-mfa-dialog small{font-size:14px}.sln-mfa-dialog p{color:var(--DARK-GREY)}.sln-mfa-dialog .success-done{margin-bottom:10px}.sln-mfa-dialog-body{margin-top:10px}.sln-mfa-dialog-footer{width:100%;display:flex;align-items:center;justify-content:space-between}.sln-mfa-dialog-footer__title{flex:1;text-align:left;font-size:13px!important;color:var(--MIDLE-GRAY)!important;width:50%}.sln-mfa-dialog-footer__link{padding-left:0}.sln-mfa-dialog-footer__link a{font-size:13px;padding-bottom:2px;line-height:120%;letter-spacing:.01em;border-bottom:1px solid;text-decoration:none;color:var(--ADD-COLOR-1);cursor:pointer}small.hint{line-height:.1em;letter-spacing:initial;font-size:.7em}hr.dotted{border-top:.1em dotted var(--DEFAULT)}\n"], dependencies: [{ kind: "ngmodule", type: CoreDialogModule }, { kind: "component", type: 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: MfaDialogWindow, decorators: [{
            type: Component,
            args: [{ imports: [CoreDialogModule], template: "<core-dialog [hasCansel]=\"false\" [width]=\"600\" [dialogTitle]=\"dialogTitleValue\">\n  <div body>\n    <div class=\"sln-mfa-dialog\">\n      <div class=\"sln-mfa-dialog-body\">\n        <p>\u0414\u043B\u044F \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043F\u043E \u043D\u043E\u043C\u0435\u0440\u0443 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0432\u043E\u043D\u043E\u043A \u043D\u0430 \u0431\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430: <a\n        href=\"tel:{{displayPhone}}\">{{ displayPhone }}</a></p>\n      </div>\n    </div>\n  </div>\n  <div footer class=\"sln-mfa-dialog-footer\">\n    <div class=\"sln-mfa-dialog-footer__title\">\n      @if (showCountDown) {\n        <p>\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0447\u0435\u0440\u0435\u0437 {{ countDownTimeout }} \u0441\u0435\u043A.</p>\n      }\n      <small>\u0421\u0438\u0441\u0442\u0435\u043C\u0430 \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u044E \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438, \u0435\u0441\u043B\u0438 \u044D\u0442\u043E\u0433\u043E \u043D\u0435 \u043F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u043E, \u0442\u043E\u0433\u0434\u0430 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \"\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0441\u0430\u043C\u043E\u0441\u0442\u043E\u044F\u0442\u0435\u043B\u044C\u043D\u043E\"</small>\n    </div>\n    <div class=\"sln-mfa-dialog-footer__link\">\n      <a type=\"button\" (click)=\"check()\">\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0441\u0430\u043C\u043E\u0441\u0442\u043E\u044F\u0442\u0435\u043B\u044C\u043D\u043E</a>\n    </div>\n  </div>\n</core-dialog>\n", styles: [".sln-mfa-dialog{max-width:600px}.sln-mfa-dialog small{font-size:14px}.sln-mfa-dialog p{color:var(--DARK-GREY)}.sln-mfa-dialog .success-done{margin-bottom:10px}.sln-mfa-dialog-body{margin-top:10px}.sln-mfa-dialog-footer{width:100%;display:flex;align-items:center;justify-content:space-between}.sln-mfa-dialog-footer__title{flex:1;text-align:left;font-size:13px!important;color:var(--MIDLE-GRAY)!important;width:50%}.sln-mfa-dialog-footer__link{padding-left:0}.sln-mfa-dialog-footer__link a{font-size:13px;padding-bottom:2px;line-height:120%;letter-spacing:.01em;border-bottom:1px solid;text-decoration:none;color:var(--ADD-COLOR-1);cursor:pointer}small.hint{line-height:.1em;letter-spacing:initial;font-size:.7em}hr.dotted{border-top:.1em dotted var(--DEFAULT)}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: i1$8.MatDialogRef }, { type: TwoFactorService }, { type: PopupResults }] });

// TODO поменять после перехода на use modules
class AuthorizationService {
    constructor(_dialog, _startUp, _router, _sessionStorage, _context, _ajaxM, _notificationSrv) {
        this._dialog = _dialog;
        this._startUp = _startUp;
        this._router = _router;
        this._sessionStorage = _sessionStorage;
        this._context = _context;
        this._ajaxM = _ajaxM;
        this._notificationSrv = _notificationSrv;
        this.failExecutionCount = 0;
    }
    // вход в личный кабинет (авторизация)
    login(goto, user, registerFunc, errorCallback) {
        const model = new OAuthModel(user);
        model.grant_type = 'password';
        model.client_id = this._startUp.getByKey('CLIENT_UID');
        this.loginInternal(model, () => {
            // перенаправляем пользователя на его dashboard
            this._router.navigateByUrl(goto);
        }, registerFunc, errorCallback);
    }
    twoFactorLogin(goto, user, errorCallback) {
        const model = new OAuthModel(user);
        model.grant_type = 'password';
        model.client_id = this._startUp.getByKey('CLIENT_UID');
        this.ask2Fa(user, (codeChallenge) => {
            model.code_challenge = codeChallenge;
            this.loginInternal(model, () => {
                this._router.navigateByUrl(goto);
            }, undefined, errorCallback);
        });
    }
    mobileLogin(goto, user, codeChallenge) {
        const model = new OAuthModel(user);
        model.grant_type = 'mobile';
        model.client_id = this._startUp.getByKey('CLIENT_UID');
        model.code_challenge = codeChallenge;
        this.loginInternal(model, () => {
            this._router.navigateByUrl(goto);
        });
    }
    loginShadow(user, callback) {
        const model = new OAuthModel(user);
        model.client_id = this._startUp.getByKey('CLIENT_UID');
        this.loginInternal(model, callback);
    }
    upSession(tokenResult, grantType, callback) {
        // если уже существуют куки их нужно удалить
        this._context.clearSession();
        if (grantType === 'password' || grantType == 'mobile') {
            // если прошла авторизация типа password ответ будет содержать данные пользователя который логинился
            const session = new UserSessionData();
            session.login = tokenResult.login;
            session.avatarLink = tokenResult.avatar_link;
            session.avatarColor = tokenResult.avatar_color;
            session.name = tokenResult.name;
            session.personId = tokenResult.personId;
            session.userId = tokenResult.userId;
            session.organizations = tokenResult.organizations;
            this._sessionStorage.setItem('user_session', JSON.stringify(session));
        }
        // добавляем куку об успешной авторизации (token)
        this._sessionStorage.setItem('access_token', tokenResult.access_token);
        this._context.notifySessionStarted();
        if (callback) {
            callback();
        }
    }
    loginInternal(model, callback, registerFunc, errorCalback) {
        const errors = new Array();
        const url = this._startUp.apiRoot('token', 'oauth');
        this._ajaxM
            .post({ url: url, contentType: 'application/x-www-form-urlencoded', data: model })
            .subscribe((result) => {
            if (Utility.isEmpty(result) === false) {
                if (Utility.isEmpty(result.access_token) === false) {
                    this.upSession(result, model.grant_type, callback);
                }
                else {
                    errors.push('Сервер вернул ошибку. Не удалось распознать ошибку.');
                }
            }
            else {
                errors.push('Не удалось получить ответ от сервера.');
            }
            this._handleErrors(errors, errorCalback);
        }, (error) => {
            let showError = true;
            this._ajaxM.errorHandler(error);
            if (error.error) {
                if (error.error.error === 'user_is_blocked') {
                    this._dialog.open(AuthBlockedUserInstructionDialogWindow, {
                        data: error.error.error_description
                    });
                }
                else if (registerFunc && error.error.error === 'user_not_registered') {
                    this._notificationSrv.showInfo("Операция выполняется, ожидайте...");
                    showError = false;
                    registerFunc();
                }
                else {
                    // ошибка сформированная midleware
                    errors.push(error.error.error_description);
                }
            }
            else {
                // стандартная ошибка
                errors.push(error.message);
            }
            if (showError) {
                this._handleErrors(errors, errorCalback);
            }
        });
    }
    _handleErrors(errors, func) {
        if (errors.length > 0) {
            let message = '';
            for (let i = 0; i < errors.length; i++) {
                message += errors[i] + '.';
            }
            this.failExecutionCount++;
            if (func) {
                func(message);
            }
            else {
                this._notificationSrv.showError(message);
            }
            //this._dialog.open(CoreInfoDialogWindow, { data: new InfoDiologConfig(InfoType.Danger, message)});
        }
    }
    ask2Fa(data, callback) {
        const url = this._startUp.apiRoot('mfa/check', 'oauth');
        this._ajaxM.post({ url: url, data: data }).subscribe((res) => {
            if (res.isSuccess) {
                const data = { destination: res.entity.payload };
                const dialogRef = this._dialog.open(MfaDialogWindow, {
                    data: data
                });
                const sub1 = dialogRef.afterClosed().subscribe((result) => {
                    if (result && result.state !== DialogReason.cancel && !Utility.isEmpty(result.challenge)) {
                        callback(result.challenge);
                    }
                    sub1.unsubscribe();
                });
            }
            else {
                callback();
            }
        });
    }
    // выход из личного кабинета
    logout() {
        const token = this.getToken();
        const url = this._startUp.apiRoot('session/logout', 'oauth');
        this._ajaxM.post({
            url: url,
            contentType: 'application/json',
            data: { token: token },
        }).subscribe((result) => {
            this._context.clearSession();
            this._router.navigate(['/auth/signin']);
        }, (error) => {
            console.error(error);
        });
    }
    // получение токена из cookie
    getToken() {
        const token = this._sessionStorage.getItem('access_token');
        return token;
    }
    // проверка наличия сессии
    checkSession(token, object) {
        const url = this._startUp.apiRoot('session/check', 'oauth');
        return this._ajaxM.get({
            url: url,
            data: { token: token, sysObject: object }
        });
    }
    // изменение текущей организации в рамках сессии пользователя
    changeSeessionOrgLink(token, linkId) {
        const url = this._startUp.apiRoot('session/change-org-context', 'oauth');
        return this._ajaxM.post({
            url: url,
            data: { token: token, linkId: linkId }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthorizationService, deps: [{ token: i1$8.MatDialog }, { token: Startup }, { token: i1$7.Router }, { token: BrowserLocalStorage }, { token: ContextService }, { token: AjaxService }, { token: CoreNotificationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthorizationService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AuthorizationService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }, { type: Startup }, { type: i1$7.Router }, { type: BrowserLocalStorage }, { type: ContextService }, { type: AjaxService }, { type: CoreNotificationService }] });

class LogService {
    constructor() {
        this._isDebug = window.location.host.indexOf('localhost:') > -1;
    }
    log(message) {
        if (this._isDebug) {
            console.log(message);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LogService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: LogService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [] });

class ContextService {
    get session() {
        if (!this._session) {
            this._init();
        }
        return this._session;
    }
    constructor(_storage, _logService) {
        this._storage = _storage;
        this._logService = _logService;
        /** Сброс сессии (выход, 401, очистка контекста). */
        this.sessionEnded$ = new Subject();
        /** Новая сессия установлена в хранилище (успешный login / refresh через upSession). */
        this.sessionStarted$ = new Subject();
        this._init();
    }
    _init() {
        this._session = this._storage.getTyped('user_session');
        this._logService.log('Инициализация сессии в память из LocalStorage');
    }
    isSystem() {
        return this.session?.organizations?.currentLink?.detail?.globalRoleId === RolesEnum.System;
    }
    clearSession() {
        this._session = undefined;
        if (this._storage.getItem('access_token')) {
            this._storage.clear();
        }
        this.sessionEnded$.next();
    }
    /** Вызывать после записи access_token (например из AuthorizationService.upSession). */
    notifySessionStarted() {
        if (this._storage.getItem('access_token')) {
            this.sessionStarted$.next();
        }
    }
    updateSessionPart(field, value) {
        this._session[field] = value;
        this._storage.setItem('user_session', JSON.stringify(this._session));
    }
    chageOrganization(entity) {
        if (!Utility.isEmpty(entity.token)) {
            this._storage.setItem('access_token', entity.token);
        }
        this._session.organizations = entity.link;
        this._storage.setItem('user_session', JSON.stringify(this._session));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ContextService, deps: [{ token: BrowserLocalStorage }, { token: LogService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ContextService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ContextService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: BrowserLocalStorage }, { type: LogService }] });

/*
 * Browser session storage
 */
class BrowserSessionStorage {
    constructor() {
        if (StorageCheck.storageAvailable('sessionStorage')) {
            this.storage = window.sessionStorage;
        }
    }
    get length() {
        return this.storage.length;
    }
    clear() {
        this.storage.clear();
    }
    getItem(key) {
        return this.storage.getItem(key);
    }
    key(index) {
        return this.storage.key(index);
    }
    removeItem(key) {
        this.storage.removeItem(key);
    }
    setItem(key, value) {
        this.storage.setItem(key, value);
    }
    getTyped(key) {
        const valString = this.getItem(key);
        return JSON.parse(valString);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserSessionStorage, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserSessionStorage, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserSessionStorage, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [] });
class SessionStorage extends AbstractStorage {
}

class AccessGuard {
    constructor(_router, _authService, _logM, _context, _sessionStorage) {
        this._router = _router;
        this._authService = _authService;
        this._logM = _logM;
        this._context = _context;
        this._sessionStorage = _sessionStorage;
    }
    canActivate(route, state) {
        this._logM.log('Current route:');
        this._logM.log(route);
        const token = this._authService.getToken();
        this._logM.log('Current token:');
        this._logM.log(token);
        if (Utility.isEmpty(token)) {
            this._logM.log('Local token is empty - redirect to "signin".');
            if (!Utility.isEmpty(state.url) && state.url.indexOf('signin') !== -1) {
                return false;
            }
            this._sessionStorage.setItem('returnUrl', state.url);
            this._router.navigate(['/auth/signin'], { queryParams: { returnUrl: state.url } });
            return false;
        }
        this._logM.log('Local token is not empty - check session on server side.');
        let sysObject = route.data['sysObject'];
        this._logM.log('Active url: ' + state.url);
        this._logM.log('Current system object:');
        this._logM.log(sysObject);
        if (Utility.isEmpty(sysObject)) {
            sysObject = route.params['systemObjectId'];
            this._logM.log('Current system object:');
            this._logM.log(sysObject);
        }
        return this._authService.checkSession(token, sysObject).pipe(map((e) => {
            this._logM.log('Server response:');
            this._logM.log(e);
            if (e.isSuccess) {
                if (Utility.isEmpty(e.message)) {
                    this._logM.log('Go to address: ' + state.url);
                    return true;
                }
                else {
                    this._router.navigate(['/forbidden']);
                    return false;
                }
            }
            else {
                if (e.message.indexOf('View') !== -1) {
                    this._router.navigate(['forbidden']);
                }
                else {
                    this._logM.log('Ops... not success. Clean session cookie and redirect to signin');
                    this._context.clearSession();
                    this._router.navigate(['/auth/signin'], { queryParams: { returnUrl: state.url } });
                }
            }
            return false;
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AccessGuard, deps: [{ token: i1$7.Router }, { token: AuthorizationService }, { token: LogService }, { token: ContextService }, { token: BrowserSessionStorage }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AccessGuard }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AccessGuard, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1$7.Router }, { type: AuthorizationService }, { type: LogService }, { type: ContextService }, { type: BrowserSessionStorage }] });

class UnauthorizedInterceptor {
    constructor(_router, _injector) {
        this._router = _router;
        this._injector = _injector;
    }
    intercept(request, next) {
        return next.handle(request).pipe(catchError(response => {
            if (response instanceof HttpErrorResponse) {
                return this.handleAuthError(response);
            }
            return throwError(() => response);
        }));
    }
    handleAuthError(err) {
        // обрабатываем ошибку авторизации
        if (err.status === 401) {
            const context = this._injector.get(ContextService);
            // очищаем cookies и направляем на страницу авторизации
            context.clearSession();
            this._router.navigate(['/auth/signin'], { queryParams: { returnUrl: this._router.routerState.snapshot.url } });
            return of(err.message);
        }
        // обрабатываем ошибку доступа или же бросаем новую ошибку
        if (err.status == 403) {
            this._router.navigate(['forbidden']);
        }
        return throwError(() => err);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: UnauthorizedInterceptor, deps: [{ token: i1$7.Router }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: UnauthorizedInterceptor }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: UnauthorizedInterceptor, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1$7.Router }, { type: i0.Injector }] });

const DEFAULT_COUNTER_ID_AOT = new InjectionToken('DEFAULT_COUNTER_ID_AOT');
const DEFAULT_COUNTER_ID = new InjectionToken('DEFAULT_COUNTER_ID');
const YANDEX_COUNTERS_CONFIGS_AOT = new InjectionToken('YANDEX_COUNTERS_CONFIGS_AOT');
const YANDEX_COUNTERS_CONFIGS = new InjectionToken('YANDEX_COUNTERS_CONFIGS');
class YandexCounterConfig {
    constructor() {
        this.clickmap = true;
        this.trackLinks = true;
        this.accurateTrackBounce = true;
        this.webvisor = false;
        this.trackHash = true;
        this.ut = 'noindex';
    }
}

function defaultCounterIdFactory(counterConfigs, defaultCounter) {
    return defineDefaultId(counterConfigs, defaultCounter);
}
function defineDefaultId(counterConfigs, defaultCounter) {
    let configs;
    if (counterConfigs instanceof Array) {
        configs = counterConfigs;
    }
    else {
        configs = [counterConfigs];
    }
    let defaultId;
    if (!defaultCounter) {
        defaultId = configs[0].id;
    }
    else if (typeof defaultCounter === 'number' && defaultCounter < configs.length) {
        defaultId = configs[defaultCounter].id;
    }
    else {
        defaultId = defaultCounter;
    }
    if (!defaultId) {
        console.warn('You provided wrong counter id as a default:', defaultCounter);
        return;
    }
    let defaultCounterExists = false;
    let config;
    for (let i = 0; i < configs.length; i++) {
        config = configs[i];
        if (!config.id) {
            console.warn('You should provide counter id to use Yandex metrika counter', config);
            continue;
        }
        if (config.id === defaultId) {
            defaultCounterExists = true;
        }
    }
    if (!defaultCounterExists) {
        console.warn('You provided wrong counter id as a default:', defaultCounter);
    }
    return defaultId;
}
function countersFactory(configs) {
    return createConfigs(configs);
}
function createConfigs(configs) {
    let counterConfigs;
    if (configs instanceof Array) {
        counterConfigs = configs;
    }
    else {
        counterConfigs = [configs];
    }
    return counterConfigs.map((config) => Object.assign(new YandexCounterConfig(), config));
}
function appInitializerFactory(counterConfigs, platformId) {
    if (isPlatformBrowser(platformId)) {
        return insertMetrika(counterConfigs);
    }
    return () => 'none';
}
function insertMetrika(counterConfigs) {
    const name = 'yandex_metrika_callbacks2';
    window[name] = window[name] || [];
    window[name].push(() => {
        try {
            for (const config of counterConfigs) {
                createCounter(config);
            }
        }
        catch (e) { }
    });
    const n = document.getElementsByTagName('script')[0];
    const s = document.createElement('script');
    s.type = 'text/javascript';
    s.async = true;
    const alternative = counterConfigs.find(config => config.alternative);
    if (alternative) {
        s.src = 'https://cdn.jsdelivr.net/npm/yandex-metrica-watch/tag.js';
    }
    else {
        s.src = 'https://mc.yandex.ru/metrika/tag.js';
    }
    const insetScriptTag = () => n.parentNode.insertBefore(s, n);
    if (window.opera === '[object Opera]') {
        document.addEventListener('DOMContentLoaded', insetScriptTag, false);
    }
    else {
        insetScriptTag();
    }
    return name;
}
function createCounter(config) {
    window[getCounterNameById(config.id)] = new Ya.Metrika2(config);
}
function getCounterNameById(id) {
    return `yaCounter${id}`;
}

class Metrika {
    static getCounterNameById(id) {
        return `yaCounter${id}`;
    }
    static getCounterById(id) {
        return window[Metrika.getCounterNameById(id)];
    }
    constructor(injector) {
        this.defaultCounterId = injector.get(DEFAULT_COUNTER_ID);
        this.counterConfigs = injector.get(YANDEX_COUNTERS_CONFIGS);
        this.positionToId = this.counterConfigs.map(config => config.id);
    }
    async addFileExtension(extensions, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            counter.addFileExtension(extensions);
        }
        catch (error) {
            console.warn('Counter is still loading');
        }
    }
    async extLink(url, options = {}, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            const promise = this.getCallbackPromise(options, url);
            counter.extLink(url, options);
            return promise;
        }
        catch (error) {
            console.warn('Counter is still loading');
        }
    }
    async file(url, options = {}, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            const promise = this.getCallbackPromise(options, url);
            counter.file(url, options);
            return promise;
        }
        catch (error) {
            console.warn('Counter is still loading');
        }
    }
    getClientID(counterPosition) {
        const counter = this.getCounterByPosition(counterPosition);
        if (counter && counter.reachGoal) {
            return counter.getClientID();
        }
        console.warn('Counter is still loading');
    }
    async setUserID(userId, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            counter.setUserID(userId);
            return { userId, counterPosition };
        }
        catch (error) {
            console.warn('Counter is still loading');
        }
    }
    async userParams(params, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            counter.userParams(params);
            return { params, counterPosition };
        }
        catch (error) {
            console.warn('Counter is still loading');
        }
    }
    async params(params, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            counter.params(params);
            return { params, counterPosition };
        }
        catch (error) {
            console.warn('Counter is still loading');
        }
    }
    async replacePhones(counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            counter.replacePhones();
            return { counterPosition };
        }
        catch (error) {
            console.warn('Counter is still loading');
        }
    }
    async notBounce(options = {}, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            const promise = this.getCallbackPromise(options, options);
            counter.notBounce(options);
            return promise;
        }
        catch (error) {
            console.warn('Counter is still loading');
        }
    }
    async fireEvent(type, options = {}, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            const promise = this.getCallbackPromise(options, options);
            counter.reachGoal(type, options.params, options.callback, options.ctx);
            return promise;
        }
        catch (error) {
            console.error('error', error);
            console.warn(`'Event with type [${type}] can\'t be fired because counter is still loading'`);
        }
    }
    async hit(url, options = {}, counterPosition) {
        try {
            const counter = await this.counterIsLoaded(counterPosition);
            const promise = this.getCallbackPromise(options, options);
            counter.hit(url, options);
            return promise;
        }
        catch (error) {
            console.warn(`'Hit for page [${url}] can\'t be fired because counter is still loading'`);
        }
    }
    getCallbackPromise(options, resolveWith) {
        return new Promise((resolve, reject) => {
            const optionsCallback = options.callback;
            options.callback = function () {
                if (optionsCallback) {
                    optionsCallback.call(this);
                }
                resolve(resolveWith);
            };
        });
    }
    counterIsLoaded(counterPosition) {
        const counter = this.getCounterByPosition(counterPosition);
        if (counter && counter.reachGoal) {
            return Promise.resolve(counter);
        }
        else {
            return Promise.reject(counter);
        }
    }
    getCounterByPosition(counterPosition) {
        const counterId = this.getCounterIdByPosition(counterPosition);
        return Metrika.getCounterById(counterId);
    }
    getCounterIdByPosition(counterPosition) {
        return (counterPosition === undefined)
            ? this.defaultCounterId
            : this.positionToId[counterPosition];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: Metrika, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: Metrika, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: Metrika, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

/* модуль взять https://www.npmjs.com/package/ng-yandex-metrika, адаптирован под наши потребности */
class MetrikaModule {
    static forRoot(configs, defaultCounterId) {
        return {
            ngModule: MetrikaModule,
            providers: [
                {
                    provide: DEFAULT_COUNTER_ID_AOT,
                    useValue: defaultCounterId,
                },
                {
                    provide: YANDEX_COUNTERS_CONFIGS_AOT,
                    useValue: configs,
                },
                {
                    provide: DEFAULT_COUNTER_ID,
                    useFactory: defaultCounterIdFactory,
                    deps: [YANDEX_COUNTERS_CONFIGS_AOT, DEFAULT_COUNTER_ID_AOT],
                },
                {
                    provide: YANDEX_COUNTERS_CONFIGS,
                    useFactory: countersFactory,
                    deps: [YANDEX_COUNTERS_CONFIGS_AOT],
                },
                {
                    provide: Metrika,
                    useClass: Metrika,
                    deps: [Injector, PLATFORM_ID],
                }
            ],
        };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MetrikaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: MetrikaModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MetrikaModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MetrikaModule, decorators: [{
            type: NgModule,
            args: [{}]
        }] });

class FederationLoader {
    static { this._moduleCache = new Map(); }
    static async load(entity) {
        const cacheKey = `${entity.remoteName}:${entity.remoteExposedModule}`;
        let module;
        if (FederationLoader._moduleCache.has(cacheKey)) {
            module = FederationLoader._moduleCache.get(cacheKey);
        }
        else {
            module = await loadRemoteModule({
                remoteName: entity.remoteName,
                exposedModule: entity.remoteExposedModule
            });
            FederationLoader._moduleCache.set(cacheKey, module);
        }
        return module;
    }
}

class FederationEntity {
}

class Pair {
    constructor(key, value) {
        this.key = key;
        this.value = value;
    }
}
class TPair {
    constructor(key, value) {
        this.key = key;
        this.value = value;
    }
}

class ArrayExtension {
    static isEquals(first, second) {
        return JSON.stringify(first) === JSON.stringify(second);
        if (!first || !second) {
            return false;
        }
        if (first.length !== second.length) {
            return false;
        }
        for (let i = 0, l = first.length; i < l; i++) {
            if (first[i] instanceof Array && second[i] instanceof Array) {
                if (!first[i].equals(second[i])) {
                    return false;
                }
            }
            else {
                if (first[i] !== second[i]) {
                    return false;
                }
            }
        }
        return true;
    }
    static distinct(array) {
        return array.filter((item, index) => array.indexOf(item) === index);
    }
    static distinctBy(array, key) {
        return array.filter((item, index) => array.findIndex(x => x[key] === item[key]) === index);
    }
}

class ObjectExtension {
    // мерж двух объектов
    // если поля дублируются в базовом и расширяющем объекте, то записываются значения расширающего объекта в смежные поля
    static extend(base, extend) {
        const obj = {};
        const prpBases = Object.getOwnPropertyNames(base);
        for (let i = 0; i < prpBases.length; i++) {
            obj[prpBases[i]] = base[prpBases[i]];
        }
        const prpExtends = Object.getOwnPropertyNames(extend);
        for (let i = 0; i < prpExtends.length; i++) {
            obj[prpExtends[i]] = extend[prpExtends[i]];
        }
        return obj;
    }
}

class NumberExtension {
    static toRub(val) {
        if (val === null) {
            return '0 р.';
        }
        val = Math.round(val * 100) / 100;
        let text = val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ').replace('.', ',');
        if (text.indexOf(',') === -1) {
            text += ',00';
        }
        else {
            if ((text.split(',')[1]).length === 1) {
                text += '0';
            }
        }
        return text + ' p.';
    }
    static toPercent(val) {
        return val !== undefined ? val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ').replace('.', ',') + '%' : '';
    }
}

class CoreUrlSerializer {
    parse(url) {
        const dus = new DefaultUrlSerializer();
        return dus.parse(unescape(url));
    }
    serialize(tree) {
        const dus = new DefaultUrlSerializer();
        return dus.serialize(tree);
    }
}

var AvatarEntity;
(function (AvatarEntity) {
    AvatarEntity[AvatarEntity["User"] = 1] = "User";
    AvatarEntity[AvatarEntity["Chat"] = 2] = "Chat";
})(AvatarEntity || (AvatarEntity = {}));
class CoreAvatarService {
    constructor(_ajaxM, _startM) {
        this._ajaxM = _ajaxM;
        this._startM = _startM;
    }
    // загрузка аватара
    avatarUpload(type, objectId, uploadFile) {
        // post
        const url = type === AvatarEntity.User
            ? this._startM.apiRoot('users/' + objectId + '/avatar/upload', 'core')
            : this._startM.apiRoot('chat/room/avatar/upload?roomId=' + objectId, 'core');
        return this._ajaxM.post({ url: url, data: uploadFile });
    }
    // удаление аватара
    avatarRemove(type, objectId) {
        // post
        const url = type === AvatarEntity.User
            ? this._startM.apiRoot('users/' + objectId + '/avatar/remove', 'core')
            : this._startM.apiRoot('chat/room/avatar/remove?roomId=' + objectId, 'core');
        return this._ajaxM.post({ url: url });
    }
    // установка случайного цвета фона
    avatarBackground(type, objectId) {
        // post
        const url = type === AvatarEntity.User
            ? this._startM.apiRoot('users/' + objectId + '/avatar/background', 'core')
            : this._startM.apiRoot('chat/room/avatar/background?roomId=' + objectId, 'core');
        return this._ajaxM.post({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAvatarService, deps: [{ token: AjaxService }, { token: Startup }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAvatarService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAvatarService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: AjaxService }, { type: Startup }] });

class CrudService {
    constructor(controller, app, _startUp, _ajaxM) {
        this.controller = controller;
        this.app = app;
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    getDataSourceItems(query, params) {
        // get
        const entityId = Utility.isEmpty(params) || Utility.isEmpty(params.entityId) ? undefined : params.entityId;
        const url = Utility.isEmpty(entityId)
            ? this._startUp.apiRoot(this.controller, this.app) + '?' + query
            : this._startUp.apiRoot(this.controller + '/' + entityId, this.app) + '?' + query;
        return this._ajaxM.get({ url: url });
    }
    getSingle(itemId) {
        // get
        const url = this._startUp.apiRoot(this.controller + '/' + itemId, this.app);
        return this._ajaxM.get({ url: url });
    }
    // сохранение записи
    save(item) {
        // post
        const url = this._startUp.apiRoot(this.controller, this.app);
        return this._ajaxM.post({ url: url, data: item });
    }
    // активация / деактивация записи
    ban(itemId) {
        // post
        const url = this._startUp.apiRoot(this.controller + '/ban', this.app);
        return this._ajaxM.post({ url: url, data: { id: itemId } });
    }
    // удаление записи
    remove(itemId) {
        // delete
        const url = this._startUp.apiRoot(this.controller, this.app) + '/' + itemId;
        return this._ajaxM.delete({ url: url });
    }
}

class EventListener {
    constructor(_subscription) {
        this._subscription = _subscription;
    }
    ignore() {
        this._subscription.unsubscribe();
    }
}
class BrokeredEvent {
    constructor(name) {
        this.name = name;
        this._subject = new Subject();
    }
    emit(data) {
        this._subject.next(data);
    }
    listen(next) {
        return new EventListener(this._subject.subscribe(next));
    }
}
class EventBrokerService {
    constructor(_store) {
        this._store = _store;
        this._storageKeyPrefix = 'event-broker:last-event:';
        this._ttlMs = 60_000; // 1 minute
        this._events = {};
        this._clearStoredEvents();
    }
    _clearStoredEvents() {
        try {
            const toRemove = [];
            for (let i = 0; i < this._store.length; i++) {
                const key = this._store.key(i);
                if (key && key.startsWith(this._storageKeyPrefix)) {
                    toRemove.push(key);
                }
            }
            toRemove.forEach(k => this._store.removeItem(k));
        }
        catch {
            // ignore
        }
    }
    _register(eventName) {
        var event = this._events[eventName];
        if (typeof event === 'undefined') {
            event = this._events[eventName] = new BrokeredEvent(eventName);
        }
        return event;
    }
    _getStorageKey(eventName) {
        return `${this._storageKeyPrefix}${eventName}`;
    }
    _writeLastEvent(eventName, data) {
        const key = this._getStorageKey(eventName);
        const payload = {
            timestamp: Date.now(),
            data
        };
        try {
            this._store.setItem(key, JSON.stringify(payload));
        }
        catch {
            // ignore
        }
    }
    _readLastEvent(eventName) {
        const key = this._getStorageKey(eventName);
        try {
            const raw = this._store.getItem(key);
            if (!raw) {
                return null;
            }
            const parsed = JSON.parse(raw);
            if (!parsed?.timestamp) {
                this._store.removeItem(key);
                return null;
            }
            const isExpired = Date.now() - parsed.timestamp > this._ttlMs;
            if (isExpired) {
                this._store.removeItem(key);
                return null;
            }
            return parsed.data;
        }
        catch {
            // на любой ошибке очищаем возможный мусор
            try {
                this._store.removeItem(key);
            }
            catch {
                // ignore
            }
            return null;
        }
    }
    listen(eventName, next) {
        const listener = this._register(eventName).listen(next);
        // проверяем, есть ли сохранённое событие
        const lastEvent = this._readLastEvent(eventName);
        if (lastEvent !== null && lastEvent !== undefined) {
            // синхронно отправляем последнему подключившемуся слушателю
            next(lastEvent);
        }
        return listener;
    }
    emit(eventName, data) {
        // сохраняем последнее событие в пределах TTL
        this._writeLastEvent(eventName, data);
        return this._register(eventName).emit(data);
    }
    /**
     * DOM-based event exchange: dispatch CustomEvent on target (window by default)
     */
    emitDom(eventName, data, target = window) {
        // также сохраняем последнее событие в store для отложенных DOM-подписчиков
        this._writeLastEvent(eventName, data);
        const event = new CustomEvent(eventName, { detail: data });
        target.dispatchEvent(event);
    }
    /**
     * DOM-based event exchange: listen CustomEvent from target (window by default)
     */
    listenDom(eventName, next, target = window) {
        const handler = (event) => {
            const custom = event;
            next(custom.detail);
        };
        target.addEventListener(eventName, handler);
        const subscription = new Subscription(() => {
            target.removeEventListener(eventName, handler);
        });
        const listener = new EventListener(subscription);
        // сразу после подписки проверяем наличие последнего события в store
        const lastEvent = this._readLastEvent(eventName);
        if (lastEvent !== null && lastEvent !== undefined) {
            next(lastEvent);
        }
        return listener;
    }
    /**
     * Очистить сохранённое событие из sessionStorage для конкретного события
     * @param eventName - имя события для очистки
     */
    clearStoredEvent(eventName) {
        const key = this._getStorageKey(eventName);
        try {
            this._store.removeItem(key);
        }
        catch {
            // ignore
        }
    }
    /**
     * Очистить все сохранённые события из sessionStorage
     */
    clearAllStoredEvents() {
        this._clearStoredEvents();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: EventBrokerService, deps: [{ token: BrowserSessionStorage }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: EventBrokerService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: EventBrokerService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: BrowserSessionStorage }] });

// сервис управления блокировкой кнопки
class ButtonLoadingService {
    // запустить блокировку
    static run(target) {
        target.disabled = true;
        if (target.children.length > 0) {
            for (let i = 0; i < target.children.length; i++) {
                if (target.children[i].tagName === 'DIV') {
                    target.children[i].hidden = false;
                }
            }
        }
    }
    // остановить блокировку
    static stop(target) {
        target.disabled = false;
        if (target.children.length > 0) {
            for (let i = 0; i < target.children.length; i++) {
                if (target.children[i].tagName === 'DIV') {
                    target.children[i].hidden = true;
                }
            }
        }
    }
}

class MfaProviderService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    getBalance() {
        const url = this._startUp.apiRoot('mfa/balance', 'core');
        return this._ajaxM.get({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MfaProviderService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MfaProviderService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MfaProviderService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class DynamicThemeService {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DynamicThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DynamicThemeService, providedIn: "root" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DynamicThemeService, decorators: [{
            type: Injectable,
            args: [{ providedIn: "root" }]
        }] });

class SignalMainModel {
}
class SignalBaseService {
    //isRecieve: ReplaySubject<any> = new ReplaySubject<any>();
    getHubUrl(userId) { throw Error('Не указан URL для подключения к сокету. Signal-R не будет работать.'); }
    onReconnected() { return undefined; }
    onReconnectedLogic() { return undefined; }
    onReceived() { return undefined; }
    onSent() { return undefined; }
    onSentFail() { return undefined; }
    onCantSent() { return undefined; }
    stopConnection() {
        if (!this._hubConnection) {
            return;
        }
        const hub = this._hubConnection;
        this._hubConnection = undefined;
        hub.stop().catch(() => undefined);
    }
    startConnection(userId) {
        this._hubConnection = new window.signalR.HubConnectionBuilder()
            .withUrl(this.getHubUrl(userId), {
            skipNegotiation: true,
            transport: window.signalR.HttpTransportType.WebSockets
        })
            .withAutomaticReconnect()
            .build();
        const onReconnectedFunc = this.onReconnected();
        if (onReconnectedFunc) {
            this._hubConnection.onreconnected(data => onReconnectedFunc(data));
        }
        if (this._hubConnection.state == window.signalR.HubConnectionState.Disconnected) {
            this._hubConnection
                .start()
                .then(() => console.log('Connection started'))
                .catch(err => console.log('Error while starting connection: ' + err));
            setTimeout(() => this.checkAndStartConnection(), 3000);
        }
    }
    checkAndStartConnection() {
        if (this._hubConnection.state == window.signalR.HubConnectionState.Disconnected) {
            this._hubConnection.start().catch((err) => {
                console.error('Error while attempting to start connection: ' + err);
            });
        }
        const onReconnectedLogicFunc = this.onReconnectedLogic();
        if (onReconnectedLogicFunc) {
            onReconnectedLogicFunc();
        }
    }
    sendToHub(dto, method = 'Notification', canSend = false) {
        if (canSend) {
            if (this._hubConnection.state == window.signalR.HubConnectionState.Connected) {
                this._hubConnection.send(method, dto).then(() => {
                    const onSentFunc = this.onSent();
                    if (onSentFunc) {
                        onSentFunc(dto);
                    }
                }).catch(i => {
                    const onSentFailFunc = this.onSentFail();
                    if (onSentFailFunc) {
                        onSentFailFunc(dto);
                    }
                });
            }
            else {
                const onSentFailFunc = this.onSentFail();
                if (onSentFailFunc) {
                    onSentFailFunc(dto);
                }
            }
            return;
        }
        const onCantSentFunc = this.onCantSent();
        if (onCantSentFunc) {
            onCantSentFunc(dto);
        }
        this.checkAndStartConnection();
    }
    addListener(target, callback) {
        this.checkAndStartConnection();
        this._hubConnection.on(target, (data) => {
            const packageData = JSON.parse(data.json);
            const onReceivedFunc = this.onReceived();
            if (onReceivedFunc) {
                onReceivedFunc(packageData);
            }
            callback(packageData);
            //this.isRecieve.next(data);
        });
    }
}

/** Событие: переключить вкладку, в которой есть невалидный контрол (см. data-sln-invalid-form-tab-id на предке). */
const SLN_INVALID_FORM_TAB_ACTIVATE_EVENT = 'sln-invalid-form-tab-activate';
class InvalidFormService {
    invalidFormLogicCall(containerSelector) {
        const searchRoot = this.getSearchRoot(containerSelector);
        const invalidControls = Array.from(searchRoot.querySelectorAll('.ng-invalid:not(form)'));
        const invalidInputForHighlight = invalidControls.find((el) => this.isVisible(el)) ?? invalidControls[0];
        if (invalidInputForHighlight) {
            const hasCollapsedExpansionPanels = this.expandCollapsedExpansionPanels(invalidInputForHighlight);
            const mustDeferHighlight = !this.isVisible(invalidInputForHighlight);
            if (mustDeferHighlight) {
                this.dispatchInvalidFormTabActivate(invalidInputForHighlight);
            }
            if (mustDeferHighlight || hasCollapsedExpansionPanels) {
                this.scheduleHighlight(invalidInputForHighlight);
            }
            else {
                this.applyHighlightAndShake(invalidInputForHighlight);
            }
        }
        return this.getInvalidControlNames(invalidControls) ?? [];
    }
    getSearchRoot(containerSelector) {
        if (!containerSelector?.trim()) {
            return document;
        }
        try {
            return document.querySelector(containerSelector) ?? document;
        }
        catch {
            return document;
        }
    }
    isVisible(el) {
        if (!el)
            return false;
        if (el.disabled === true)
            return false;
        const style = window.getComputedStyle(el);
        if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0')
            return false;
        return el.getClientRects().length > 0;
    }
    dispatchInvalidFormTabActivate(sourceElement) {
        const holder = sourceElement.closest('[data-sln-invalid-form-tab-id]');
        const tabId = holder?.getAttribute('data-sln-invalid-form-tab-id')?.trim();
        if (!tabId || !holder) {
            return;
        }
        document.dispatchEvent(new CustomEvent(SLN_INVALID_FORM_TAB_ACTIVATE_EVENT, {
            bubbles: true,
            cancelable: false,
            detail: { tabId, sourceElement },
        }));
    }
    scheduleHighlight(invalidInput) {
        requestAnimationFrame(() => {
            requestAnimationFrame(() => {
                // Учитываем анимацию раскрытия mat-expansion-panel перед скроллом/фокусом.
                setTimeout(() => this.applyHighlightAndShake(invalidInput), 250);
            });
        });
    }
    expandCollapsedExpansionPanels(sourceElement) {
        const collapsedPanels = this.getAncestorExpansionPanels(sourceElement)
            .filter((panel) => !this.isExpansionPanelExpanded(panel));
        collapsedPanels.forEach((panel) => this.openExpansionPanel(panel));
        return collapsedPanels.length > 0;
    }
    getAncestorExpansionPanels(sourceElement) {
        const panels = [];
        let parent = sourceElement.parentElement;
        while (parent) {
            if (parent.tagName.toLowerCase() === 'mat-expansion-panel') {
                panels.unshift(parent);
            }
            parent = parent.parentElement;
        }
        return panels;
    }
    isExpansionPanelExpanded(panel) {
        if (panel.classList.contains('mat-expanded')) {
            return true;
        }
        const header = panel.querySelector('mat-expansion-panel-header');
        return header?.getAttribute('aria-expanded') === 'true';
    }
    openExpansionPanel(panel) {
        const header = panel.querySelector('mat-expansion-panel-header');
        if (header) {
            header.click();
        }
    }
    getInvalidFormHost(el) {
        return (el.closest('core-field-identification-doc') ||
            el.closest('core-field-license') ||
            el.closest('core-field-organization') ||
            el.closest('core-field-requisite') ||
            el.closest('core-file-uploader') ||
            el.closest('core-field-bool') ||
            el.closest('core-field-multiple-combobox') ||
            el.closest('core-field-combobox') ||
            el.closest('mat-form-field') ||
            el);
    }
    getInvalidFormTabLabel(repElement) {
        const holder = repElement.closest('[data-sln-invalid-form-tab-label]');
        const label = holder?.getAttribute('data-sln-invalid-form-tab-label')?.trim();
        return label?.length ? label : null;
    }
    /**
     * Если невалидный контрол внутри строки правила (.sln-invalid-rule-row) и у строки задан атрибут label,
     * наименование для списка ошибок берётся из него; иначе возвращается null — дальше сработает обычная логика.
     */
    getInvalidNameFromRuleRowLabel(repEl, host) {
        const row = repEl.closest('.sln-invalid-rule-row') ??
            host.closest('.sln-invalid-rule-row');
        const raw = row?.getAttribute('label');
        if (raw == null) {
            return null;
        }
        const trimmed = raw.trim().replace(/\s+/g, ' ');
        return trimmed.length > 0 ? trimmed : null;
    }
    getInvalidControlNames(invalidControls) {
        const hostToRepEl = new Map();
        invalidControls.forEach((el) => {
            const host = this.getInvalidFormHost(el);
            if (!hostToRepEl.has(host)) {
                hostToRepEl.set(host, el);
            }
        });
        const getHostName = (host) => {
            const uploader = host.closest('core-file-uploader');
            if (uploader) {
                const h3 = uploader.querySelector('h3');
                const text = (h3?.textContent ?? uploader.textContent ?? '').trim();
                return text.replace(/\s+/g, ' ').replace('*', '').trim();
            }
            const boolHost = host.closest('core-field-bool');
            if (boolHost) {
                const optTitle = boolHost.querySelector('.sln-control-bool');
                const checkboxText = boolHost.querySelector('mat-checkbox span');
                const slideLabel = boolHost.querySelector('.sln-mat-slide-toggle-label');
                const text = (optTitle?.textContent ?? checkboxText?.textContent ?? slideLabel?.textContent ?? boolHost.textContent ?? '').trim();
                return text.replace(/\s+/g, ' ').replace(/\*/g, '').trim();
            }
            const innerMatLabel = host.querySelector('mat-label');
            if (innerMatLabel?.textContent?.trim()) {
                return innerMatLabel.textContent.trim();
            }
            const complexTitle = host.querySelector('.sln-complex-field__title');
            if (complexTitle?.textContent?.trim()) {
                return complexTitle.textContent.replace(/\s+/g, ' ').replace(/\*/g, '').trim();
            }
            const matField = host.closest('mat-form-field');
            if (matField) {
                const label = matField.querySelector('mat-label');
                const labelText = label?.textContent?.trim();
                if (labelText)
                    return labelText;
                const input = matField.querySelector('input[placeholder], textarea[placeholder]');
                const placeholder = input?.getAttribute?.('placeholder');
                if (placeholder)
                    return placeholder;
            }
            const placeholder = host.getAttribute('placeholder');
            if (placeholder)
                return placeholder;
            return null;
        };
        const seen = new Set();
        const result = [];
        hostToRepEl.forEach((repEl, host) => {
            const name = this.getInvalidNameFromRuleRowLabel(repEl, host) ?? getHostName(host);
            if (!name?.trim()) {
                return;
            }
            const tabLabel = this.getInvalidFormTabLabel(repEl);
            const display = tabLabel ? `${tabLabel}: ${name}` : name;
            if (seen.has(display)) {
                return;
            }
            seen.add(display);
            result.push(display);
        });
        return result;
    }
    applyHighlightAndShake(invalidInput) {
        const descendantRuleRows = Array.from(invalidInput.querySelectorAll('.sln-invalid-rule-row'));
        const visibleDescendantRuleRow = descendantRuleRows.find(r => this.isVisible(r)) ?? null;
        const closestRuleRow = invalidInput.closest('.sln-invalid-rule-row');
        const ruleRow = (closestRuleRow && this.isVisible(closestRuleRow) ? closestRuleRow : null) ?? visibleDescendantRuleRow;
        const coreFieldHost = invalidInput.closest('core-field-number, core-field-string, core-field-date, core-field-textarea, core-field-combobox, core-field-multiple-combobox, core-field-email, core-field-phone');
        const coreFieldMatFormField = coreFieldHost?.querySelector('mat-form-field');
        const complexFieldHost = invalidInput.closest('core-field-identification-doc, core-field-license, core-field-organization, core-field-requisite, core-field-address');
        const complexFieldContainer = complexFieldHost?.querySelector('.complex-field');
        const elementToHighlight = ruleRow ||
            coreFieldMatFormField ||
            coreFieldHost ||
            complexFieldContainer ||
            complexFieldHost ||
            invalidInput.closest('mat-form-field') ||
            invalidInput.closest('core-field-combobox') ||
            invalidInput.closest('core-file-uploader') ||
            invalidInput;
        const highlightTargets = new Set();
        highlightTargets.add(elementToHighlight);
        if (coreFieldHost) {
            highlightTargets.add(coreFieldHost);
        }
        if (coreFieldMatFormField) {
            highlightTargets.add(coreFieldMatFormField);
        }
        if (complexFieldHost) {
            highlightTargets.add(complexFieldHost);
        }
        if (complexFieldContainer) {
            highlightTargets.add(complexFieldContainer);
        }
        const comboboxHost = invalidInput.closest('core-field-combobox');
        if (comboboxHost) {
            highlightTargets.add(comboboxHost);
        }
        const multipleComboboxHost = invalidInput.closest('core-field-multiple-combobox');
        if (multipleComboboxHost) {
            highlightTargets.add(multipleComboboxHost);
        }
        const uploaderHost = invalidInput.closest('core-file-uploader');
        if (uploaderHost) {
            highlightTargets.add(uploaderHost);
        }
        const boolHost = invalidInput.closest('core-field-bool');
        if (boolHost) {
            highlightTargets.add(boolHost);
        }
        const datetimeFormField = elementToHighlight.closest('mat-form-field.sln-datetime')
            ?? invalidInput.closest('mat-form-field.sln-datetime');
        if (datetimeFormField) {
            const hiddenDateInput = datetimeFormField.querySelector('input.sln-date-input');
            const maskedDateInput = datetimeFormField.querySelector('input.sln-date-masked-input');
            if (hiddenDateInput)
                highlightTargets.add(hiddenDateInput);
            if (maskedDateInput)
                highlightTargets.add(maskedDateInput);
        }
        elementToHighlight.scrollIntoView({ behavior: 'smooth', block: 'center' });
        highlightTargets.forEach(t => t.classList.add('shake-animation'));
        const formField = elementToHighlight.closest('mat-form-field');
        let focusTarget = (this.isVisible(invalidInput) ? invalidInput : null);
        if (!focusTarget && datetimeFormField) {
            focusTarget = datetimeFormField.querySelector('input.sln-date-masked-input');
        }
        if (!focusTarget) {
            focusTarget =
                formField?.querySelector('input:not([type="hidden"]), textarea, mat-select') ||
                    coreFieldHost?.querySelector('input:not([type="hidden"]), textarea, mat-select') ||
                    complexFieldHost?.querySelector('button') ||
                    formField?.querySelector('input.sln-date-masked-input');
        }
        if (focusTarget && typeof focusTarget.focus === 'function') {
            focusTarget.focus();
        }
        setTimeout(() => highlightTargets.forEach(t => t.classList.remove('shake-animation')), 1000);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: InvalidFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: InvalidFormService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: InvalidFormService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }] });

/**
 * Cookie Storage
 */
class BrowserCookieStorage {
    constructor(document) {
        this.document = document;
        this.documentIsAccessible = document !== undefined;
    }
    get length() {
        return this._getCookieArray()?.length ?? 0;
    }
    check(name) {
        if (!this.documentIsAccessible) {
            return false;
        }
        name = encodeURIComponent(name);
        const regExp = this._getCookieRegExp(name);
        const exists = regExp.test(this.document.cookie);
        return exists;
    }
    getItem(name) {
        if (this.documentIsAccessible && this.check(name)) {
            name = encodeURIComponent(name);
            const regExp = this._getCookieRegExp(name);
            const result = regExp.exec(this.document.cookie);
            return decodeURIComponent(result[1]);
        }
        else {
            return '';
        }
    }
    getTyped(key) {
        const valString = this.getItem(key);
        return JSON.parse(valString);
    }
    getAll() {
        if (!this.documentIsAccessible) {
            return {};
        }
        const cookies = {};
        const split = this._getCookieArray();
        for (let i = 0; i < split.length; i += 1) {
            const currentCookie = split[i].split('=');
            currentCookie[0] = currentCookie[0].replace(/^ /, '');
            cookies[decodeURIComponent(currentCookie[0])] = decodeURIComponent(currentCookie[1]);
        }
        return cookies;
    }
    key(index) {
        throw Error('Not implemented');
    }
    setItem(name, value, expires, path, domain, secure) {
        if (!this.documentIsAccessible) {
            return;
        }
        let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
        if (expires) {
            if (typeof expires === 'number') {
                const dateExpires = new Date(new Date().getTime() + expires * 1000);
                cookieString += 'expires=' + dateExpires.toUTCString() + ';';
            }
            else {
                cookieString += 'expires=' + expires.toUTCString() + ';';
            }
        }
        if (path) {
            cookieString += 'path=' + path + ';';
        }
        if (domain) {
            cookieString += 'domain=' + domain + ';';
        }
        if (secure) {
            cookieString += 'secure;';
        }
        this.document.cookie = cookieString;
    }
    removeItem(name, path, domain) {
        if (!this.documentIsAccessible) {
            return;
        }
        this.setItem(name, '', -1, path, domain);
    }
    clear(path, domain) {
        if (!this.documentIsAccessible) {
            return;
        }
        const cookies = this.getAll();
        for (const cookieName in cookies) {
            if (cookies.hasOwnProperty(cookieName)) {
                this.removeItem(cookieName, path, domain);
            }
        }
    }
    _getCookieArray() {
        const document = this.document;
        if (document.cookie && document.cookie !== '') {
            const split = document.cookie.split(';');
            return split;
        }
        return [];
    }
    _getCookieRegExp(name) {
        const escapedName = name.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/ig, '\\$1');
        return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserCookieStorage, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserCookieStorage, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BrowserCookieStorage, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }] });
class CookieStorage extends AbstractStorage {
}

class PhoneNumberFormatter {
    static formatRuPhoneNumber(phone) {
        const digits = phone.replace(/\D/g, '').replace(/^7/, '');
        const parts = [
            digits.slice(0, 3),
            digits.slice(3, 6),
            digits.slice(6, 8),
            digits.slice(8, 10)
        ];
        const formatted = `+7 ${parts[0] || ''}${parts[1] ? ' ' + parts[1] : ''}${parts[2] ? ' ' + parts[2] : ''}${parts[3] ? ' ' + parts[3] : ''}`;
        return formatted.trim();
    }
}

const KONTUR_AUTH_TOKEN = 'kontur.token';
const KONTUR_AUTH_SUCCESS_MESSAGE_TYPE = 'SELLAN_KONTUR_AUTH_SUCCESS';
class KonturAuthService {
    constructor(_startUp, _ajaxService, _storage) {
        this._startUp = _startUp;
        this._ajaxService = _ajaxService;
        this._storage = _storage;
    }
    hasValidToken() {
        const token = this._storage.getItem(KONTUR_AUTH_TOKEN);
        if (token == null)
            return false;
        const model = JSON.parse(token);
        return model?.accessToken != null &&
            new Date(model?.expiresAt * 1000) > new Date();
    }
    getAccessToken() {
        const token = this._storage.getItem(KONTUR_AUTH_TOKEN);
        if (token == null)
            return null;
        const model = JSON.parse(token);
        return model.accessToken;
    }
    setToken(model) {
        this._storage.setItem(KONTUR_AUTH_TOKEN, JSON.stringify(model));
    }
    refreshToken() {
        const url = this._startUp.apiRoot(`kontur/authorize?refreshToken=${this.getRefreshToken()}`, 'oauth');
        this._ajaxService.post({ url: url }).subscribe((res) => {
            if (!res.isSuccess)
                return;
            const model = res.entity;
            this.setToken(model);
        });
    }
    loginRedirect() {
        const url = this._startUp.apiRoot('kontur/authorize', 'oauth');
        this._ajaxService.get({ url: url }).subscribe((res) => {
            if (!res.isSuccess)
                return;
            window.location.href = res.entity;
        });
    }
    loginKonturPopup(width, height) {
        if (this.hasValidToken()) {
            return Promise.resolve();
        }
        const basePath = this._startUp.getByKey('APP_URL_BASE');
        const popup = window.open(`${basePath}/auth_kontur/`, '_blank', `width=${width},height=${height}`);
        if (!popup) {
            return Promise.reject(new Error('Popup was blocked'));
        }
        const expectedOrigin = window.location.origin;
        return new Promise((resolve, reject) => {
            let isFinished = false;
            const cleanup = () => {
                if (isFinished)
                    return;
                isFinished = true;
                window.removeEventListener('message', onMessage);
                window.clearInterval(interval);
            };
            const closePopup = () => {
                if (!popup.closed) {
                    popup.close();
                }
            };
            const resolveSuccess = () => {
                cleanup();
                closePopup();
                resolve();
            };
            const rejectCancelled = () => {
                cleanup();
                reject(new Error('Popup closed before authorization completed'));
            };
            const onMessage = (event) => {
                if (event.origin !== expectedOrigin)
                    return;
                if (event.data?.type !== KONTUR_AUTH_SUCCESS_MESSAGE_TYPE)
                    return;
                resolveSuccess();
            };
            window.addEventListener('message', onMessage);
            const start = Date.now();
            const interval = window.setInterval(() => {
                if (this.hasValidToken()) {
                    resolveSuccess();
                    return;
                }
                if (popup.closed) {
                    rejectCancelled();
                    return;
                }
                if (Date.now() - start > 10 * 60 * 1000) {
                    rejectCancelled();
                }
            }, 500);
        });
    }
    getRefreshToken() {
        const token = this._storage.getItem(KONTUR_AUTH_TOKEN);
        if (token == null)
            return null;
        const model = JSON.parse(token);
        return model.refreshToken;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: KonturAuthService, deps: [{ token: Startup }, { token: AjaxService }, { token: BrowserLocalStorage }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: KonturAuthService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: KonturAuthService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }, { type: BrowserLocalStorage }] });

class Certificate {
    constructor(certificate) {
        this.certificateActive = true;
        this.hash = certificate.Thumbprint;
        this.subject = certificate.Subject;
        this.issuer = certificate.Issuer;
        this.validAfter = certificate.ValidFromDate;
        this.validBefore = certificate.ValidToDate;
        const person = this._parsePerson(certificate.SubjectName);
        this.person = person.fullName;
        this.lastName = person.lastName;
        this.firstName = person.firstName;
        this.middleName = person.middleName;
        this.snils = this._parseSnils(certificate.SubjectName);
        this.organization = this._parseOrganizatioin(certificate.SubjectName);
        this.inn = this._parseInn(certificate.SubjectName);
        this.ogrn = this._parseOgrn(certificate.SubjectName);
        this.ogrnip = this._parseOgrnip(certificate.SubjectName);
        if (this.person === this.organization) {
            this.organization = '';
        }
        this.displayValidDate = 'c ' + DateExtension.format(new Date(certificate.ValidFromDate), 'DD-MM-YYYY')
            + ' по ' + DateExtension.format(new Date(certificate.ValidToDate), 'DD-MM-YYYY');
        if (new Date(certificate.ValidToDate) < new Date()) {
            this.enabled = false;
        }
        else {
            this.enabled = true;
        }
    }
    get isOrganization() {
        return !!this.ogrn || !!this.ogrnip;
    }
    _parsePerson(subject) {
        let firstNameMatch;
        let middleNameMatch;
        let lastNameMatch;
        if (subject.match(/(?:^|,\s*)G\s*=/)) {
            firstNameMatch = subject.match(/(?:^|,\s*)G\s*=[\s"]*([а-яА-ЯёЁ'\w-.]+)/);
            lastNameMatch = subject.match(/(?:^|,\s*)SN\s*=[\s"]*([а-яА-ЯёЁ'\w-.]+)/);
            middleNameMatch = subject.match(/(?:^|,\s*)G\s*=[\s"]*[а-яА-ЯёЁ'\w-.]+\s+(([а-яА-ЯёЁ'\w-.\s]+))/);
        }
        else {
            firstNameMatch = subject.match(/(?:^|,\s*)CN\s*=[\s"]*[а-яА-ЯёЁ'\w-.]+\s+([а-яА-ЯёЁ'\w-.]+)/);
            lastNameMatch = subject.match(/(?:^|,\s*)CN\s*=[\s"]*([а-яА-ЯёЁ'\w-.]+)/);
            middleNameMatch = subject.match(/(?:^|,\s*)CN\s*=[\s"]*[а-яА-ЯёЁ'\w-.]+\s+[а-яА-ЯёЁ'\w-.]+\s+(([а-яА-ЯёЁ'\w-.\s]+))/);
        }
        const names = [lastNameMatch, firstNameMatch, middleNameMatch];
        for (let k = 0; k < names.length; k++) {
            names[k] = (names[k] && names[k][1]) ? names[k][1] : null;
        }
        const lastName = (names[0] || '').replace('_', ' ');
        const firstName = (names[1] || '').replace('_', ' ');
        const middleName = (names[2] || '').replace('_', ' ');
        let fullName = [lastName, firstName, middleName].join(' ');
        if (fullName.replace(/\s/g, '') === '') {
            fullName = '';
        }
        return { fullName, lastName, firstName, middleName };
    }
    _parseSnils(subject) {
        let snils;
        let snilsMatch = subject.match(/(?:^|,\s*)SNILS\s*=\s*([\d]+)/);
        if (snilsMatch) {
            snils = snilsMatch[1];
        }
        if (!snils) {
            snilsMatch = subject.match(/(?:^|,\s*)СНИЛС\s*=\s*([\d]+)/);
            if (snilsMatch) {
                snils = snilsMatch[1];
            }
        }
        return snils;
    }
    _parseInn(subject) {
        const innMatch11 = subject.match(/(?:^|,\s*)ИНН ЮЛ\s*=[\s"]*([\d]+)/);
        const innMatch12 = subject.match(/(?:^|,\s*)OID.1.2.643.100.4\s*=[\s"]*([\d]+)/);
        const innMatch4 = subject.match(/(?:^|,\s*)INNLE\s*=[\s"]*([\d]+)/);
        const innMatch2 = subject.match(/(?:^|[,\"]\s*")INN\s*=[\s"]*([\d]+)/);
        const innMatch3 = subject.match(/(?:^|,\s*)INN\s*=[\s"]*([\d]+)/);
        const innMatch1 = subject.match(/(?:^|,\s*)ИНН\s*=[\s"]*([\d]+)/);
        const inns = new Array();
        const innMatchs = [innMatch11, innMatch12, innMatch4, innMatch2, innMatch3, innMatch1];
        for (let j = 0; j < innMatchs.length; j++) {
            inns.push((innMatchs[j] && innMatchs[j][1]) ? innMatchs[j][1] : null);
        }
        let inn = null;
        for (let i = 0; i < inns.length; i++) {
            if (!Utility.isEmpty(inns[i])) {
                inn = inns[i];
                break;
            }
        }
        if (inn) {
            if (inn && inn.length === 12 && inn.substr(0, 2) === '00') {
                inn = inn.substr(2, 10);
            }
        }
        return inn;
    }
    _parseOgrn(subject) {
        let match = subject.match(/(?:^|,\s*)ОГРН\s*=[\s"]*([\d]+)/);
        if (match) {
            return match[1];
        }
        match = subject.match(/(?:^|,\s*)OGRN\s*=[\s"]*([\d]+)/);
        if (match) {
            return match[1];
        }
        return null;
    }
    _parseOgrnip(subject) {
        let match = subject.match(/(?:^|,\s*)ОГРНИП\s*=[\s"]*([\d]+)/);
        if (match) {
            return match[1];
        }
        match = subject.match(/(?:^|,\s*)OGRNIP\s*=[\s"]*([\d]+)/);
        if (match) {
            return match[1];
        }
        return null;
    }
    _parseOrganizatioin(subject) {
        let organization;
        let organizationMatch = subject.match(/(?:^|,\s*)O\s*=\s*([^,]+)/);
        if (organizationMatch) {
            organization = organizationMatch[1];
            if (organization.match(/^"/)) {
                organization = organization.replace(/^"|"$/gm, '');
            }
            organization = organization.replace(/""/g, '"').trim();
        }
        if (!organization && subject.match(/(?:^|,\s*)G\s*=/)) {
            organizationMatch = subject.match(/(?:^|,\s*)CN\s*=\s*([^,]+)/);
            if (organizationMatch) {
                organization = organizationMatch[1];
                if (organization.match(/^"/)) {
                    organization = organization.replace(/^"|"$/gm, '');
                }
                organization = organization.replace(/""/g, '"').trim();
            }
        }
        return organization;
    }
}

class FileDataForSign {
}

class CryptoSignature {
    constructor(data, signature, isDetached, isHashString) {
        this.data = data;
        this.signature = signature;
        this.isDetached = isDetached;
        this.isHashString = isHashString ?? false;
    }
}

var AuthorityEnum;
(function (AuthorityEnum) {
    AuthorityEnum[AuthorityEnum["Ceo"] = 1] = "Ceo";
    AuthorityEnum[AuthorityEnum["NotCeo"] = 2] = "NotCeo";
    AuthorityEnum[AuthorityEnum["Ip"] = 3] = "Ip";
})(AuthorityEnum || (AuthorityEnum = {}));

const ALTERNATIVE_FILTER_CONDITIONS = [
    { cond: 'Contains', alt: 'DoesNotContain', state: '+' },
    { cond: 'EqualTo', alt: 'NotEqualTo', state: '+' },
    { cond: 'In', alt: 'NotIn', state: '+' },
    { cond: 'GreaterThan', alt: 'LessThan', state: '+' },
    { cond: 'GreaterThanOrEqualTo', alt: 'LessThanOrEqualTo', state: '+' },
    { cond: 'StartsWith', alt: 'EndsWith', state: '+' },
    { cond: 'DoesNotContain', alt: 'Contains', state: '-' },
    { cond: 'NotEqualTo', alt: 'EqualTo', state: '-' },
    { cond: 'NotIn', alt: 'In', state: '-' },
    { cond: 'LessThan', alt: 'GreaterThan', state: '-' },
    { cond: 'LessThanOrEqualTo', alt: 'GreaterThanOrEqualTo', state: '-' },
    { cond: 'EndsWith', alt: 'StartsWith', state: '-' }
];
const DATE_DATA_TYPE = 5;
const DATE_RANGE_CONDITIONS = ['GreaterThanOrEqualTo', 'LessThanOrEqualTo'];
function _isDateRangeFilter(filterItem) {
    return Number(filterItem.dataType) === DATE_DATA_TYPE && DATE_RANGE_CONDITIONS.includes(filterItem.condition);
}
class ServerSideDataSource {
    // Геттер для получения текущего значения signals
    get signals() {
        return this._signalsSubject.value;
    }
    // Приватный сеттер для обновления signals
    set signals(value) {
        this._signalsSubject.next(value || []);
    }
    constructor(_schema, _dataExportService, _defaultFilters) {
        this._schema = _schema;
        this._dataExportService = _dataExportService;
        this._defaultFilters = _defaultFilters;
        this._subject = new BehaviorSubject([]);
        this._loadingSubject = new BehaviorSubject(false);
        this._signalsSubject = new BehaviorSubject([]);
        this.loading$ = this._loadingSubject.asObservable();
        // Публичный Observable для подписки на изменения signals
        this.signals$ = this._signalsSubject.asObservable();
    }
    connect() {
        return this._subject.asObservable();
    }
    disconnect() {
        this._subject.complete();
        this._loadingSubject.complete();
        this._signalsSubject.complete();
    }
    update(items) {
        this._subject.next(items);
        this.dataItems = items;
    }
    initLocalization(paginator) {
        this._schema.paginator.initLocalization(paginator);
    }
    useFilter(filter, action, getAdditionalParams, callback) {
        this.FilterInternalLogic([filter], action, getAdditionalParams, callback);
    }
    useFilters(filters, action, getAdditionalParams, callback) {
        this.FilterInternalLogic(filters, action, getAdditionalParams, callback);
    }
    registrateFilterItem(filter, action, getAdditionalParams, callback) {
        this.FilterInternalLogic([filter], action, getAdditionalParams, callback);
    }
    registrateFilter(filterInput, action, eventName, getAdditionalParams, callback) {
        if (!eventName) {
            eventName = 'keyup';
        }
        fromEvent(filterInput.nativeElement, eventName)
            .pipe(debounceTime(150), distinctUntilChanged(), tap(() => {
            const filter = {
                field: filterInput.nativeElement.getAttribute('field'),
                condition: filterInput.nativeElement.getAttribute('condition'),
                value: filterInput.nativeElement.value
            };
            this.FilterInternalLogic([filter], action, getAdditionalParams, callback);
        }))
            .subscribe();
    }
    FilterInternalLogic(filterItems, action, getAdditionalParams, callback) {
        // если фильтры еще не использовались, то создаем массив
        if (Utility.isEmpty(this._schema.filters)) {
            this._schema.filters = new Array();
        }
        filterItems.forEach((filterItem) => {
            // исключаем фильтр из общего массива фильтров с учетом условия фильтрации
            Utility.removeByTwoKey(this._schema.filters, { key: 'field', value: filterItem.field }, { key: 'condition', value: filterItem.condition });
            // если используется фильтрация с альтернативным условием ее тоже нужно убрать из существующих фильтров
            const altCond = ALTERNATIVE_FILTER_CONDITIONS.find(item => item.cond === filterItem.condition);
            if (altCond && !_isDateRangeFilter(filterItem)) {
                Utility.removeByTwoKey(this._schema.filters, { key: 'field', value: filterItem.field }, { key: 'condition', value: altCond.alt });
            }
            // добавляем фильтр в общий массив фильтров если значение для фильтрации не пустое
            if (Utility.isEmpty(filterItem.value) === false) {
                this._schema.filters.push({
                    field: filterItem.field,
                    condition: filterItem.condition,
                    value: typeof filterItem.value === 'string' || filterItem.value instanceof String
                        ? filterItem?.value?.trim()
                        : filterItem?.value,
                    orFields: filterItem.orFields
                });
            }
        });
        action();
        const params = Utility.isEmpty(getAdditionalParams) ? undefined : getAdditionalParams();
        this.loadDataSourceItems(params, callback);
    }
    forceLoading() {
        this._lastQuery = '';
    }
    setPageIndex(pageIndex) {
        this._schema.paginator.pageIndex = pageIndex;
    }
    loadDataSourceItems(params, callback) {
        let loadData = true;
        this._additionalParams = params;
        if (params && params.conditionFunc) {
            loadData = params.conditionFunc(params);
        }
        if (loadData) {
            this._loadingSubject.next(true);
            const query = this.buildQuery();
            if (query !== this._lastQuery) {
                this._lastQuery = query;
                const obs = this._schema.dataService.getDataSourceItems(query, params);
                if (obs !== undefined) {
                    obs.pipe(catchError(() => of([])), finalize(() => { this._loadingSubject.next(false); }))
                        .subscribe((response) => {
                        if (response.isSuccess === true) {
                            this._schema.paginator.pageIndex = response.entity.pageIndex;
                            this._schema.paginator.pageSize = response.entity.pageSize;
                            this._schema.paginator.total = response.entity.totalCount;
                            this._subject.next(response.entity.entity);
                            this.dataItems = response.entity.entity;
                            // Обновляем signals через сеттер, который автоматически уведомит подписчиков
                            if (response.signals) {
                                this.signals = response.signals;
                            }
                            if (callback) {
                                callback();
                            }
                        }
                        else {
                            throw Error(response.message);
                        }
                    });
                }
            }
        }
    }
    buildQuery(pageIndex, pageSize) {
        let query = 'page=' + (pageIndex ?? this._schema.paginator.pageIndex) + '&pageSize=' + (pageSize ?? this._schema.paginator.pageSize) + '';
        if (this._schema.sorts && this._schema.sorts.length > 0) {
            query += '&sort={' + this._schema.sorts.map(item => item.field + '-' + item.direction).join(',') + '}';
        }
        else if (this._schema.sort) {
            query += '&sort={' + this._schema.sort.field + '-' + this._schema.sort.direction + '}';
        }
        const useSchemaFilters = Utility.isEmpty(this._schema.filters) === false && this._schema.filters.length > 0;
        const useDefaulFilters = Utility.isEmpty(this._defaultFilters) === false && this._defaultFilters.length > 0;
        if ((useSchemaFilters) || (useDefaulFilters)) {
            query += '&filter={';
            const filters = new Array();
            if (useSchemaFilters) {
                this._schema.filters.forEach((item) => { filters.push(item); });
            }
            if (useDefaulFilters) {
                this._defaultFilters.forEach((item) => {
                    if (!Utility.containsByTwoKey(filters, { key: 'field', value: item.field }, { key: 'condition', value: item.condition })) {
                        filters.push(item);
                    }
                });
            }
            const serializedFilters = filters
                .filter(item => Utility.isEmpty(item.value) === false)
                .map((item) => {
                const orFields = (item.orFields ?? []).filter(field => Utility.isEmpty(field) === false);
                if (orFields.length === 0) {
                    return '(' + item.field + '~' + item.condition + '~' + item.value + ')';
                }
                const uniqueFields = [item.field, ...orFields]
                    .filter((field, index, arr) => arr.indexOf(field) === index);
                const orQuery = uniqueFields
                    .map(field => '(' + field + '~' + item.condition + '~' + item.value + ')')
                    .join('|');
                return '(' + orQuery + ')';
            });
            query += serializedFilters.join(',');
            query += '}';
        }
        return query;
    }
    exportExcel(columns, exportAdditionalParamsFunc, onCompleted, onError) {
        let isCompleted = false;
        const complete = () => {
            if (isCompleted) {
                return;
            }
            isCompleted = true;
            if (onCompleted) {
                onCompleted();
            }
        };
        const handleError = (error) => {
            if (onError) {
                onError(error);
            }
            complete();
        };
        const additionalParams = exportAdditionalParamsFunc ? exportAdditionalParamsFunc() : this._additionalParams;
        this._schema.dataService.getDataSourceItems(this.buildQuery(0, 1000000), additionalParams)
            .pipe(catchError((error) => {
            handleError(error);
            return of(null);
        }), finalize(() => { complete(); }))
            .subscribe((response) => {
            if (!response) {
                return;
            }
            if (response.isSuccess !== true || !response.entity?.entity) {
                handleError(response);
                return;
            }
            const dataItems = response.entity.entity;
            this._dataExportService.exportData({ headers: columns, name: 'data', rows: dataItems })
                .pipe(catchError((error) => {
                handleError(error);
                return of(null);
            }), finalize(() => { complete(); }))
                .subscribe((blob) => {
                if (!blob) {
                    return;
                }
                const url = window.URL.createObjectURL(blob);
                window.location.href = url;
            });
        });
    }
}

var FieldTypeEnum;
(function (FieldTypeEnum) {
    FieldTypeEnum[FieldTypeEnum["String"] = 1] = "String";
    FieldTypeEnum[FieldTypeEnum["Int"] = 2] = "Int";
    FieldTypeEnum[FieldTypeEnum["Bool"] = 3] = "Bool";
    FieldTypeEnum[FieldTypeEnum["Decimal"] = 4] = "Decimal";
    FieldTypeEnum[FieldTypeEnum["DateTime"] = 5] = "DateTime";
})(FieldTypeEnum || (FieldTypeEnum = {}));

class ExportedData {
}
/**
 * @deprecated The method should not be used
 */
class GridColumn {
    constructor(key, name, dataType) {
        this.key = key;
        this.name = name;
        this.dataType = dataType ?? FieldTypeEnum.String;
    }
}

// общие настройки UI
class CommonVisualSetting {
}
// платформа зависимые настройки UI
class PlatformVisualSetting {
}
// настройки UI для брокерских организаций
class BrokerVisualSetting {
}
// данные по виртуальному счету
class VirtualAccount {
}
// результат верификации контактных данных плользователя
class PersonVerification {
}
// Настройки отображения в заявках
class RequestVisualSettings {
}
// визуальныей глобальные настройки
class VisualSettings {
}
var UserVerificationMode;
(function (UserVerificationMode) {
    UserVerificationMode["None"] = "None";
    UserVerificationMode["OnlyEmail"] = "OnlyEmail";
    UserVerificationMode["OnlyPhone"] = "OnlyPhone";
    UserVerificationMode["All"] = "All";
    UserVerificationMode["OnlyOne"] = "OnlyOne";
})(UserVerificationMode || (UserVerificationMode = {}));
var PhoneVerificationServiceWorkingMode;
(function (PhoneVerificationServiceWorkingMode) {
    PhoneVerificationServiceWorkingMode["Default"] = "Default";
    PhoneVerificationServiceWorkingMode["Voice"] = "Voice";
    PhoneVerificationServiceWorkingMode["Mix"] = "Mix";
})(PhoneVerificationServiceWorkingMode || (PhoneVerificationServiceWorkingMode = {}));

class EditDictionaryItem {
}

var FileTypeEnum;
(function (FileTypeEnum) {
    FileTypeEnum[FileTypeEnum["None"] = 1] = "None";
    FileTypeEnum[FileTypeEnum["Passport"] = 2] = "Passport";
    FileTypeEnum[FileTypeEnum["InternationalPassport"] = 3] = "InternationalPassport";
    FileTypeEnum[FileTypeEnum["Snils"] = 4] = "Snils";
    FileTypeEnum[FileTypeEnum["Ogrn"] = 5] = "Ogrn";
    FileTypeEnum[FileTypeEnum["CompanyRegulations"] = 6] = "CompanyRegulations";
    FileTypeEnum[FileTypeEnum["DecisionOnAppointment"] = 7] = "DecisionOnAppointment";
    FileTypeEnum[FileTypeEnum["Egrul"] = 8] = "Egrul";
    FileTypeEnum[FileTypeEnum["SystemReglament"] = 9] = "SystemReglament";
    FileTypeEnum[FileTypeEnum["ProcessingOfPersonalDataReglament"] = 10] = "ProcessingOfPersonalDataReglament";
    FileTypeEnum[FileTypeEnum["Accounting"] = 11] = "Accounting";
    FileTypeEnum[FileTypeEnum["AccountingXml"] = 12] = "AccountingXml";
    FileTypeEnum[FileTypeEnum["OrganizationProfile"] = 13] = "OrganizationProfile";
    FileTypeEnum[FileTypeEnum["OrganizationProfileXml"] = 14] = "OrganizationProfileXml";
    FileTypeEnum[FileTypeEnum["OrganizationInn"] = 15] = "OrganizationInn";
    FileTypeEnum[FileTypeEnum["PersonInn"] = 16] = "PersonInn";
    FileTypeEnum[FileTypeEnum["License"] = 17] = "License";
    FileTypeEnum[FileTypeEnum["MigrationCard"] = 18] = "MigrationCard";
    FileTypeEnum[FileTypeEnum["Visa"] = 19] = "Visa";
    FileTypeEnum[FileTypeEnum["TemporaryResidencePermits"] = 20] = "TemporaryResidencePermits";
    FileTypeEnum[FileTypeEnum["ResidencePermits"] = 21] = "ResidencePermits";
    FileTypeEnum[FileTypeEnum["DocGeneratedMetadata"] = 23] = "DocGeneratedMetadata";
    FileTypeEnum[FileTypeEnum["DocGeneratedPatern"] = 24] = "DocGeneratedPatern";
    FileTypeEnum[FileTypeEnum["PanelPrintForm"] = 25] = "PanelPrintForm";
    FileTypeEnum[FileTypeEnum["SupplyContract"] = 26] = "SupplyContract";
    FileTypeEnum[FileTypeEnum["SupplyContractConfirmation"] = 27] = "SupplyContractConfirmation";
    FileTypeEnum[FileTypeEnum["OfficeConfirmation"] = 28] = "OfficeConfirmation";
    FileTypeEnum[FileTypeEnum["AccountingFNS"] = 29] = "AccountingFNS";
    FileTypeEnum[FileTypeEnum["PowerOfAttorney"] = 30] = "PowerOfAttorney";
    FileTypeEnum[FileTypeEnum["ReviewsOfFinancialOrganizations"] = 31] = "ReviewsOfFinancialOrganizations";
    FileTypeEnum[FileTypeEnum["ReviewsOfContractors"] = 32] = "ReviewsOfContractors";
    FileTypeEnum[FileTypeEnum["LetterOfNoInterest"] = 33] = "LetterOfNoInterest";
    FileTypeEnum[FileTypeEnum["DealApprovalDocuments"] = 34] = "DealApprovalDocuments";
    FileTypeEnum[FileTypeEnum["FactoringOffer"] = 36] = "FactoringOffer";
    FileTypeEnum[FileTypeEnum["SystemFinanceReglament"] = 37] = "SystemFinanceReglament";
    FileTypeEnum[FileTypeEnum["DealDecision"] = 39] = "DealDecision";
    FileTypeEnum[FileTypeEnum["ScoringVerdict"] = 40] = "ScoringVerdict";
    FileTypeEnum[FileTypeEnum["ProcessingFinancialDataReglament"] = 41] = "ProcessingFinancialDataReglament";
    FileTypeEnum[FileTypeEnum["PodFtProfile"] = 42] = "PodFtProfile";
    FileTypeEnum[FileTypeEnum["PaymentOrder"] = 43] = "PaymentOrder";
    FileTypeEnum[FileTypeEnum["ChatAttachment"] = 44] = "ChatAttachment";
    FileTypeEnum[FileTypeEnum["ProviderOrganizationProfile"] = 45] = "ProviderOrganizationProfile";
    FileTypeEnum[FileTypeEnum["CashOutStatement"] = 46] = "CashOutStatement";
    FileTypeEnum[FileTypeEnum["Ras"] = 47] = "Ras";
    FileTypeEnum[FileTypeEnum["RasAttachment"] = 48] = "RasAttachment";
    FileTypeEnum[FileTypeEnum["MachineReadableAttorney"] = 49] = "MachineReadableAttorney";
    FileTypeEnum[FileTypeEnum["MachineReadableAttorneyXml"] = 50] = "MachineReadableAttorneyXml";
    FileTypeEnum[FileTypeEnum["BrokerProfile"] = 51] = "BrokerProfile";
    FileTypeEnum[FileTypeEnum["PurchasingFactoringOffer"] = 52] = "PurchasingFactoringOffer";
    FileTypeEnum[FileTypeEnum["SupplementaryAgreement"] = 53] = "SupplementaryAgreement";
    FileTypeEnum[FileTypeEnum["PaymentOrderAnalyticAccount"] = 54] = "PaymentOrderAnalyticAccount";
    FileTypeEnum[FileTypeEnum["Notification"] = 55] = "Notification";
    FileTypeEnum[FileTypeEnum["AssetsFreezeReport"] = 56] = "AssetsFreezeReport";
    FileTypeEnum[FileTypeEnum["FundingInstruction"] = 57] = "FundingInstruction";
    FileTypeEnum[FileTypeEnum["MraReport"] = 58] = "MraReport";
    FileTypeEnum[FileTypeEnum["MonitoringFinancialReport"] = 59] = "MonitoringFinancialReport";
})(FileTypeEnum || (FileTypeEnum = {}));
const FilesLabel = new Map([
    [FileTypeEnum.None, 'Не задан'],
    [FileTypeEnum.Passport, 'Паспорт'],
    [FileTypeEnum.InternationalPassport, 'Загранпаспорт'],
    [FileTypeEnum.Snils, 'СНИЛС'],
    [FileTypeEnum.Ogrn, 'Свидетельство ОГРН'],
    [FileTypeEnum.CompanyRegulations, 'Устав'],
    [FileTypeEnum.DecisionOnAppointment, 'Решение о назначении на должность'],
    [FileTypeEnum.Egrul, 'Выписка из ЕГРЮЛ/ЕГРИП'],
    // [FileTypeEnum.SystemReglament, 'Заявление о присоединении к Регламенту системы'],
    [FileTypeEnum.ProcessingOfPersonalDataReglament, 'Разрешение на обработку персональных данных'],
    [FileTypeEnum.Accounting, 'Финансовая отчетность'],
    [FileTypeEnum.OrganizationProfile, 'Опросный лист клиента'],
    [FileTypeEnum.OrganizationInn, 'Свидетельство ИНН'],
    [FileTypeEnum.PersonInn, 'Свидетельство ИНН'],
    [FileTypeEnum.License, 'Лицензия'],
    [FileTypeEnum.MigrationCard, 'Миграционная карта'],
    [FileTypeEnum.Visa, 'Виза'],
    [FileTypeEnum.TemporaryResidencePermits, 'Разрешение на временное проживание'],
    [FileTypeEnum.ResidencePermits, 'Вид на жительство'],
    [FileTypeEnum.PanelPrintForm, 'Печатная форма данных'],
    [FileTypeEnum.SupplyContract, 'Договор поставки'],
    [FileTypeEnum.SupplyContractConfirmation, 'Документ подтверждающий поставку'],
    [FileTypeEnum.OfficeConfirmation, 'Документ о праве собственности / аренды помещения'],
    [FileTypeEnum.AccountingFNS, 'Финансовая отчетность с отметкой ФНС'],
    [FileTypeEnum.PowerOfAttorney, 'Доверенность'],
    [FileTypeEnum.ReviewsOfFinancialOrganizations, 'Отзывы кредитных организаций'],
    [FileTypeEnum.ReviewsOfContractors, 'Отзывы контрагентов'],
    [FileTypeEnum.LetterOfNoInterest, 'Письмо об отсутствии заинтересованности'],
    [FileTypeEnum.DealApprovalDocuments, 'Документы об одобрении сделки'],
    [FileTypeEnum.FactoringOffer, ' Оферта "Досрочной оплаты контракта"'],
    [FileTypeEnum.SystemFinanceReglament, 'Соглашение о внесении ГО и безакцептном списании'],
    [FileTypeEnum.DealDecision, 'Решение по сделке'],
    [FileTypeEnum.ScoringVerdict, 'Оценка финансового положения'],
    [FileTypeEnum.ProcessingFinancialDataReglament, 'Разрешение на раскрытие информации'],
    [FileTypeEnum.PodFtProfile, 'Анкета ПОД/ФТ'],
    [FileTypeEnum.PaymentOrder, 'Платежное поручение'],
    [FileTypeEnum.ProviderOrganizationProfile, 'Анкета клиента по форме ФО'],
    [FileTypeEnum.CashOutStatement, 'Заявление на вывод средств с виртуального счета'],
    [FileTypeEnum.ChatAttachment, 'Документ чата'],
    [FileTypeEnum.BrokerProfile, 'Опросный лист агента'],
    [FileTypeEnum.PurchasingFactoringOffer, 'Оферта на присоединение к правилам закупочного факторинга'],
    [FileTypeEnum.SupplementaryAgreement, 'Дополнительное соглашение'],
    [FileTypeEnum.PaymentOrderAnalyticAccount, 'Платежное поручение для пополнения аналитического счета'],
    [FileTypeEnum.Notification, 'Уведомление'],
    [FileTypeEnum.AssetsFreezeReport, '	Отчет о замораживании средств'],
    [FileTypeEnum.FundingInstruction, 'Инструкция для получения финансирования'],
    [FileTypeEnum.MraReport, '	Протокол проверки документов'],
    [FileTypeEnum.MonitoringFinancialReport, 'Финансовая отчетность мониторинга'],
]);
class FileTypeItem extends EditDictionaryItem {
}

class UploadedFileAttribute {
}
class UploadedFile {
}
class UploaderConfig {
    constructor(typeId, url) {
        this.hideList = false;
        this.hideSelectBtn = false;
        this.hiddenLink = false;
        this.useInformer = false;
        this.multiple = true;
        this.typeId = typeId;
        this.typeName = FilesLabel.get(typeId);
        this.url = (url) ? url : '';
        this.informerIcon = 'question';
        this.dgsBtnName = 'Сформировать';
    }
}

var RolesEnum;
(function (RolesEnum) {
    /// Владелец системы
    RolesEnum[RolesEnum["System"] = 1] = "System";
    /// Брокер процесса
    RolesEnum[RolesEnum["Broker"] = 2] = "Broker";
    /// Поставщик процесса
    RolesEnum[RolesEnum["Provider"] = 3] = "Provider";
    /// Потребитель процесса
    RolesEnum[RolesEnum["Consumer"] = 4] = "Consumer";
})(RolesEnum || (RolesEnum = {}));
var ParticipationEnum;
(function (ParticipationEnum) {
    // Администратор
    ParticipationEnum[ParticipationEnum["Administrator"] = 100] = "Administrator";
    // Оператор
    ParticipationEnum[ParticipationEnum["Operator"] = 101] = "Operator";
    // Физическое лицо
    ParticipationEnum[ParticipationEnum["PhysicalPerson"] = 102] = "PhysicalPerson";
    // Системная УЗ интеграционной шины
    ParticipationEnum[ParticipationEnum["IntegrationBusUser"] = 103] = "IntegrationBusUser";
})(ParticipationEnum || (ParticipationEnum = {}));

var MiniDraftModeEnum;
(function (MiniDraftModeEnum) {
    MiniDraftModeEnum[MiniDraftModeEnum["Classic"] = 1] = "Classic";
    MiniDraftModeEnum[MiniDraftModeEnum["DraftInWindow"] = 2] = "DraftInWindow";
})(MiniDraftModeEnum || (MiniDraftModeEnum = {}));

class CoreAvatarCropperDialogWindow extends CoreBaseDestroyComponent {
    constructor(dialogRef, image, sanitizer) {
        super();
        this.dialogRef = dialogRef;
        this.image = image;
        this.sanitizer = sanitizer;
    }
    ngOnInit() {
        this.sanitizedUrl = this.sanitizer.bypassSecurityTrustUrl(this.image);
    }
    imageCropped(event) {
        this.eventA = event;
        this.croppedImage = this.sanitizer.bypassSecurityTrustUrl(event.objectUrl || event.base64 || '');
    }
    crop() {
        var head = 'data:image/png;base64,';
        var img = new Image();
        img.onload = () => {
            const roundedCanvas = this._getRoundedCanvas(img);
            let urlContent = roundedCanvas.toDataURL("image/png");
            urlContent = urlContent.toString().replace(head, '');
            this.dialogRef.close(urlContent);
        };
        img.src = window.URL.createObjectURL(this.eventA.blob);
    }
    reset() {
        // this.cropper.clear();
        // this.cropper.crop();
    }
    _getRoundedCanvas(sourceCanvas) {
        const canvas = document.createElement('canvas');
        const context = canvas.getContext('2d');
        const width = sourceCanvas.width;
        const height = sourceCanvas.height;
        canvas.width = width;
        canvas.height = height;
        context.imageSmoothingEnabled = true;
        context.drawImage(sourceCanvas, 0, 0, width, height);
        context.globalCompositeOperation = 'destination-in';
        context.beginPath();
        context.arc(width / 2, height / 2, Math.min(width, height) / 2, 0, 2 * Math.PI, true);
        context.fill();
        return canvas;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAvatarCropperDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreAvatarCropperDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u0410\u0432\u0430\u0442\u0430\u0440 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F\" width=\"700\">\n    <div body>    \n        \n      <core-cropper\n      [imageURL]=\"image\" [roundCropper]=\"true\"\n      (imageCropped)=\"imageCropped($event)\"\n  ></core-cropper>\n\n    \n    </div>\n    <div footer>\n        <button type=\"button\" class=\"btn-primary\" (click)=\"crop()\">\n            \u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\n        </button>\n    </div>\n</core-dialog>", styles: ["::ng-deep .cropper-view-box,::ng-deep .cropper-face{border-radius:50%}::ng-deep .cropper-view-box{outline:0;box-shadow:0 0 0 1px #39f}.crop-actions{display:flex;width:100%;justify-content:flex-end;margin-top:1rem}\n"], dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: ImageCropperComponent, selector: "core-cropper", inputs: ["imageChangedEvent", "imageURL", "imageBase64", "imageFile", "imageAltText", "cropperFrameAriaLabel", "output", "format", "transform", "maintainAspectRatio", "aspectRatio", "resetCropOnAspectRatioChange", "resizeToWidth", "resizeToHeight", "cropperMinWidth", "cropperMinHeight", "cropperMaxHeight", "cropperMaxWidth", "cropperStaticWidth", "cropperStaticHeight", "canvasRotation", "initialStepSize", "roundCropper", "onlyScaleDown", "imageQuality", "autoCrop", "backgroundColor", "containWithinAspectRatio", "hideResizeSquares", "allowMoveImage", "cropper", "alignImage", "disabled", "hidden"], outputs: ["imageCropped", "startCropImage", "imageLoaded", "cropperReady", "loadImageFailed", "transformChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAvatarCropperDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0410\u0432\u0430\u0442\u0430\u0440 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F\" width=\"700\">\n    <div body>    \n        \n      <core-cropper\n      [imageURL]=\"image\" [roundCropper]=\"true\"\n      (imageCropped)=\"imageCropped($event)\"\n  ></core-cropper>\n\n    \n    </div>\n    <div footer>\n        <button type=\"button\" class=\"btn-primary\" (click)=\"crop()\">\n            \u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\n        </button>\n    </div>\n</core-dialog>", styles: ["::ng-deep .cropper-view-box,::ng-deep .cropper-face{border-radius:50%}::ng-deep .cropper-view-box{outline:0;box-shadow:0 0 0 1px #39f}.crop-actions{display:flex;width:100%;justify-content:flex-end;margin-top:1rem}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: i1.DomSanitizer }] });

class CoreCropperService {
    constructor(_dialog) {
        this._dialog = _dialog;
    }
    uploadAvatar(uploadFunction) {
        const input = document.createElement('input');
        input.id = 'avatar-input-file';
        input.type = 'file';
        input.name = 'user-icon-file';
        input.accept = 'image/png, image/gif, image/jpeg';
        input.onchange = (e) => {
            const files = e.target.files;
            if (files.length > 0) {
                const file = URL.createObjectURL(files[0]);
                const dialogRef = this._dialog.open(CoreAvatarCropperDialogWindow, {
                    data: file
                });
                const sub = dialogRef.afterClosed().subscribe(result => {
                    if (result && result.state !== DialogReason.cancel) {
                        const upload = {
                            isVersioned: false,
                            multiId: null,
                            typeId: FileTypeEnum.None,
                            fileName: files[0].name,
                            content: result,
                            hiddenLink: true,
                            isTemp: false,
                        };
                        uploadFunction(upload);
                    }
                    sub.unsubscribe();
                });
            }
        };
        input.click();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCropperService, deps: [{ token: i1$8.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCropperService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCropperService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }] });

class CoreCropperModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCropperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreCropperModule, declarations: [CoreAvatarCropperDialogWindow], imports: [CoreMatModule,
            CoreBaseModule,
            CoreDialogModule,
            CoreCropperJsModule], exports: [CoreAvatarCropperDialogWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCropperModule, providers: [
            CoreCropperService
        ], imports: [CoreMatModule,
            CoreBaseModule,
            CoreDialogModule,
            CoreCropperJsModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCropperModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreAvatarCropperDialogWindow
                    ],
                    imports: [
                        CoreMatModule,
                        CoreBaseModule,
                        CoreDialogModule,
                        CoreCropperJsModule
                    ],
                    providers: [
                        CoreCropperService
                    ],
                    exports: [
                        CoreAvatarCropperDialogWindow
                    ]
                }]
        }] });

const CORE_DRAWER_DATA_TOKEN_KEY = new InjectionToken('CORE_DRAWER_DATA_TOKEN_KEY');
/** конфигурация по умолчанию  */
const CoreDawerBaseOverlayConfig = {
    hasBackdrop: false,
    backdropClass: 'sln-drawer-backdor',
    panelClass: 'sln-drawer-overlay',
};
class DrawerConfig {
    constructor() {
        /* данные для дровера */
        this.data = null;
    }
}
class DrawerService {
    constructor(_overlay, _parentInjector, _eventBroker, _appRef) {
        this._overlay = _overlay;
        this._parentInjector = _parentInjector;
        this._eventBroker = _eventBroker;
        this._appRef = _appRef;
        this._overlayRefs = [];
        this._overlayConfig = CoreDawerBaseOverlayConfig;
    }
    show(component, config) {
        if (this._overlayRefs.filter(x => x.name === (config?.name ?? component.name)).length > 0) {
            // больше одного одинакового дровера не открываем
            // но можем открывать разные дроверы поверх друг друга
            return;
        }
        if (!config) {
            config = new DrawerConfig();
        }
        this._overlayConfig.positionStrategy = this._overlay
            .position()
            .global()
            .right();
        this._overlayConfig.width = config.width;
        config.overlayRef = this._overlay.create(this._overlayConfig);
        const overlayRef = config.overlayRef;
        // Без overlayRef.attach() CDK может не применить global().right() — панель остаётся в top-left.
        const overlayEl = overlayRef.overlayElement;
        overlayEl.style.position = 'fixed';
        overlayEl.style.top = '0';
        overlayEl.style.right = '0';
        overlayEl.style.bottom = '0';
        overlayEl.style.left = 'auto';
        overlayEl.style.margin = '0';
        overlayEl.style.maxHeight = '100%';
        overlayRef.updatePosition();
        const options = {
            providers: [{ provide: CORE_DRAWER_DATA_TOKEN_KEY, useValue: config }],
            parent: this._parentInjector
        };
        const injector = Injector.create(options);
        const hostElement = overlayRef.overlayElement.ownerDocument.createElement('div');
        hostElement.style.height = '100%';
        hostElement.style.width = '100%';
        hostElement.style.boxSizing = 'border-box';
        overlayRef.overlayElement.appendChild(hostElement);
        const componentRef = createComponent(component, {
            environmentInjector: this._appRef.injector,
            hostElement,
            elementInjector: injector,
        });
        this._appRef.attachView(componentRef.hostView);
        componentRef.changeDetectorRef.detectChanges();
        overlayRef.updatePosition();
        this._overlayRefs.push({
            name: config?.name ?? component.name,
            overlayRef,
            componentRef: componentRef,
        });
        if (!window.DrowersStack) {
            window.DrowersStack = [];
        }
        window.DrowersStack.push(config?.name ?? component.name);
    }
    close(name, data) {
        if (this._overlayRefs?.length > 0) {
            let ref = this._overlayRefs.filter(x => x.name === name)[0];
            if (ref?.overlayRef) {
                if (ref.componentRef) {
                    this._appRef.detachView(ref.componentRef.hostView);
                    const hostEl = ref.componentRef.location.nativeElement;
                    ref.componentRef.destroy();
                    hostEl?.remove();
                }
                ref.overlayRef.dispose();
                this._overlayRefs = this._overlayRefs.filter(r => r !== ref);
                this._eventBroker.emit('drawer-closed-event', { name: name, data: data });
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DrawerService, deps: [{ token: i1$4.Overlay }, { token: i0.Injector }, { token: EventBrokerService }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DrawerService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DrawerService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1$4.Overlay }, { type: i0.Injector }, { type: EventBrokerService }, { type: i0.ApplicationRef }] });

class CoreDrawerComponent extends CoreAbstractComponent {
    get goto() {
        return this._goto;
    }
    set goto(value) {
        this._goto = value;
        if (value && value !== -1) {
            this.perfectScroll.scrollTo({ top: this._goto, duration: 200 });
        }
    }
    constructor(_service) {
        super();
        this._service = _service;
        this.titleHeight = 40;
        this.footerHeight = 20;
        this.hasTitle = true;
        this.hasFooter = true;
        this.reachedTopRun = new EventEmitter();
        this.reachedBottomRun = new EventEmitter();
    }
    onKeyUp() {
        const name = window.DrowersStack.pop();
        this._service.close(name);
    }
    onReachedTop() {
        this.reachedTopRun.emit({ h: this.getMaxHeight(), position: 'TOP' });
    }
    onReachedBottom() {
        this.reachedBottomRun.emit({ h: this.getMaxHeight(), position: 'BOTTOM' });
    }
    ngOnInit() {
        if (Utility.isEmpty(this.name)) {
            throw Error('Property "name" must be set!');
        }
    }
    getMaxContentHeight() {
        this.getMaxHeight();
        return { height: this.getMaxHeight().toString() + 'px' };
    }
    getMaxHeight() {
        const pageItemsHeight = (this.hasTitle ? this.titleHeight : 0) + (this.hasFooter ? this.footerHeight : 0);
        return window.innerHeight - pageItemsHeight;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDrawerComponent, deps: [{ token: DrawerService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreDrawerComponent, isStandalone: false, selector: "core-drawer", inputs: { name: "name", titleHeight: "titleHeight", footerHeight: "footerHeight", dialogTitle: "dialogTitle", width: "width", minWidth: "minWidth", hasTitle: "hasTitle", hasFooter: "hasFooter", goto: "goto" }, outputs: { reachedTopRun: "reachedTopRun", reachedBottomRun: "reachedBottomRun" }, host: { listeners: { "window:keydown.esc": "onKeyUp()" } }, viewQueries: [{ propertyName: "perfectScroll", first: true, predicate: ["perfectScroll"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-drawer\">\n  @if (hasTitle) {\n    <div class=\"sln-drawer-header\" style=\"max-height: 90px;\">\n      <ng-content select=\"[title]\"></ng-content>\n    </div>\n  }\n  <div class=\"sln-drawer-body\">\n    <ng-scrollbar #perfectScroll (reachedTop)=\"onReachedTop()\" (reachedBottom)=\"onReachedBottom()\" [ngStyle]=\"getMaxContentHeight()\" style=\"height: 90vh;\">\n      <div scrollViewport>\n        <ng-content select=\"[body]\"></ng-content>\n      </div>\n    </ng-scrollbar>\n  </div>\n  @if (hasFooter) {\n    <div class=\"sln-drawer-footer\">\n      <ng-content select=\"[footer]\"></ng-content>\n    </div>\n  }\n</div>", styles: [".sln-drawer{width:480px;min-width:inherit;background:var(--WHITE);height:100vh;border-left:2px solid var(--PRIMARY)}.sln-drawer-footer{text-align:end}.ng-scrollbar-wrapper{height:100%!important}\n"], dependencies: [{ kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "directive", type: i3$4.ScrollViewport, selector: "[scrollViewport]" }, { kind: "directive", type: i4$5.NgScrollReached, selector: "ng-scrollbar[reachedTop], ng-scrollbar[reachedBottom], ng-scrollbar[reachedStart], ng-scrollbar[reachedEnd]", inputs: ["reachedOffset", "reachedTopOffset", "reachedBottomOffset", "reachedStartOffset", "reachedEndOffset", "disableReached"], outputs: ["reachedTop", "reachedBottom", "reachedStart", "reachedEnd"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDrawerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-drawer', standalone: false, template: "<div class=\"sln-drawer\">\n  @if (hasTitle) {\n    <div class=\"sln-drawer-header\" style=\"max-height: 90px;\">\n      <ng-content select=\"[title]\"></ng-content>\n    </div>\n  }\n  <div class=\"sln-drawer-body\">\n    <ng-scrollbar #perfectScroll (reachedTop)=\"onReachedTop()\" (reachedBottom)=\"onReachedBottom()\" [ngStyle]=\"getMaxContentHeight()\" style=\"height: 90vh;\">\n      <div scrollViewport>\n        <ng-content select=\"[body]\"></ng-content>\n      </div>\n    </ng-scrollbar>\n  </div>\n  @if (hasFooter) {\n    <div class=\"sln-drawer-footer\">\n      <ng-content select=\"[footer]\"></ng-content>\n    </div>\n  }\n</div>", styles: [".sln-drawer{width:480px;min-width:inherit;background:var(--WHITE);height:100vh;border-left:2px solid var(--PRIMARY)}.sln-drawer-footer{text-align:end}.ng-scrollbar-wrapper{height:100%!important}\n"] }]
        }], ctorParameters: () => [{ type: DrawerService }], propDecorators: { perfectScroll: [{
                type: ViewChild,
                args: ['perfectScroll']
            }], name: [{
                type: Input
            }], titleHeight: [{
                type: Input
            }], footerHeight: [{
                type: Input
            }], dialogTitle: [{
                type: Input
            }], width: [{
                type: Input
            }], minWidth: [{
                type: Input
            }], hasTitle: [{
                type: Input
            }], hasFooter: [{
                type: Input
            }], goto: [{
                type: Input
            }], reachedTopRun: [{
                type: Output
            }], reachedBottomRun: [{
                type: Output
            }], onKeyUp: [{
                type: HostListener,
                args: ['window:keydown.esc']
            }] } });

class CoreDrawerModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDrawerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreDrawerModule, declarations: [CoreDrawerComponent], imports: [DragDropModule,
            CoreBaseModule,
            CoreMatModule,
            CoreControlModule,
            CoreNotificationModule], exports: [CoreDrawerComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDrawerModule, providers: [
            DrawerService
        ], imports: [DragDropModule,
            CoreBaseModule,
            CoreMatModule,
            CoreControlModule,
            CoreNotificationModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDrawerModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreDrawerComponent
                    ],
                    imports: [
                        DragDropModule,
                        CoreBaseModule,
                        CoreMatModule,
                        CoreControlModule,
                        CoreNotificationModule
                    ],
                    providers: [
                        DrawerService
                    ],
                    exports: [
                        CoreDrawerComponent
                    ]
                }]
        }] });

var Align;
(function (Align) {
    Align[Align["Left"] = 1] = "Left";
    Align[Align["Center"] = 2] = "Center";
    Align[Align["Right"] = 3] = "Right";
})(Align || (Align = {}));
class DataGridComponentTemplate extends FederationEntity {
    static isIDataGridComponentTemplate(component) {
        return component.remoteComponent !== undefined && component.isRemote !== undefined;
    }
}

class CoreGridFilterTemplateComponent {
    get value() {
        return this._value;
    }
    set value(value) {
        this._value = value;
        if (!Utility.isEmpty(value) && !this._valueInitialized) {
            if (!!this._value[0]) {
                if (this.dataType === 5) {
                    const g = this._getDateFilterItem('GreaterThanOrEqualTo');
                    if (!Utility.isEmpty(g)) {
                        this.greaterThanOrEqualTo.writeValue(g);
                    }
                    const l = this._getDateFilterItem('LessThanOrEqualTo');
                    if (!Utility.isEmpty(l)) {
                        this.lessThanOrEqualTo.writeValue(l);
                    }
                    queueMicrotask(() => {
                        if (!Utility.isEmpty(g)) {
                            this.changeDateValue(g, 'GreaterThanOrEqualTo');
                        }
                        if (!Utility.isEmpty(l)) {
                            this.changeDateValue(l, 'LessThanOrEqualTo');
                        }
                    });
                }
                else {
                    this.changeValue(this.value[0].value);
                    if (!!this._refComponent) {
                        this._refComponent.instance.initValue = this.value[0].value;
                    }
                }
            }
            this._valueInitialized = true;
        }
    }
    get isPositiveCondition() {
        const conditionMeta = ALTERNATIVE_FILTER_CONDITIONS.find(z => z.cond === this.condition);
        return conditionMeta?.state === '+';
    }
    constructor(cdref) {
        this.cdref = cdref;
        this.smallSize = false;
        this.changeFilterItem = new EventEmitter();
        this.refreshEvent = new EventEmitter();
        this.initEvent = new EventEmitter();
        this._valueInitialized = false;
        this._value = [];
        this.isInit = false;
        this.val = '';
    }
    _getDateFilterItem(condition) {
        if (!!this.value.filter(z => z.condition == condition)[0]) {
            return new Date(this.value.filter(z => z.condition == condition)[0].value);
        }
        return null;
    }
    ngAfterViewInit() {
        if (!!this.useTemplate) {
            this.render();
            this.initEvent.emit();
        }
    }
    ngOnChanges(changes) {
        if (!changes['condition'] || !this._refComponent?.instance) {
            return;
        }
        this._refComponent.instance.condition = this.condition;
        this._refComponent.changeDetectorRef?.detectChanges();
        this.cdref.markForCheck();
    }
    changeValue($event, conditon = null) {
        if (StringExtension.isAllDigits($event)) {
            const num = parseInt($event, 10);
            // проверяем, что преобразование успешно и не NaN
            this.val = isNaN(num) ? $event : num.toString();
        }
        else {
            this.val = $event;
        }
        this.changeFilterItem.emit({
            value: this.val,
            condition: !!conditon ? conditon : this.condition,
            field: this.columnDef,
            dataType: this.dataType,
            orFields: this.additionFields
        });
    }
    changeDateValue($event, conditon = null) {
        if ($event == null) {
            this.val = undefined;
        }
        else if ($event instanceof Date) {
            this.val = $event.toISOString();
        }
        else {
            this.val = $event;
        }
        this.changeFilterItem.emit({
            value: this.val,
            condition: !!conditon ? conditon : this.condition,
            field: this.columnDef,
            dataType: this.dataType,
            orFields: this.additionFields
        });
    }
    changeCond() {
        const conditionMeta = ALTERNATIVE_FILTER_CONDITIONS.find(z => z.cond === this.condition);
        if (!conditionMeta) {
            return;
        }
        this.condition = conditionMeta.alt;
        this.changeFilterItem.emit({
            value: this.val,
            condition: this.condition,
            field: this.columnDef,
            dataType: this.dataType,
            orFields: this.additionFields
        });
    }
    async render() {
        if (!this.isInit && !!this.component) {
            this.host.clear();
            if (DataGridComponentTemplate.isIDataGridComponentTemplate(this.component)) {
                if (this.component.isRemote) {
                    const module = await loadRemoteModule({
                        remoteName: this.component.remoteName,
                        exposedModule: this.component.remoteExposedModule
                    });
                    this._refComponent = this.host.createComponent(module[this.component.remoteComponent]);
                }
                else {
                    if (Utility.isEmpty(this.componentTemplateMap)) {
                        throw new Error('Словарь "componentTemplateMap", для формирования динамического компонента, не задан');
                    }
                    const componentClass = this.componentTemplateMap.get(this.component.remoteComponent);
                    this._refComponent = this.host.createComponent(componentClass);
                }
            }
            else {
                this._refComponent = this.host.createComponent(this.component);
            }
            if (!!this.inputs) {
                this.inputs.forEach((value, key) => {
                    this._refComponent.instance[key] = value;
                });
            }
            if (!!this.outputs) {
                this.outputs.forEach((value, key) => {
                    this._refComponent.instance[key].subscribe((row) => {
                        value(row);
                    });
                });
            }
            if (!!this._refComponent.instance.changeFilterItem) {
                this._refComponent.instance.placeholder = this.title;
                this._refComponent.instance.columnDef = this.columnDef;
                this._refComponent.instance.smallSize = this.smallSize;
                if (this.condition) {
                    this._refComponent.instance.condition = this.condition;
                }
                this._refComponent.instance.changeFilterItem.subscribe((value) => {
                    this.changeFilterItem.emit(value);
                });
                this._refComponent.changeDetectorRef?.detectChanges();
            }
            if (!!this.value && !!this.value[0]) {
                this._refComponent.instance.initValue = this.value[0].value;
                this._refComponent.changeDetectorRef?.detectChanges();
            }
            this.cdref.markForCheck();
            this.isInit = true;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridFilterTemplateComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreGridFilterTemplateComponent, isStandalone: false, selector: "core-grid-filter-template", inputs: { title: "title", columnDef: "columnDef", condition: "condition", additionFields: "additionFields", useTemplate: "useTemplate", component: "component", dataType: "dataType", componentTemplateMap: "componentTemplateMap", inputs: "inputs", outputs: "outputs", smallSize: "smallSize", value: "value" }, outputs: { changeFilterItem: "changeFilterItem", refreshEvent: "refreshEvent", initEvent: "initEvent" }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, read: ViewContainerRef }, { propertyName: "greaterThanOrEqualTo", first: true, predicate: ["GreaterThanOrEqualTo"], descendants: true }, { propertyName: "lessThanOrEqualTo", first: true, predicate: ["LessThanOrEqualTo"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"sln-filter-template\">\n  <form #filtersForm=\"ngForm\" novalidate autocomplete=\"off\">\n    <div>\n      <ng-template #host></ng-template>\n    </div>\n    @if (!useTemplate) {\n      @if (dataType === 5) {\n        <div class=\"sln-datetime-interval-box\">\n          <core-field-date #GreaterThanOrEqualTo name=\"pickerMin\" fieldName=\"pickerMin\" [placeholder]=\"title + ' \u043E\u0442'\"\n          (valueChange)=\"changeDateValue($event,'GreaterThanOrEqualTo')\" class=\"sln-etp-data-value {{ smallSize ? 'sln-input-s': '' }} date-field-from\"></core-field-date>\n          <core-field-date #LessThanOrEqualTo name=\"pickerMax\" fieldName=\"pickerMax\" [placeholder]=\"title + ' \u0434\u043E'\"\n          (valueChange)=\"changeDateValue($event,'LessThanOrEqualTo')\" class=\"sln-etp-data-value {{ smallSize ? 'sln-input-s': '' }} date-field-to\"></core-field-date>\n        </div>\n      }\n      @if (dataType !== 5) {\n        <div class=\"sln-column-filter-template\">\n          <mat-form-field>\n            <mat-label class=\"sln-default-label\">{{title}}</mat-label>\n            <input matInput class=\"{{ smallSize ? 'sln-input sln-input-s': '' }}\" [placeholder]=\"title\" [value]=\"val\" (change)=\"changeValue($event.target.value)\">\n          </mat-form-field>\n          <button type=\"button\" matTooltip=\"{{isPositiveCondition ? '\u0412\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439' : '\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439'}}\" class=\"sln-column-filter-template-btn\" (click)=\"changeCond()\">\n            <div class=\"{{isPositiveCondition ? 'sln-common-input-plus' : 'sln-common-input-minus'}}\"></div>\n          </button>\n        </div>\n      }\n    }\n  </form>\n</div>\n", styles: [".sln-datetime-interval-box{display:flex;align-items:center;position:relative}.sln-datetime-interval-box core-field-date{margin-right:5px}:host-context(.grid-filter-template) .sln-datetime-interval-box core-field-date{flex:1!important;width:100%!important;max-width:calc(50% - 2.5px)!important}:host-context(.grid-filter-template) .sln-datetime-interval-box core-field-date:last-child{margin-right:0!important}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreFieldTypeDateTimeComponent, selector: "core-field-date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridFilterTemplateComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-grid-filter-template', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"sln-filter-template\">\n  <form #filtersForm=\"ngForm\" novalidate autocomplete=\"off\">\n    <div>\n      <ng-template #host></ng-template>\n    </div>\n    @if (!useTemplate) {\n      @if (dataType === 5) {\n        <div class=\"sln-datetime-interval-box\">\n          <core-field-date #GreaterThanOrEqualTo name=\"pickerMin\" fieldName=\"pickerMin\" [placeholder]=\"title + ' \u043E\u0442'\"\n          (valueChange)=\"changeDateValue($event,'GreaterThanOrEqualTo')\" class=\"sln-etp-data-value {{ smallSize ? 'sln-input-s': '' }} date-field-from\"></core-field-date>\n          <core-field-date #LessThanOrEqualTo name=\"pickerMax\" fieldName=\"pickerMax\" [placeholder]=\"title + ' \u0434\u043E'\"\n          (valueChange)=\"changeDateValue($event,'LessThanOrEqualTo')\" class=\"sln-etp-data-value {{ smallSize ? 'sln-input-s': '' }} date-field-to\"></core-field-date>\n        </div>\n      }\n      @if (dataType !== 5) {\n        <div class=\"sln-column-filter-template\">\n          <mat-form-field>\n            <mat-label class=\"sln-default-label\">{{title}}</mat-label>\n            <input matInput class=\"{{ smallSize ? 'sln-input sln-input-s': '' }}\" [placeholder]=\"title\" [value]=\"val\" (change)=\"changeValue($event.target.value)\">\n          </mat-form-field>\n          <button type=\"button\" matTooltip=\"{{isPositiveCondition ? '\u0412\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439' : '\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439'}}\" class=\"sln-column-filter-template-btn\" (click)=\"changeCond()\">\n            <div class=\"{{isPositiveCondition ? 'sln-common-input-plus' : 'sln-common-input-minus'}}\"></div>\n          </button>\n        </div>\n      }\n    }\n  </form>\n</div>\n", styles: [".sln-datetime-interval-box{display:flex;align-items:center;position:relative}.sln-datetime-interval-box core-field-date{margin-right:5px}:host-context(.grid-filter-template) .sln-datetime-interval-box core-field-date{flex:1!important;width:100%!important;max-width:calc(50% - 2.5px)!important}:host-context(.grid-filter-template) .sln-datetime-interval-box core-field-date:last-child{margin-right:0!important}\n"] }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { title: [{
                type: Input
            }], columnDef: [{
                type: Input
            }], condition: [{
                type: Input
            }], additionFields: [{
                type: Input
            }], useTemplate: [{
                type: Input
            }], component: [{
                type: Input
            }], dataType: [{
                type: Input
            }], componentTemplateMap: [{
                type: Input
            }], inputs: [{
                type: Input
            }], outputs: [{
                type: Input
            }], smallSize: [{
                type: Input
            }], changeFilterItem: [{
                type: Output
            }], refreshEvent: [{
                type: Output
            }], initEvent: [{
                type: Output
            }], host: [{
                type: ViewChild,
                args: ["host", { read: ViewContainerRef }]
            }], greaterThanOrEqualTo: [{
                type: ViewChild,
                args: ["GreaterThanOrEqualTo"]
            }], lessThanOrEqualTo: [{
                type: ViewChild,
                args: ["LessThanOrEqualTo"]
            }], value: [{
                type: Input
            }] } });

class CoreGridFiltersComponent {
    constructor() {
        this._filterEvents = [];
        this.storage = [];
        this.changeFilterItems = new EventEmitter();
    }
    getStorageValue(field) {
        if (this.notSaveFilters === true) {
            return [];
        }
        let items = this.storage.filter(i => i.systemObjectId == this.userView)[0]?.filters.filter(z => z.field == field);
        return items;
    }
    getStorageCondition(column) {
        if (this.notSaveFilters === true) {
            return column.filterCondition;
        }
        let items = this.storage.filter(i => i.systemObjectId == this.userView)[0]?.filters.filter(z => z.field == (column.filterKey ?? column.key));
        return items?.length > 0 ? items[0].condition : column.filterCondition;
    }
    addFilterEvent($event) {
        // исключаем фильтр из общего массива фильтров с учетом условия фильтрации
        Utility.removeByTwoKey(this._filterEvents, { key: 'field', value: $event.field }, { key: 'condition', value: $event.condition });
        // если используется фильтрация с альтернативным условием ее тоже нужно убрать из существующих фильтров
        const altCond = ALTERNATIVE_FILTER_CONDITIONS.find(item => item.cond === $event.condition);
        if (altCond && !_isDateRangeFilter($event)) {
            Utility.removeByTwoKey(this._filterEvents, { key: 'field', value: $event.field }, { key: 'condition', value: altCond.alt });
        }
        console.log('addFilterEvent', this._filterEvents, $event);
        this._filterEvents.push($event);
        this.changeFilterItems.emit(this._filterEvents);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridFiltersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreGridFiltersComponent, isStandalone: false, selector: "core-grid-filters", inputs: { userView: "userView", smallSize: "smallSize", notSaveFilters: "notSaveFilters", columns: "columns", componentTemplateMap: "componentTemplateMap" }, outputs: { changeFilterItems: "changeFilterItems" }, ngImport: i0, template: "<div provideParentForm [class]=\"smallSize ? 'sln-grid-filters-wrap' : ''\">\n  @for (column of columns; track column) {\n    @if (column.useFilter && (column.filterAccess === undefined || column.filterAccess() ===  true)) {\n      <core-grid-filter-template #templ\n        [smallSize]=\"smallSize\"\n        [title]=\"column.filterTitle ?? column.title\"\n        [columnDef]=\"column.filterKey ?? column.key\"\n        [additionFields]=\"column.filterAdditionKey\"\n        [dataType]=\"column.type\"\n        [useTemplate]=\"column.filterTemplate\"\n        [component]=\"column.filterTemplateType\"\n        [componentTemplateMap]=\"componentTemplateMap\"\n        \n        [condition]=\"getStorageCondition(column)\"\n        [value]=\"getStorageValue(column.filterKey ?? column.key)\"        \n       \n        [inputs]=\"column.filterTemplateTypeInputs\"\n        [outputs]=\"column.filterTemplateTypeOutputs\"\n        (changeFilterItem)=\"addFilterEvent($event)\"\n        class=\"grid-filter-template\">\n      </core-grid-filter-template>\n    }\n  }\n</div>", styles: [".sln-grid-filters-wrap{display:flex;flex-wrap:wrap;gap:0 10px}\n"], dependencies: [{ kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "component", type: CoreGridFilterTemplateComponent, selector: "core-grid-filter-template", inputs: ["title", "columnDef", "condition", "additionFields", "useTemplate", "component", "dataType", "componentTemplateMap", "inputs", "outputs", "smallSize", "value"], outputs: ["changeFilterItem", "refreshEvent", "initEvent"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridFiltersComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-grid-filters', standalone: false, template: "<div provideParentForm [class]=\"smallSize ? 'sln-grid-filters-wrap' : ''\">\n  @for (column of columns; track column) {\n    @if (column.useFilter && (column.filterAccess === undefined || column.filterAccess() ===  true)) {\n      <core-grid-filter-template #templ\n        [smallSize]=\"smallSize\"\n        [title]=\"column.filterTitle ?? column.title\"\n        [columnDef]=\"column.filterKey ?? column.key\"\n        [additionFields]=\"column.filterAdditionKey\"\n        [dataType]=\"column.type\"\n        [useTemplate]=\"column.filterTemplate\"\n        [component]=\"column.filterTemplateType\"\n        [componentTemplateMap]=\"componentTemplateMap\"\n        \n        [condition]=\"getStorageCondition(column)\"\n        [value]=\"getStorageValue(column.filterKey ?? column.key)\"        \n       \n        [inputs]=\"column.filterTemplateTypeInputs\"\n        [outputs]=\"column.filterTemplateTypeOutputs\"\n        (changeFilterItem)=\"addFilterEvent($event)\"\n        class=\"grid-filter-template\">\n      </core-grid-filter-template>\n    }\n  }\n</div>", styles: [".sln-grid-filters-wrap{display:flex;flex-wrap:wrap;gap:0 10px}\n"] }]
        }], propDecorators: { userView: [{
                type: Input
            }], smallSize: [{
                type: Input
            }], notSaveFilters: [{
                type: Input
            }], columns: [{
                type: Input
            }], componentTemplateMap: [{
                type: Input
            }], changeFilterItems: [{
                type: Output
            }] } });

class CoreGridDialogFilterComponent {
    constructor(_dialogRef, data) {
        this._dialogRef = _dialogRef;
        this.data = data;
        this._storage = [];
        this.columns = new Array();
        this.filterItems = [];
        this.init = false;
        this.componentTemplateMap = data.componentTemplateMap;
        this.columns = data.columns;
        this.userView = data.userView;
        this._storage = data.storage;
        this.beforeClosed = (closingCallback) => {
            this._handleBeforClosed(closingCallback);
        };
    }
    ngAfterViewInit() {
        this.init = true;
        if (!!this._filtersComponent) {
            this._filtersComponent.storage = this._storage;
        }
    }
    apply() {
        let emptyCount = 0;
        this.filterItems.forEach(x => {
            if (Utility.isEmpty(x.value)) {
                emptyCount++;
            }
        });
        if (emptyCount === this.filterItems.length) {
            this._dialogRef.close(null);
        }
        else {
            this._normalizeDateRanges();
            this._dialogRef.close(this.filterItems);
        }
    }
    changeFilterItems(event) {
        if (this.init === true) {
            this.filtersWasChanged = true;
        }
        this.filterItems = event;
    }
    resetFilters() {
        this._dialogRef.close(null);
    }
    _handleBeforClosed(callback) {
        const closeInternal = () => {
            this._dialogRef.close({ state: DialogReason.cancel, emmiter: 'close' });
        };
        if (this.filtersWasChanged === true) {
            const data = {
                message: 'Желаете применить установленные фильтры?',
                button: "Применить"
            };
            CoreDialog.confirm(() => {
                this.apply();
            }, closeInternal, data);
        }
        else {
            closeInternal();
        }
    }
    _normalizeDateRanges() {
        const dateFilters = this.filterItems.filter(item => Number(item.dataType) === DATE_DATA_TYPE);
        const fields = [...new Set(dateFilters.map(item => item.field))];
        fields.forEach((field) => {
            const from = dateFilters.find(item => item.field === field && item.condition === DATE_RANGE_CONDITIONS[0]);
            const to = dateFilters.find(item => item.field === field && item.condition === DATE_RANGE_CONDITIONS[1]);
            if (!from || !to || Utility.isEmpty(from.value) || Utility.isEmpty(to.value)) {
                return;
            }
            const fromDate = this._toDate(from.value);
            const toDate = this._toDate(to.value);
            if (!fromDate || !toDate) {
                return;
            }
            if (DateExtension.compare(fromDate, toDate, DateCompareOption.Date)) {
                const startOfNextDay = DateExtension.addDays(DateExtension.getDatePart(toDate), 1);
                const endOfDay = new Date(startOfNextDay.getTime() - 1);
                to.value = endOfDay.toISOString();
            }
        });
    }
    _toDate(value) {
        const parsed = new Date(value);
        return isNaN(parsed.getTime()) ? null : parsed;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridDialogFilterComponent, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreGridDialogFilterComponent, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "_filtersComponent", first: true, predicate: CoreGridFiltersComponent, descendants: true }], ngImport: i0, template: "<core-dialog [hasCansel]=\"false\" dialogTitle=\"\u0424\u0438\u043B\u044C\u0442\u0440\u044B\" width=\"700\" [showCloseConfirmDialog]=\"true\" [beforeClosed]=\"beforeClosed\">\n  <div body style=\"padding: 0 1px 0 0;\">\n    <core-grid-filters [userView]=\"userView\" [notSaveFilters]=\"false\" [columns]=\"columns\" [componentTemplateMap]=\"componentTemplateMap\" (changeFilterItems)=\"changeFilterItems($event)\"></core-grid-filters>\n  </div>\n  <div footer class=\"filter-footer\">\n    <button type=\"button\" class=\"btn-primary\" (click)=\"apply()\">\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C</button>\n    <button type=\"button\" class=\"btn-primary\" (click)=\"resetFilters()\">\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435</button>\n  </div>\n</core-dialog>", styles: [".filter-footer{display:flex}.filter-footer button{margin-left:10px;min-width:130px}.grid-filter-template{width:100%}.grid-filter-template ::ng-deep .sln-datetime-interval-box{display:flex!important;width:100%!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date{flex:1!important;width:100%!important;max-width:calc(50% - 2.5px)!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date:last-child{margin-right:0!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date .sln-field-layout{width:100%!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date mat-form-field{width:100%!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date.date-field-from,.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date.date-field-to{width:100%!important;flex:1!important}\n"], dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: CoreGridFiltersComponent, selector: "core-grid-filters", inputs: ["userView", "smallSize", "notSaveFilters", "columns", "componentTemplateMap"], outputs: ["changeFilterItems"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridDialogFilterComponent, decorators: [{
            type: Component,
            args: [{ changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<core-dialog [hasCansel]=\"false\" dialogTitle=\"\u0424\u0438\u043B\u044C\u0442\u0440\u044B\" width=\"700\" [showCloseConfirmDialog]=\"true\" [beforeClosed]=\"beforeClosed\">\n  <div body style=\"padding: 0 1px 0 0;\">\n    <core-grid-filters [userView]=\"userView\" [notSaveFilters]=\"false\" [columns]=\"columns\" [componentTemplateMap]=\"componentTemplateMap\" (changeFilterItems)=\"changeFilterItems($event)\"></core-grid-filters>\n  </div>\n  <div footer class=\"filter-footer\">\n    <button type=\"button\" class=\"btn-primary\" (click)=\"apply()\">\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C</button>\n    <button type=\"button\" class=\"btn-primary\" (click)=\"resetFilters()\">\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435</button>\n  </div>\n</core-dialog>", styles: [".filter-footer{display:flex}.filter-footer button{margin-left:10px;min-width:130px}.grid-filter-template{width:100%}.grid-filter-template ::ng-deep .sln-datetime-interval-box{display:flex!important;width:100%!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date{flex:1!important;width:100%!important;max-width:calc(50% - 2.5px)!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date:last-child{margin-right:0!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date .sln-field-layout{width:100%!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date mat-form-field{width:100%!important}.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date.date-field-from,.grid-filter-template ::ng-deep .sln-datetime-interval-box core-field-date.date-field-to{width:100%!important;flex:1!important}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }], propDecorators: { _filtersComponent: [{
                type: ViewChild,
                args: [CoreGridFiltersComponent]
            }] } });

class GridConfigutarionService {
    constructor(_startUp, _ajaxM, _context) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
        this._context = _context;
    }
    // получение данных грида для динамических представлений
    getGrid(viewKey) {
        const url = this._startUp.apiRoot('requests/grid/' + viewKey, 'bpm');
        return this._ajaxM.get({ url: url });
    }
    // получение конфигурации пользовательского представления
    getUserView(key) {
        const url = this._startUp.apiRoot('menu/user-view', 'core') + '?key=' + key;
        return this._ajaxM.get({ url: url });
    }
    // получение пользовательских настроек грида для статических представлений
    getUserColumn(systemObjectId) {
        let userId = this._context.session?.userId;
        let organizationId = this._context.session.organizations?.currentLink?.organizationId;
        let url = this._startUp.apiRoot('users/usersettings/' + userId + '/CORE_GRID_CONFIGURATION?subKey=' + systemObjectId + '&organizationId=' + organizationId, 'core');
        return this._ajaxM.get({ url: url });
    }
    // сохранение пользовательских настроек грида
    saveUserColumn(data) {
        const settings = {
            userId: data.userId ?? this._context.session?.userId,
            organizationId: this._context.session.organizations?.currentLink?.organizationId,
            key: data.isUserView ? 'BPM_REQUEST_VIEW_SOURCE' : 'CORE_GRID_CONFIGURATION',
            subKey: data.systemObjectId,
            value: data
        };
        let url = this._startUp.apiRoot('users/usersettings', 'core');
        return this._ajaxM.post({ url: url, data: settings });
    }
    // сохранение настроек грида для организации
    saveOrganizationColumn(subKey, view) {
        const settings = [{
                key: 'BPM_REQUEST_VIEW_SOURCE',
                subKey: subKey,
                fieldType: 'CustomField',
                value: JSON.stringify(view)
            }];
        const url = this._startUp.apiRoot('organizations/settings?organizationId=' + this._context.session.organizations?.currentLink?.organizationId, 'core');
        return this._ajaxM.post({ url: url, data: settings });
    }
    deleteOrganizationColumn(viewName) {
        const url = this._startUp.apiRoot('menu/organization-view?key=' + viewName, 'core');
        return this._ajaxM.delete({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridConfigutarionService, deps: [{ token: Startup }, { token: AjaxService }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridConfigutarionService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridConfigutarionService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }, { type: ContextService }] });

class CoreGridUtility {
    static order(a, b) {
        if (a.order > b.order) {
            return 1;
        }
        if (a.order < b.order) {
            return -1;
        }
        return 0;
    }
}

class CoreGridAlignButtonsComponent {
    constructor() {
        this.valuesChange = new EventEmitter();
    }
    ngOnInit() {
        if (!this.align) {
            this.align = 1;
        }
        if (!this.iconH) {
            this.iconH = 20;
        }
    }
    changeAlign(val) {
        this.align = val;
        this.valuesChange.emit(this.align);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridAlignButtonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreGridAlignButtonsComponent, isStandalone: false, selector: "core-grid-align-buttons", inputs: { align: "align", iconH: "iconH" }, outputs: { valuesChange: "valuesChange" }, ngImport: i0, template: "<div class=\"sln-grid-align-buttons\">\n    <button class=\"{{ align !== 1 ? 'light-': '' }}btn-primary sln-l\" (click)=\"changeAlign(1)\">\n        <div class=\"sln-layouts-format-align-left sln-layouts-icons-position\"></div>\n    </button>\n    <button class=\"{{ align !== 2 ? 'light-': '' }}btn-primary sln-c\" (click)=\"changeAlign(2)\">\n        <div class=\"sln-layouts-format-align-center sln-layouts-icons-position\"></div>\n    </button>\n    <button class=\"{{ align !== 3 ? 'light-': '' }}btn-primary sln-r\" (click)=\"changeAlign(3)\">\n        <div class=\"sln-layouts-format-align-right sln-layouts-icons-position\"></div>\n    </button>\n</div>", styles: [".sln-grid-align-buttons{display:flex}.sln-grid-align-buttons .light-btn-primary{background:#fff;border:2px solid var(--GRAY)}.sln-grid-align-buttons .btn-primary{background:var(--LIGHT-GRAY);border:2px solid var(--GRAY)}.sln-grid-align-buttons button{width:33.33%;min-height:30px;display:flex;align-items:center;justify-content:center}.sln-grid-align-buttons button.sln-l,.sln-grid-align-buttons button.sln-c{border-radius:4px;margin-right:3px}.sln-grid-align-buttons button.sln-r{border-radius:4px}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridAlignButtonsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-grid-align-buttons', standalone: false, template: "<div class=\"sln-grid-align-buttons\">\n    <button class=\"{{ align !== 1 ? 'light-': '' }}btn-primary sln-l\" (click)=\"changeAlign(1)\">\n        <div class=\"sln-layouts-format-align-left sln-layouts-icons-position\"></div>\n    </button>\n    <button class=\"{{ align !== 2 ? 'light-': '' }}btn-primary sln-c\" (click)=\"changeAlign(2)\">\n        <div class=\"sln-layouts-format-align-center sln-layouts-icons-position\"></div>\n    </button>\n    <button class=\"{{ align !== 3 ? 'light-': '' }}btn-primary sln-r\" (click)=\"changeAlign(3)\">\n        <div class=\"sln-layouts-format-align-right sln-layouts-icons-position\"></div>\n    </button>\n</div>", styles: [".sln-grid-align-buttons{display:flex}.sln-grid-align-buttons .light-btn-primary{background:#fff;border:2px solid var(--GRAY)}.sln-grid-align-buttons .btn-primary{background:var(--LIGHT-GRAY);border:2px solid var(--GRAY)}.sln-grid-align-buttons button{width:33.33%;min-height:30px;display:flex;align-items:center;justify-content:center}.sln-grid-align-buttons button.sln-l,.sln-grid-align-buttons button.sln-c{border-radius:4px;margin-right:3px}.sln-grid-align-buttons button.sln-r{border-radius:4px}\n"] }]
        }], propDecorators: { align: [{
                type: Input
            }], iconH: [{
                type: Input
            }], valuesChange: [{
                type: Output
            }] } });

class CoreGridConfigUserColumnDialogWindow extends CoreBaseDestroyComponent {
    getMaxContentHeight() {
        return { height: 315 + 'px' };
    }
    _isColumnAvailable(column) {
        return !column.columnAccess || !!column.columnAccess();
    }
    constructor(dialogRef, data, _dataService, _popup) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
        this._dataService = _dataService;
        this._popup = _popup;
        this.visible = [];
        this.hide = [];
        this.isInit = false;
        this._columnsOriginal = [];
        if (this.data.columns?.length > 0) {
            this._columnsOriginal = JSON.parse(JSON.stringify(this.data.columns));
            this.beforeClosed = (closingCallback) => {
                const originalColumns = new Map(this._columnsOriginal.map(column => [column.key, column]));
                this.data.columns.forEach((column) => {
                    const originalColumn = originalColumns.get(column.key);
                    if (!originalColumn) {
                        return;
                    }
                    column.align = originalColumn.align;
                    column.visible = originalColumn.visible;
                    column.order = originalColumn.order;
                });
                this.dialogRef.close(closingCallback);
            };
        }
    }
    ngOnInit() {
        if (!!this.data.columns) {
            const availableColumns = this.data.columns.filter(column => this._isColumnAvailable(column));
            this.visible = availableColumns.filter(s => !!s.visible || !!s.pinned).sort(CoreGridUtility.order);
            this.hide = availableColumns.filter(s => !s.visible && !s.pinned).sort(CoreGridUtility.order);
            this.isInit = true;
        }
        else {
            this._dataService
                .getGrid(this.getViewKey())
                .pipe(this.takeUntilDestroyed())
                .subscribe((response) => {
                this._popup.HandleIEntityResponse({
                    response: response,
                    successCallback: (data) => {
                        if (!!data.columns) {
                            const availableColumns = data.columns.filter(column => this._isColumnAvailable(column));
                            this.visible = availableColumns.filter(s => !!s.visible || !!s.pinned).sort(CoreGridUtility.order);
                            this.hide = availableColumns.filter(s => !s.visible && !s.pinned).sort(CoreGridUtility.order);
                            this.isInit = true;
                        }
                    }
                });
            });
        }
    }
    getViewKey() {
        return !!this.data.viewKey ? this.data.systemObjectId + "_" + this.data.viewKey : this.data.systemObjectId.toString();
    }
    save() {
        const columns = this.hide.concat(this.visible);
        this.dialogRef.close(columns);
    }
    drop(event) {
        if (event.previousContainer === event.container) {
            moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
        }
        else {
            const draggedItem = event.previousContainer.data[event.previousIndex];
            if (draggedItem?.pinned) {
                return;
            }
            transferArrayItem(event.previousContainer.data, event.container.data, event.previousIndex, event.currentIndex);
        }
        this.visible.forEach((z, index) => {
            z.visible = true;
            z.order = index;
        });
        this.hide.forEach((z, index) => {
            z.visible = false;
            z.order = index;
        });
    }
    onAlignChange($event, item) {
        item.align = $event;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridConfigUserColumnDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: GridConfigutarionService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreGridConfigUserColumnDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u043A\u043E\u043B\u043E\u043D\u043E\u043A\" width=\"800\" [showCloseConfirmDialog]=\"true\" [beforeClosed]=\"beforeClosed\">\n  <div body>\n    @if (isInit) {\n      <div class=\"sln-user-columns-dialog\">\n        <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n          <div class=\"sln-show-border-line\"><span> \u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u043C\u044B\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438</span></div>\n          <ng-scrollbar [ngStyle]=\"getMaxContentHeight()\">\n            <div class=\"column-items\">\n              <div cdkDropList #todoList=\"cdkDropList\" [cdkDropListData]=\"visible\" [cdkDropListConnectedTo]=\"[doneList]\" class=\"sln-col-list\" (cdkDropListDropped)=\"drop($event)\">\n                @for (item of visible; track item) {\n                  <div class=\"sln-col-box\" [class.sln-col-box--pinned]=\"item.pinned\" cdkDrag [cdkDragData]=\"item\">\n                    <div class=\"sln-col-box__label\" title=\"\u041A\u043E\u043B\u043E\u043D\u043A\u0430 \u0437\u0430\u043A\u0440\u0435\u043F\u043B\u0435\u043D\u0430 \u0438 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0441\u043A\u0440\u044B\u0442\u0430\">\n                      @if (item.pinned) {\n                        <svg class=\"sln-col-lock-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n                          <path d=\"M17 8h-1V6A4 4 0 0 0 8 6v2H7a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2zm-5 8a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm3-8h-6V6a3 3 0 1 1 6 0v2z\"/>\n                        </svg>\n                      }\n                      <small>{{item.description ?? item.title}}</small>\n                    </div>\n                    <core-grid-align-buttons [align]=\"item.align\" [iconH]=\"18\" (valuesChange)=\"onAlignChange($event, item)\"></core-grid-align-buttons>\n                  </div>\n                }\n              </div>\n            </div>\n          </ng-scrollbar>\n        </div>\n        <div class=\"col-md-6 sln-padding-right\">\n          <div class=\"sln-hide-border-line\"><span>\u0421\u043A\u0440\u044B\u0442\u044B\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438</span></div>\n          <ng-scrollbar [ngStyle]=\"getMaxContentHeight()\">\n            <div class=\"column-items\">\n              <div cdkDropList #doneList=\"cdkDropList\" [cdkDropListData]=\"hide\" [cdkDropListConnectedTo]=\"[todoList]\"  class=\"sln-col-list\" (cdkDropListDropped)=\"drop($event)\">\n                @for (item of hide; track item) {\n                  <div class=\"sln-col-box\" cdkDrag>\n                    <small>{{item.description ?? item.title}}</small>\n                  </div>\n                }\n              </div>\n            </div>\n          </ng-scrollbar>\n        </div>\n      </div>\n    }\n  </div>\n  <div footer>\n    <button type=\"button\" class=\"btn-primary\" (click)=\"save()\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n  </div>\n</core-dialog>\n", styles: [".sln-show-border-line{text-align:center;position:relative;color:var(--MIDLE-GRAY);text-transform:uppercase}.sln-show-border-line span{font-size:13px}.sln-show-border-line:before{content:\"\";border-bottom:1px solid #888!important;opacity:.3;width:22%;position:absolute;left:0%;bottom:8px}.sln-show-border-line:after{content:\"\";border-bottom:1px solid #888!important;opacity:.3;width:22%;position:absolute;right:0%;bottom:8px}.sln-hide-border-line{text-align:center;position:relative;color:var(--MIDLE-GRAY);text-transform:uppercase}.sln-hide-border-line span{font-size:12px}.sln-hide-border-line:before{content:\"\";border-bottom:1px solid #888!important;opacity:.3;width:30%;position:absolute;left:0%;bottom:8px}.sln-hide-border-line:after{content:\"\";border-bottom:1px solid #888!important;opacity:.3;width:30%;position:absolute;right:0%;bottom:8px}.sln-col-list{border:solid 1px #ccc;min-height:60px;background:#fff;border-radius:4px;overflow:hidden;display:block}.sln-col-box{display:flex;justify-content:space-between;align-items:center;padding:5px 10px;border-bottom:solid 1px #ccc;color:var(--DARK-GREY);cursor:move;font-size:15px}.sln-col-box small{font-family:var(--font-medium)}.sln-col-box.sln-col-box--pinned{background-color:var(--LIGHT-GRAY, #f5f5f5)}.sln-col-box__label{display:flex;align-items:center;gap:6px;overflow:hidden}.sln-col-lock-icon{width:14px;height:14px;flex-shrink:0;color:var(--MIDLE-GRAY, #888)}.sln-user-columns-dialog .sln-padding-right{padding-right:0}.sln-user-columns-dialog .sln-padding-lef{padding-left:0}.sln-user-columns-dialog .column-items{padding:10px}::ng-deep bpm-grid-align-buttons>.sln-grid-align-buttons button{height:10px;min-height:23px!important}\n"], dependencies: [{ kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "directive", type: i2$4.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2$4.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: CoreGridAlignButtonsComponent, selector: "core-grid-align-buttons", inputs: ["align", "iconH"], outputs: ["valuesChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridConfigUserColumnDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u043A\u043E\u043B\u043E\u043D\u043E\u043A\" width=\"800\" [showCloseConfirmDialog]=\"true\" [beforeClosed]=\"beforeClosed\">\n  <div body>\n    @if (isInit) {\n      <div class=\"sln-user-columns-dialog\">\n        <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n          <div class=\"sln-show-border-line\"><span> \u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u043C\u044B\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438</span></div>\n          <ng-scrollbar [ngStyle]=\"getMaxContentHeight()\">\n            <div class=\"column-items\">\n              <div cdkDropList #todoList=\"cdkDropList\" [cdkDropListData]=\"visible\" [cdkDropListConnectedTo]=\"[doneList]\" class=\"sln-col-list\" (cdkDropListDropped)=\"drop($event)\">\n                @for (item of visible; track item) {\n                  <div class=\"sln-col-box\" [class.sln-col-box--pinned]=\"item.pinned\" cdkDrag [cdkDragData]=\"item\">\n                    <div class=\"sln-col-box__label\" title=\"\u041A\u043E\u043B\u043E\u043D\u043A\u0430 \u0437\u0430\u043A\u0440\u0435\u043F\u043B\u0435\u043D\u0430 \u0438 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0441\u043A\u0440\u044B\u0442\u0430\">\n                      @if (item.pinned) {\n                        <svg class=\"sln-col-lock-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n                          <path d=\"M17 8h-1V6A4 4 0 0 0 8 6v2H7a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2zm-5 8a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm3-8h-6V6a3 3 0 1 1 6 0v2z\"/>\n                        </svg>\n                      }\n                      <small>{{item.description ?? item.title}}</small>\n                    </div>\n                    <core-grid-align-buttons [align]=\"item.align\" [iconH]=\"18\" (valuesChange)=\"onAlignChange($event, item)\"></core-grid-align-buttons>\n                  </div>\n                }\n              </div>\n            </div>\n          </ng-scrollbar>\n        </div>\n        <div class=\"col-md-6 sln-padding-right\">\n          <div class=\"sln-hide-border-line\"><span>\u0421\u043A\u0440\u044B\u0442\u044B\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438</span></div>\n          <ng-scrollbar [ngStyle]=\"getMaxContentHeight()\">\n            <div class=\"column-items\">\n              <div cdkDropList #doneList=\"cdkDropList\" [cdkDropListData]=\"hide\" [cdkDropListConnectedTo]=\"[todoList]\"  class=\"sln-col-list\" (cdkDropListDropped)=\"drop($event)\">\n                @for (item of hide; track item) {\n                  <div class=\"sln-col-box\" cdkDrag>\n                    <small>{{item.description ?? item.title}}</small>\n                  </div>\n                }\n              </div>\n            </div>\n          </ng-scrollbar>\n        </div>\n      </div>\n    }\n  </div>\n  <div footer>\n    <button type=\"button\" class=\"btn-primary\" (click)=\"save()\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n  </div>\n</core-dialog>\n", styles: [".sln-show-border-line{text-align:center;position:relative;color:var(--MIDLE-GRAY);text-transform:uppercase}.sln-show-border-line span{font-size:13px}.sln-show-border-line:before{content:\"\";border-bottom:1px solid #888!important;opacity:.3;width:22%;position:absolute;left:0%;bottom:8px}.sln-show-border-line:after{content:\"\";border-bottom:1px solid #888!important;opacity:.3;width:22%;position:absolute;right:0%;bottom:8px}.sln-hide-border-line{text-align:center;position:relative;color:var(--MIDLE-GRAY);text-transform:uppercase}.sln-hide-border-line span{font-size:12px}.sln-hide-border-line:before{content:\"\";border-bottom:1px solid #888!important;opacity:.3;width:30%;position:absolute;left:0%;bottom:8px}.sln-hide-border-line:after{content:\"\";border-bottom:1px solid #888!important;opacity:.3;width:30%;position:absolute;right:0%;bottom:8px}.sln-col-list{border:solid 1px #ccc;min-height:60px;background:#fff;border-radius:4px;overflow:hidden;display:block}.sln-col-box{display:flex;justify-content:space-between;align-items:center;padding:5px 10px;border-bottom:solid 1px #ccc;color:var(--DARK-GREY);cursor:move;font-size:15px}.sln-col-box small{font-family:var(--font-medium)}.sln-col-box.sln-col-box--pinned{background-color:var(--LIGHT-GRAY, #f5f5f5)}.sln-col-box__label{display:flex;align-items:center;gap:6px;overflow:hidden}.sln-col-lock-icon{width:14px;height:14px;flex-shrink:0;color:var(--MIDLE-GRAY, #888)}.sln-user-columns-dialog .sln-padding-right{padding-right:0}.sln-user-columns-dialog .sln-padding-lef{padding-left:0}.sln-user-columns-dialog .column-items{padding:10px}::ng-deep bpm-grid-align-buttons>.sln-grid-align-buttons button{height:10px;min-height:23px!important}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: GridConfigutarionService }, { type: PopupResults }] });

var ExportMode;
(function (ExportMode) {
    ExportMode[ExportMode["OnlyVisible"] = 1] = "OnlyVisible";
    ExportMode[ExportMode["All"] = 2] = "All";
})(ExportMode || (ExportMode = {}));
var ViewMode;
(function (ViewMode) {
    ViewMode[ViewMode["Default"] = 1] = "Default";
    ViewMode[ViewMode["Card"] = 2] = "Card";
})(ViewMode || (ViewMode = {}));

class CoreGridExportModeDialogWindow {
    constructor(_dialogRef) {
        this._dialogRef = _dialogRef;
        this.mode = ExportMode.OnlyVisible;
    }
    okClick() {
        this._dialogRef.close(this.mode);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridExportModeDialogWindow, deps: [{ token: i1$8.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreGridExportModeDialogWindow, isStandalone: false, selector: "ng-component", ngImport: i0, template: "<core-dialog dialogTitle=\"\u0420\u0435\u0436\u0438\u043C \u0432\u044B\u0433\u0440\u0443\u0437\u043A\u0438\" [hasCansel]=\"false\" width=\"500\">\n    <div body>\n        <mat-radio-group [(ngModel)]=\"mode\"  name=\"mode\" class=\"radio-group\">\n            <mat-radio-button [value]=\"1\">\u0412\u0438\u0434\u0438\u043C\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438</mat-radio-button>\n            <mat-radio-button [value]=\"2\">\u0412\u0441\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438</mat-radio-button>\n        </mat-radio-group>\n    </div>\n    <div footer>\n        <button type=\"button\" class=\"btn-primary\" (click)=\"okClick()\">OK</button>\n    </div>\n</core-dialog>", styles: [".radio-group{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:5px}\n"], dependencies: [{ kind: "directive", type: i3$3.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i3$3.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: 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: CoreGridExportModeDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0420\u0435\u0436\u0438\u043C \u0432\u044B\u0433\u0440\u0443\u0437\u043A\u0438\" [hasCansel]=\"false\" width=\"500\">\n    <div body>\n        <mat-radio-group [(ngModel)]=\"mode\"  name=\"mode\" class=\"radio-group\">\n            <mat-radio-button [value]=\"1\">\u0412\u0438\u0434\u0438\u043C\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438</mat-radio-button>\n            <mat-radio-button [value]=\"2\">\u0412\u0441\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438</mat-radio-button>\n        </mat-radio-group>\n    </div>\n    <div footer>\n        <button type=\"button\" class=\"btn-primary\" (click)=\"okClick()\">OK</button>\n    </div>\n</core-dialog>", styles: [".radio-group{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:5px}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }] });

class CoreUserViewDialogWindow {
    get isCanShare() {
        return this.view.needShare === false || this.view.creator?.id === this._context.session.userId;
    }
    constructor(_dialogRef, data, _context) {
        this._dialogRef = _dialogRef;
        this.data = data;
        this._context = _context;
        this.view = {
            isEditable: true,
            creator: undefined,
            title: '',
            needShare: false,
            useForAll: true,
            users: [],
            useAdminList: false,
            adminList: []
        };
        if (!Utility.isEmpty(this.data)) {
            this.view = this.data;
        }
    }
    ngOnInit() {
        if (Utility.isEmpty(this.view.creator)) {
            this.view.creator = {
                id: this._context.session.userId,
                text: this._context.session.name
            };
        }
    }
    onNeedShareChange(event) {
        if (event === false) {
            this.view.useForAll = true;
            this.view.useAdminList = false;
        }
    }
    onUseForAllChange(event) {
        if (event === true) {
            this.view.users = [];
        }
    }
    onUseAdminListChange(event) {
        if (event === true) {
            this.view.adminList = [];
        }
    }
    save() {
        if (Utility.isEmpty(this.view.key)) {
            this.view.key = StringExtension.translate(this.view.title).toLocaleLowerCase();
        }
        this._dialogRef.close(this.view);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUserViewDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreUserViewDialogWindow, isStandalone: false, selector: "ng-component", ngImport: i0, template: "<core-dialog dialogTitle=\"\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435\" width=\"500\">\n  <div body>\n    <form #currentForm=\"ngForm\" novalidate>\n      <div class=\"row\">\n        <div class=\"col-md-12\">\n          <core-field-string [(ngModel)]=\"view.title\" name=\"viewTitle\" fieldName=\"viewTitle\" placeholder=\"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u044F\" [disabled]=\"view.isEditable === false\"\n          [settings]=\"{ isRequired: true, maxLength: 50, rightHintHide: true, informerText: '\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F \u043A\u0430\u043A \u043A\u043B\u044E\u0447 \u0434\u043B\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u044F', useInformer: true }\"></core-field-string>\n        </div>\n        @if (view.isEditable === true) {\n          @if (isCanShare) {\n            <div class=\"col-md-12\">\n              <core-field-bool [(ngModel)]=\"view.needShare\" name=\"needShare\" fieldName=\"needShare\" placeholder=\"\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u044C\u0441\u044F \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435\u043C\"\n              [settings]=\"{  mode: 'Slide' }\" (valueChange)=\"onNeedShareChange($event)\"></core-field-bool>\n            </div>\n          }\n          @if (view.needShare === true) {\n            <div class=\"col-md-12\">\n              <core-field-bool [(ngModel)]=\"view.useForAll\" name=\"useForAll\" fieldName=\"useForAll\" placeholder=\"\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u044C\u0441\u044F \u0441\u043E \u0432\u0441\u0435\u043C\u0438\"\n              [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onUseForAllChange($event)\"></core-field-bool>\n            </div>\n            @if (view.useForAll === false) {\n              <div class=\"col-md-12\">\n                <core-field-multiple-combobox [(ngModel)]=\"view.users\" name=\"users\" fieldName=\"users\" placeholder=\"\u0421\u0434\u0435\u043B\u0430\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u043C \u0434\u043B\u044F\"\n                [settings]=\"{ sourceCode: 'Users', isRequired: true, hideSearch: true, recordCount: 500 }\"></core-field-multiple-combobox>\n              </div>\n            }\n            <div class=\"col-md-12\">\n              <core-field-bool [(ngModel)]=\"view.useAdminList\" name=\"useAdminList\" fieldName=\"useAdminList\" placeholder=\"\u0417\u0430\u0434\u0430\u0442\u044C \u0441\u043F\u0438\u0441\u043E\u043A \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u043E\u0432\"\n              [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onUseAdminListChange($event)\"></core-field-bool>\n            </div>\n            @if (view.useAdminList === true) {\n              <div class=\"col-md-12\">\n                <core-field-multiple-combobox [(ngModel)]=\"view.adminList\" name=\"adminList\" fieldName=\"adminList\" placeholder=\"\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u044B\"\n                [settings]=\"{ sourceCode: 'Users', isRequired: true, hideSearch: true, recordCount: 500 }\"></core-field-multiple-combobox>\n              </div>\n            }\n          }\n        }\n\n        @if (view.isEditable === false) {\n          <div class=\"col-md-12\">\n            <p class=\"sln-alert sln-alert-warning\">\n              \u0423 \u0432\u0430\u0441 \u043D\u0435\u0442 \u043F\u0440\u0430\u0432 \u043D\u0430 \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u044F. \u0415\u0441\u043B\u0438 \u0432\u044B \u0445\u043E\u0442\u0438\u0442\u0435 \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435, \u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u043A \u0441\u043E\u0437\u0434\u0430\u0442\u0435\u043B\u044E {{view.creator.text}}.\n              @if (view.useAdminList === true && view.adminList.length > 0) {\n                <span>\n                  \u0412\u044B \u0442\u0430\u043A \u0436\u0435 \u043C\u043E\u0436\u0435\u0442\u0435 \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u044C\u0441\u044F \u043A \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430\u043C:\n                </span>\n              }\n              @for (admin of view.adminList; track admin) {\n                <span>\n                  {{admin.text}}@if (admin !== view.adminList[view.adminList.length - 1]) {\n                  <span>, </span>\n                }\n              </span>\n            }\n          </p>\n        </div>\n      }\n    </div>\n  </form>\n</div>\n<div footer>\n  @if (view.isEditable === true) {\n    <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"currentForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n  }\n</div>\n</core-dialog>\n", styles: [""], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldTypeMultipleComboboxComponent, selector: "core-field-multiple-combobox" }, { kind: "component", type: 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: CoreUserViewDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435\" width=\"500\">\n  <div body>\n    <form #currentForm=\"ngForm\" novalidate>\n      <div class=\"row\">\n        <div class=\"col-md-12\">\n          <core-field-string [(ngModel)]=\"view.title\" name=\"viewTitle\" fieldName=\"viewTitle\" placeholder=\"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u044F\" [disabled]=\"view.isEditable === false\"\n          [settings]=\"{ isRequired: true, maxLength: 50, rightHintHide: true, informerText: '\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F \u043A\u0430\u043A \u043A\u043B\u044E\u0447 \u0434\u043B\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u044F', useInformer: true }\"></core-field-string>\n        </div>\n        @if (view.isEditable === true) {\n          @if (isCanShare) {\n            <div class=\"col-md-12\">\n              <core-field-bool [(ngModel)]=\"view.needShare\" name=\"needShare\" fieldName=\"needShare\" placeholder=\"\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u044C\u0441\u044F \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435\u043C\"\n              [settings]=\"{  mode: 'Slide' }\" (valueChange)=\"onNeedShareChange($event)\"></core-field-bool>\n            </div>\n          }\n          @if (view.needShare === true) {\n            <div class=\"col-md-12\">\n              <core-field-bool [(ngModel)]=\"view.useForAll\" name=\"useForAll\" fieldName=\"useForAll\" placeholder=\"\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u044C\u0441\u044F \u0441\u043E \u0432\u0441\u0435\u043C\u0438\"\n              [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onUseForAllChange($event)\"></core-field-bool>\n            </div>\n            @if (view.useForAll === false) {\n              <div class=\"col-md-12\">\n                <core-field-multiple-combobox [(ngModel)]=\"view.users\" name=\"users\" fieldName=\"users\" placeholder=\"\u0421\u0434\u0435\u043B\u0430\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u043C \u0434\u043B\u044F\"\n                [settings]=\"{ sourceCode: 'Users', isRequired: true, hideSearch: true, recordCount: 500 }\"></core-field-multiple-combobox>\n              </div>\n            }\n            <div class=\"col-md-12\">\n              <core-field-bool [(ngModel)]=\"view.useAdminList\" name=\"useAdminList\" fieldName=\"useAdminList\" placeholder=\"\u0417\u0430\u0434\u0430\u0442\u044C \u0441\u043F\u0438\u0441\u043E\u043A \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u043E\u0432\"\n              [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onUseAdminListChange($event)\"></core-field-bool>\n            </div>\n            @if (view.useAdminList === true) {\n              <div class=\"col-md-12\">\n                <core-field-multiple-combobox [(ngModel)]=\"view.adminList\" name=\"adminList\" fieldName=\"adminList\" placeholder=\"\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u044B\"\n                [settings]=\"{ sourceCode: 'Users', isRequired: true, hideSearch: true, recordCount: 500 }\"></core-field-multiple-combobox>\n              </div>\n            }\n          }\n        }\n\n        @if (view.isEditable === false) {\n          <div class=\"col-md-12\">\n            <p class=\"sln-alert sln-alert-warning\">\n              \u0423 \u0432\u0430\u0441 \u043D\u0435\u0442 \u043F\u0440\u0430\u0432 \u043D\u0430 \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u044F. \u0415\u0441\u043B\u0438 \u0432\u044B \u0445\u043E\u0442\u0438\u0442\u0435 \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435, \u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u043A \u0441\u043E\u0437\u0434\u0430\u0442\u0435\u043B\u044E {{view.creator.text}}.\n              @if (view.useAdminList === true && view.adminList.length > 0) {\n                <span>\n                  \u0412\u044B \u0442\u0430\u043A \u0436\u0435 \u043C\u043E\u0436\u0435\u0442\u0435 \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u044C\u0441\u044F \u043A \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430\u043C:\n                </span>\n              }\n              @for (admin of view.adminList; track admin) {\n                <span>\n                  {{admin.text}}@if (admin !== view.adminList[view.adminList.length - 1]) {\n                  <span>, </span>\n                }\n              </span>\n            }\n          </p>\n        </div>\n      }\n    </div>\n  </form>\n</div>\n<div footer>\n  @if (view.isEditable === true) {\n    <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"currentForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n  }\n</div>\n</core-dialog>\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: ContextService }] });

class StorageDataGridFilter {
    constructor(userId, objId, filters) {
        this.userId = userId;
        this.systemObjectId = objId,
            this.filters = filters;
    }
}

class GridStoreService {
    constructor(_storage, _context) {
        this._storage = _storage;
        this._context = _context;
        this.GRID_STORE_KEY = 'GridFilterData';
    }
    read(userView, notSaveFilters) {
        if (notSaveFilters === true) {
            return [];
        }
        const userId = this._context.session?.userId;
        return JSON.parse(this._storage.getItem(this.GRID_STORE_KEY))
            ?.filter(i => !!i.filters && i.userId === userId && i.systemObjectId === userView) ?? [];
    }
    write(userView, filters) {
        let f = new Array();
        if (!Utility.isEmpty(filters) && filters.length > 0) {
            f.push(...filters);
        }
        else {
            filters = [];
        }
        const userId = this._context.session?.userId;
        const filterData = this._storage.getItem(this.GRID_STORE_KEY);
        if (!!filterData) {
            let items = JSON.parse(filterData)
                .filter(z => z.userId === userId && z.systemObjectId !== userView)
                .concat(new StorageDataGridFilter(userId, userView, filters));
            this._storage.setItem(this.GRID_STORE_KEY, JSON.stringify(items));
        }
        else {
            let items = new Array(new StorageDataGridFilter(userId, userView, filters));
            this._storage.setItem(this.GRID_STORE_KEY, JSON.stringify(items));
        }
    }
    clear(userView) {
        const userId = this._context.session?.userId;
        const filterData = this._storage.getItem(this.GRID_STORE_KEY);
        if (!!filterData) {
            const items = JSON.parse(filterData).filter(i => i.userId !== userId || i.systemObjectId !== userView);
            this._storage.setItem(this.GRID_STORE_KEY, JSON.stringify(items));
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridStoreService, deps: [{ token: BrowserLocalStorage }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridStoreService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridStoreService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: BrowserLocalStorage }, { type: ContextService }] });

class CoreGirdDynamicPipe {
    constructor(_injector) {
        this._injector = _injector;
    }
    transform(value, pipeToken, pipeArgs) {
        if (!pipeToken) {
            return value;
        }
        else {
            let pipe = this._injector.get(pipeToken);
            if (!!pipeArgs) {
                return pipe.transform(value, ...pipeArgs);
            }
            return pipe.transform(value);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGirdDynamicPipe, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreGirdDynamicPipe, isStandalone: false, name: "dynamicPipe" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGirdDynamicPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'dynamicPipe',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

class CoreGridColumnResizeDirective {
    constructor(el, renderer) {
        this.el = el;
        this.renderer = renderer;
        // Событие, которое сработает при отпускании мыши
        this.columnResized = new EventEmitter();
        this.startX = 0;
        this.startWidth = 0;
        this.isResizing = false;
        this.minColumnWidth = 8;
        this.resizeZoneWidth = 12;
        this.currentResizeMinWidth = this.minColumnWidth;
        this.pendingWidth = 0;
        this.appliedWidth = 0;
        this.resizeRafId = null;
        this.suppressSortClick = false;
        this.unlisteners = [];
    }
    ngOnInit() {
        if (!this.columnObj) {
            return;
        }
        // Для абсолютного позиционирования resize-handle внутри текущего заголовка
        this.renderer.setStyle(this.el.nativeElement, 'position', 'relative');
        this.renderer.addClass(this.el.nativeElement, 'sln-resizable-column');
        // Устанавливаем начальную ширину из данных объекта
        if (this.columnObj?.width) {
            this.renderer.setStyle(this.el.nativeElement, 'width', `${this.columnObj.width}px`);
        }
        // Ловим события прямо на th, чтобы не конфликтовать с mat-sort-header.
        this.unlisteners.push(this.renderer.listen(this.el.nativeElement, 'mousemove', (event) => this.onHostMouseMove(event)));
        this.unlisteners.push(this.renderer.listen(this.el.nativeElement, 'mouseleave', () => this.onHostMouseLeave()));
        this.unlisteners.push(this.renderer.listen(this.el.nativeElement, 'mousedown', (event) => this.onHostMouseDown(event)));
        // В capture-phase гасим click от завершения resize до того, как его поймает mat-sort-header.
        this.captureClickHandler = (event) => this.onHostClickCapture(event);
        this.el.nativeElement.addEventListener('click', this.captureClickHandler, true);
    }
    ngOnDestroy() {
        this.unlisteners.forEach(unlisten => unlisten());
        this.unlisteners = [];
        if (this.captureClickHandler) {
            this.el.nativeElement.removeEventListener('click', this.captureClickHandler, true);
        }
        this.cancelResizeRaf();
    }
    onHostMouseMove(event) {
        if (this.isResizing) {
            return;
        }
        const isResizeZone = this.isInResizeZone(event);
        this.renderer[isResizeZone ? 'addClass' : 'removeClass'](this.el.nativeElement, 'sln-resize-hover');
    }
    onHostMouseLeave() {
        if (!this.isResizing) {
            this.renderer.removeClass(this.el.nativeElement, 'sln-resize-hover');
        }
    }
    onHostMouseDown(event) {
        if (!this.isInResizeZone(event)) {
            return;
        }
        this.suppressSortClick = true;
        this.onMouseDown(event);
    }
    onHostClickCapture(event) {
        if (!this.suppressSortClick) {
            return;
        }
        event.preventDefault();
        event.stopPropagation();
        if (event.stopImmediatePropagation) {
            event.stopImmediatePropagation();
        }
        this.suppressSortClick = false;
    }
    isInResizeZone(event) {
        const rect = this.el.nativeElement.getBoundingClientRect();
        return (rect.right - event.clientX) <= this.resizeZoneWidth;
    }
    onMouseDown(event) {
        event.stopPropagation();
        this.isResizing = true;
        this.startX = event.clientX;
        const modelWidth = Number(this.columnObj?.width);
        this.startWidth = Number.isFinite(modelWidth) && modelWidth > 0
            ? modelWidth
            : this.el.nativeElement.getBoundingClientRect().width;
        if (this.columnObj) {
            this.columnObj.width = this.startWidth;
        }
        this.pendingWidth = this.startWidth;
        this.appliedWidth = this.startWidth;
        this.renderer.setStyle(document.body, 'cursor', 'col-resize');
        this.renderer.setStyle(document.body, 'user-select', 'none');
        event.preventDefault();
        // Глобальные слушатели для плавности
        const mouseMoveSub = this.renderer.listen('document', 'mousemove', (e) => this.onMouseMove(e));
        const mouseUpSub = this.renderer.listen('document', 'mouseup', () => {
            this.onMouseUp();
            mouseMoveSub(); // Отписка
            mouseUpSub(); // Отписка
        });
    }
    onMouseMove(event) {
        if (this.isResizing) {
            const diff = event.clientX - this.startX;
            this.pendingWidth = Math.max(this.currentResizeMinWidth, this.startWidth + diff);
            this.scheduleResizeFrame();
        }
    }
    onMouseUp() {
        if (this.isResizing) {
            this.cancelResizeRaf();
            this.applyWidth(this.pendingWidth);
            this.isResizing = false;
            this.renderer.removeStyle(document.body, 'cursor');
            this.renderer.removeStyle(document.body, 'user-select');
            this.renderer.removeClass(this.el.nativeElement, 'sln-resize-hover');
            // Передаем обновленный объект в главный компонент для сохранения
            this.columnResized.emit(this.columnObj);
            // Держим флаг до конца текущего цикла, чтобы погасить click после mouseup.
            setTimeout(() => {
                this.suppressSortClick = false;
            }, 0);
        }
    }
    scheduleResizeFrame() {
        if (this.resizeRafId !== null) {
            return;
        }
        this.resizeRafId = requestAnimationFrame(() => {
            this.resizeRafId = null;
            this.applyWidth(this.pendingWidth);
        });
    }
    cancelResizeRaf() {
        if (this.resizeRafId !== null) {
            cancelAnimationFrame(this.resizeRafId);
            this.resizeRafId = null;
        }
    }
    applyWidth(width) {
        const roundedWidth = Math.round(width * 100) / 100;
        if (roundedWidth === this.appliedWidth) {
            return;
        }
        this.appliedWidth = roundedWidth;
        this.renderer.setStyle(this.el.nativeElement, 'width', `${roundedWidth}px`);
        if (this.columnObj) {
            this.columnObj.width = roundedWidth;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridColumnResizeDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: CoreGridColumnResizeDirective, isStandalone: true, selector: "[grid-column-resize]", inputs: { columnObj: ["grid-column-resize", "columnObj"] }, outputs: { columnResized: "columnResized" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridColumnResizeDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[grid-column-resize]'
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { columnObj: [{
                type: Input,
                args: ['grid-column-resize']
            }], columnResized: [{
                type: Output
            }] } });

class CoreGridColumnTemplateComponent {
    static { this._moduleCache = new Map(); }
    constructor(cdref) {
        this.cdref = cdref;
        this._isInit = false;
        this.refreshEvent = new EventEmitter();
        this.multiRunEvent = new EventEmitter();
        this.multiProgressEvent = new EventEmitter();
        this.multiFinishEvent = new EventEmitter();
    }
    ngAfterViewInit() {
        this.render();
    }
    async render() {
        if (this._isInit || !this.component) {
            return;
        }
        this.host.clear();
        let ref;
        if (DataGridComponentTemplate.isIDataGridComponentTemplate(this.component)) {
            if (this.component.isRemote) {
                const cacheKey = `${this.component.remoteName}:${this.component.remoteExposedModule}`;
                let module;
                if (CoreGridColumnTemplateComponent._moduleCache.has(cacheKey)) {
                    module = CoreGridColumnTemplateComponent._moduleCache.get(cacheKey);
                }
                else {
                    module = await loadRemoteModule({
                        remoteName: this.component.remoteName,
                        exposedModule: this.component.remoteExposedModule
                    });
                    CoreGridColumnTemplateComponent._moduleCache.set(cacheKey, module);
                }
                ref = this.host.createComponent(module[this.component.remoteComponent]);
            }
            else {
                if (Utility.isEmpty(this.componentTemplateMap)) {
                    throw new Error('Словарь "componentTemplateMap", для формирования динамического компонента, не задан');
                }
                const componentClass = this.componentTemplateMap.get(this.component.remoteComponent);
                ref = this.host.createComponent(componentClass);
            }
        }
        else {
            ref = this.host.createComponent(this.component);
        }
        ref.instance.row = this.value;
        if (!!this.inputs) {
            this.inputs.forEach((value, key) => {
                if (typeof value === 'function') {
                    ref.instance[key] = value(ref.instance.row);
                }
                else {
                    ref.instance[key] = value;
                }
            });
        }
        ref.changeDetectorRef?.detectChanges();
        if (!!this.outputs) {
            this.outputs.forEach((value, key) => {
                ref.instance[key].subscribe((row) => {
                    value(row);
                });
            });
        }
        if (!!ref.instance.refreshEvent) {
            ref.instance.refreshEvent.subscribe((val) => {
                this.refreshEvent.emit(val);
            });
        }
        if (!!ref.instance.multiRunEvent) {
            ref.instance.multiRunEvent.subscribe((val) => {
                this.multiRunEvent.emit(val);
            });
        }
        if (!!ref.instance.multiProgressEvent) {
            ref.instance.multiProgressEvent.subscribe((val) => {
                this.multiProgressEvent.emit(val);
            });
        }
        if (!!ref.instance.multiFinishEvent) {
            ref.instance.multiFinishEvent.subscribe((callback) => {
                this.multiFinishEvent.emit(callback);
            });
        }
        this.cdref.markForCheck();
        this._isInit = true;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridColumnTemplateComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreGridColumnTemplateComponent, isStandalone: false, selector: "core-grid-column-template", inputs: { component: "component", inputs: "inputs", outputs: "outputs", value: "value", componentTemplateMap: "componentTemplateMap" }, outputs: { refreshEvent: "refreshEvent", multiRunEvent: "multiRunEvent", multiProgressEvent: "multiProgressEvent", multiFinishEvent: "multiFinishEvent" }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<ng-template #host></ng-template>", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridColumnTemplateComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-grid-column-template', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ng-template #host></ng-template>" }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { component: [{
                type: Input
            }], inputs: [{
                type: Input
            }], outputs: [{
                type: Input
            }], value: [{
                type: Input
            }], componentTemplateMap: [{
                type: Input
            }], refreshEvent: [{
                type: Output
            }], multiRunEvent: [{
                type: Output
            }], multiProgressEvent: [{
                type: Output
            }], multiFinishEvent: [{
                type: Output
            }], host: [{
                type: ViewChild,
                args: ["host", { read: ViewContainerRef }]
            }] } });

class DoubleScrollbarsComponent {
    constructor(cdref) {
        this.cdref = cdref;
        this.doubleScrollBarHorizontal = '';
        this.isSticky = false;
        this.wrapper2scrollWidth = '';
        this.hasHorizontalScroll = false; // Есть ли горизонтальный скролл
    }
    ngAfterViewInit() {
        this.updateWrapperWidth();
        this.cdref.detectChanges();
        this.resizeObserver = new ResizeObserver(() => this.applyWrapperWidthFromMain());
        this.resizeObserver.observe(this.mainDiv.nativeElement);
        // Отслеживаем, когда sentinel выходит из области видимости
        this.intersectionObserver = new IntersectionObserver(([entry]) => {
            this.isSticky = !entry.isIntersecting; // если якорь пропал — прилипли
            this.cdref.detectChanges();
        }, { threshold: [0] });
        this.intersectionObserver.observe(this.sentinel.nativeElement);
        //  микротаска для отслеживания изменений ширины контента
        queueMicrotask(() => this.attachContentResizeObserver());
    }
    applyWrapperWidthFromMain() {
        const changed = this.updateWrapperWidth();
        if (changed) {
            this.cdref.detectChanges();
        }
    }
    // ВОЗВРАЩАЕТ true, если изменились поля, влияющие на шаблон.
    updateWrapperWidth() {
        const main = this.mainDiv.nativeElement;
        const mainScrollWidth = main.scrollWidth;
        const mainClientWidth = main.clientWidth;
        const nextWidth = `${mainScrollWidth}px`;
        const nextHasScroll = mainScrollWidth > mainClientWidth;
        const changed = this.wrapper2scrollWidth !== nextWidth || this.hasHorizontalScroll !== nextHasScroll;
        this.wrapper2scrollWidth = nextWidth;
        this.hasHorizontalScroll = nextHasScroll;
        return changed;
    }
    attachContentResizeObserver() {
        if (!this.mainDiv?.nativeElement) {
            return;
        }
        const main = this.mainDiv.nativeElement;
        const target = main.querySelector('table') ??
            main.firstElementChild;
        if (!target) {
            return;
        }
        if (!this.contentResizeObserver) {
            this.contentResizeObserver = new ResizeObserver(() => this.applyWrapperWidthFromMain());
        }
        else {
            this.contentResizeObserver.disconnect();
        }
        this.contentResizeObserver.observe(target);
    }
    onWrapperScroll() {
        this.applyWrapperWidthFromMain();
        this.mainDiv.nativeElement.scrollLeft = this.wrapperDiv.nativeElement.scrollLeft;
    }
    onMainScroll() {
        this.applyWrapperWidthFromMain();
        this.wrapperDiv.nativeElement.scrollLeft = this.mainDiv.nativeElement.scrollLeft;
    }
    ngOnDestroy() {
        this.resizeObserver?.disconnect();
        this.contentResizeObserver?.disconnect();
        this.intersectionObserver?.disconnect();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DoubleScrollbarsComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: DoubleScrollbarsComponent, isStandalone: false, selector: "core-double-scrollbar", inputs: { doubleScrollBarHorizontal: "doubleScrollBarHorizontal" }, viewQueries: [{ propertyName: "mainDiv", first: true, predicate: ["mainDiv"], descendants: true }, { propertyName: "wrapperDiv", first: true, predicate: ["wrapperDiv"], descendants: true }, { propertyName: "sentinel", first: true, predicate: ["sentinel"], descendants: true }], ngImport: i0, template: "<div #sentinel class=\"sticky-sentinel\"></div>\n\n<div class=\"wrapper\" #wrapperDiv\n  [class.is-sticky]=\"isSticky\"\n  [class.has-scroll]=\"hasHorizontalScroll\"\n  [style.height.px]=\"10\"\n  [style.overflowX]=\"'scroll'\"\n  (scroll)=\"onWrapperScroll()\">\n  <div [style.width]=\"wrapper2scrollWidth\"></div>\n</div>\n<div class=\"main-container\" #mainDiv [style.overflowX]=\"'scroll'\" (scroll)=\"onMainScroll()\">\n  <ng-content></ng-content>\n</div>", styles: [".wrapper{width:100%;position:sticky;top:0;z-index:22;transition:opacity .15s ease;opacity:0;pointer-events:none;overflow:auto}.wrapper.has-scroll,.wrapper.is-sticky{opacity:1;pointer-events:auto}.sticky-sentinel{position:relative;height:1px}.main-container{width:100%;padding-bottom:5px;max-height:calc(100dvh - 200px);height:max-content}::ng-deep .main-container thead{position:sticky!important;top:0!important;background:#fff!important;z-index:10}.wrapper>div{height:1px}::-webkit-scrollbar{height:6px}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DoubleScrollbarsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-double-scrollbar', standalone: false, template: "<div #sentinel class=\"sticky-sentinel\"></div>\n\n<div class=\"wrapper\" #wrapperDiv\n  [class.is-sticky]=\"isSticky\"\n  [class.has-scroll]=\"hasHorizontalScroll\"\n  [style.height.px]=\"10\"\n  [style.overflowX]=\"'scroll'\"\n  (scroll)=\"onWrapperScroll()\">\n  <div [style.width]=\"wrapper2scrollWidth\"></div>\n</div>\n<div class=\"main-container\" #mainDiv [style.overflowX]=\"'scroll'\" (scroll)=\"onMainScroll()\">\n  <ng-content></ng-content>\n</div>", styles: [".wrapper{width:100%;position:sticky;top:0;z-index:22;transition:opacity .15s ease;opacity:0;pointer-events:none;overflow:auto}.wrapper.has-scroll,.wrapper.is-sticky{opacity:1;pointer-events:auto}.sticky-sentinel{position:relative;height:1px}.main-container{width:100%;padding-bottom:5px;max-height:calc(100dvh - 200px);height:max-content}::ng-deep .main-container thead{position:sticky!important;top:0!important;background:#fff!important;z-index:10}.wrapper>div{height:1px}::-webkit-scrollbar{height:6px}\n"] }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { doubleScrollBarHorizontal: [{
                type: Input
            }], mainDiv: [{
                type: ViewChild,
                args: ['mainDiv', { static: false }]
            }], wrapperDiv: [{
                type: ViewChild,
                args: ['wrapperDiv', { static: false }]
            }], sentinel: [{
                type: ViewChild,
                args: ['sentinel', { static: false }]
            }] } });

class CoreServerGridComponent extends CoreBaseDestroyComponent {
    set settings(value) {
        this._settings = value;
        this._defaultSettings();
    }
    get settings() {
        return this._settings;
    }
    get anyRecords() {
        return (this._paginator?.length ?? 0) !== 0;
    }
    get anyFilters() {
        const userView = this.getViewKey();
        return this._gridStoreService.read(userView, this.settings.notSaveFilters)[0]?.filters?.length > 0;
    }
    get showMultiCommandsBtn() {
        return this.settings.useColumnsSettings === true ||
            this.settings.userServerConfiguration === true ||
            this.settings.useExport === true ||
            this.settings.multiCommands === true && this.settings.multiCommandsAccess !== undefined && this.settings.multiCommandsAccess() === true;
    }
    loadGridConfiguration() {
        if (this.settings.loadGridConfigurationFunc) {
            this.settings.loadGridConfigurationFunc();
        }
        return new GridConfiguration(this.settings.service);
    }
    loadAdditionalParams() {
        if (this.settings.loadAdditionalParamsFunc) {
            return this.settings.loadAdditionalParamsFunc();
        }
        return null;
    }
    loadToolbarConfiguration() {
        if (this.settings.loadToolbarConfigurationFunc) {
            return this.settings.loadToolbarConfigurationFunc();
        }
    }
    afterLoadingCallback() {
        if (this.settings.afterLoadingFunc) {
            return this.settings.afterLoadingFunc();
        }
    }
    constructor(_injector, _gridStoreService) {
        super();
        this._injector = _injector;
        this._gridStoreService = _gridStoreService;
        this._title = undefined;
        this._isSharedView = false;
        this._isInit = false;
        this._progressHide = true;
        this._progress = 0;
        this._lastSelectedRowIndex = -1;
        this.selectItem = new EventEmitter();
        this._sortItems = [];
        this._dataExportService = this._injector.get(DataExportService);
        this._selected = [];
        this._selectedRowsById = new Map();
        this._displayedColumns = [];
        this._defaultFilters = new Array();
        this._userFilters = new Array();
    }
    _defaultSettings() {
        if (this.settings.paginatorUsed === undefined) {
            this.settings.paginatorUsed = true;
        }
        if (this.settings.paginatorPosition === undefined) {
            this.settings.paginatorPosition = 'bottom';
        }
        if (this.settings.resizeColumnUsed === undefined) {
            this.settings.resizeColumnUsed = true;
        }
        if (this.settings.refreshButtonUsed === undefined) {
            this.settings.refreshButtonUsed = true;
        }
        // флаг, который включает возможность настройки столбцов по умолчанию
        if (this.settings.useColumnsSettings === undefined) {
            //для мелких гридов, где число столбцов 4 и меньше не имеет смысла выставлять данную настройку
            this.settings.useColumnsSettings = this.settings.columns.length > 4;
        }
        // флаг, который отменяет поведение сохранения фильтров по умолчанию 
        if (this.settings.notSaveFilters === undefined) {
            this.settings.notSaveFilters = true;
        }
    }
    ngOnInit() {
        if (this.settings.userServerConfiguration === true) {
            this._onInitDynamicGrid();
        }
        else {
            if ((this.settings.useColumnsSettings === true || this.settings.useFiltersWindow === true) && Utility.isEmpty(this.settings.viewKey)) {
                console.error('Не задан viewKey. Для использования функций useColumnsSettings или useFiltersWindow необходимо задать viewKey.');
                return;
            }
            if (Utility.isEmpty(this.settings.viewKey)) {
                this.settings.viewKey = 'viewKeyNotDefined';
            }
            this._onInitStaticGrid();
        }
    }
    ngAfterViewInit() {
        // устанавливаем хранилище фильтров, из хранилища пользователя
        if (!!this._filtersComponent) {
            // откладываем установку на следующий tick, чтобы избежать ExpressionChangedAfterItHasBeenCheckedError
            Promise.resolve().then(() => {
                this._filtersComponent.storage = this._gridStoreService.read(this.getViewKey(), this.settings.notSaveFilters);
                this._injector.get(ChangeDetectorRef).detectChanges();
            });
        }
    }
    _onInitStaticGrid() {
        this._injector.get(GridConfigutarionService)
            .getUserColumn(this.getViewKey())
            .pipe(this.takeUntilDestroyed())
            .subscribe(z => this._injector.get(PopupResults).HandleIEntityResponse({
            response: z,
            successCallback: (data) => {
                let obj = undefined;
                if (!Utility.isEmpty(data)) {
                    obj = JSON.parse(data.value);
                    obj.columns.forEach(x => {
                        const item = this.settings.columns.find(y => y.key === x.key);
                        if (!!item) {
                            item.align = x.align;
                            item.order = x.order;
                            item.visible = x.visible;
                            item.width = x.width;
                        }
                    });
                }
                this._onInitCommon(obj?.pageSize, obj?.filters, obj?.variativeViewMode);
            }
        }));
    }
    _onInitDynamicGrid() {
        this._injector.get(GridConfigutarionService)
            .getGrid(this.getViewKey())
            .pipe(this.takeUntilDestroyed())
            .subscribe(z => this._injector.get(PopupResults).HandleIEntityResponse({
            response: z,
            successCallback: (data) => {
                this._title = data.title;
                this._isSharedView = data.isSharedView === true;
                this.settings.columns = data.columns;
                this._onInitCommon(data?.pageSize, data.filters, data?.variativeViewMode);
            }
        }));
    }
    _onInitCommon(pageSize, filters, variativeViewMode) {
        // обрабатываем колонки
        this.updateColumns(this.settings.columns);
        this._gridConfig = this.loadGridConfiguration();
        const initialPageSize = Utility.isEmpty(pageSize) ? this.settings.defaultPageSize : pageSize;
        if (!Utility.isEmpty(initialPageSize)) {
            this._gridConfig.paginator.pageSize = initialPageSize;
        }
        if (this.settings.notSaveFilters !== true) {
            if (!!filters && filters.length > 0) {
                this._gridConfig.filters = filters;
            }
            else {
                // fallback: если серверная конфигурация ещё не содержит фильтры,
                // используем локально сохранённые, чтобы фильтрация применялась сразу при загрузке
                const storageFilters = this._gridStoreService.read(this.getViewKey(), this.settings.notSaveFilters)[0]?.filters;
                if (!!storageFilters && storageFilters.length > 0) {
                    this._gridConfig.filters = storageFilters;
                }
            }
        }
        if (this.settings.useVariativeViewMode === true && !Utility.isEmpty(variativeViewMode)) {
            this.settings.variativeViewMode = variativeViewMode;
        }
        this._dataSource = new ServerSideDataSource(this._gridConfig, this._dataExportService, this._defaultFilters);
        this._dataSource.loading$.subscribe(z => {
            if (!!this._gridConfig.filters && this._gridConfig.filters.length > 0) {
                this._gridStoreService.write(this.getViewKey(), this._gridConfig.filters);
                if (!!this._filtersComponent) {
                    this._filtersComponent.storage = this._gridStoreService.read(this.getViewKey(), this.settings.notSaveFilters);
                }
            }
        });
        if (this.settings.useExport === true) {
            this._exportedColumns = new Array();
            this.settings.columns.forEach(x => {
                if (x.isExported === true) {
                    if (x.exportAlternatives?.length > 0) {
                        x.exportAlternatives.forEach(y => {
                            this._exportedColumns.push({ key: y.exportKey?.toString(), name: y.exportTitle, dataType: Number(y.exportType), accociatedKey: x.key });
                        });
                    }
                    else {
                        this._exportedColumns.push({ key: x.exportKey?.toString() ?? x.key, name: x.exportTitle ?? x.title, dataType: (Utility.isEmpty(x.exportType) ? null : Number(x.exportType)) ?? Number(Utility.isEmpty(x.type) ? FieldTypeEnum.String : x.type), accociatedKey: x.key });
                    }
                }
            });
        }
        if (this.canSelect()) {
            if (Utility.isEmpty(this.settings.selectLogicMode)) {
                this.settings.selectLogicMode = 'checkbox';
            }
            if (Utility.isEmpty(this.settings.selectLogicKey)) {
                this.settings.selectLogicKey = 'id';
            }
        }
        this._initGridMainConfiguration();
        setTimeout(() => { this._isInit = true; }, 500);
        this._injector.get(ChangeDetectorRef).detectChanges();
    }
    changeVariativeViewMode(mode) {
        if (this.settings?.useVariativeViewMode !== true) {
            return;
        }
        if (mode !== 1 && mode !== 2) {
            return;
        }
        this.settings.variativeViewMode = mode;
        if (!Utility.isEmpty(this.settings.viewKey)) {
            this._saveUserGridConfiguration({
                viewKey: this.settings.viewKey,
                variativeViewMode: mode
            });
        }
    }
    _initGridMainConfiguration() {
        const that = this;
        this.loadToolbarConfiguration();
        this._dataSource.initLocalization(this._paginator);
        this.initSortConfiguration(that);
        const params = this.loadAdditionalParams();
        this._dataSource.loadDataSourceItems(params, () => { that.afterLoadingCallback(); });
    }
    _refreshGrid() {
        this._isInit = false;
        this._displayedColumns = [];
        if (this.settings.userServerConfiguration === true) {
            this.settings.columns = new Array();
            this._onInitDynamicGrid();
        }
        else {
            this._onInitStaticGrid();
        }
    }
    ngAfterContentChecked() {
        this.setIsAllSelected();
    }
    updateColumns(columns) {
        //сортируем колонки
        this.settings.columns = columns.sort(CoreGridUtility.order);
        if (this._displayedColumns.length > 0) {
            this._displayedColumns = [];
        }
        if (this.canSelect()) {
            this._displayedColumns.push('selected');
        }
        //отображаем колонки которые доступны к отображению
        this.settings.columns.forEach(z => {
            if (z.visible !== false) {
                z.visible = true;
                this._displayedColumns.push(z.key);
            }
        });
    }
    getViewKey() {
        return !!this.settings.viewKey ? (this.settings.objectId ?? "") + "_" + this.settings.viewKey : this.settings.objectId?.toString();
    }
    setViewKey(viewName) {
        return !!viewName ? (this.settings.objectId ?? "") + "_" + viewName : this.settings.objectId?.toString();
    }
    changePaginator($event) {
        if ($event) {
            this._lastSelectedRowIndex = -1;
            this._saveUserGridConfiguration({ viewKey: this.settings.viewKey, pageSize: $event.pageSize });
        }
    }
    onColumnResized(column) {
        if (!column) {
            return;
        }
        const item = this.settings.columns.find(x => x.key === column.key);
        if (!item) {
            return;
        }
        item.width = column.width;
        this._saveUserGridConfiguration({ viewKey: this.settings.viewKey });
    }
    hasDataItems() {
        return (this._dataSource?.dataItems?.length ?? 0) > 0;
    }
    isAggregateVisible() {
        return this.settings?.aggregateUsed === true && this.hasDataItems();
    }
    onWindowKeydown(event) {
        if (!event?.ctrlKey || event.altKey) {
            return;
        }
        if (!this._paginator) {
            return;
        }
        // Ctrl + ArrowRight -> следующая страница
        if (event.key === 'ArrowRight' && this._paginator.hasNextPage && this._paginator.hasNextPage()) {
            event.preventDefault();
            this._paginator.nextPage();
            return;
        }
        // Ctrl + ArrowLeft -> предыдущая страница
        if (event.key === 'ArrowLeft' && this._paginator.hasPreviousPage && this._paginator.hasPreviousPage()) {
            event.preventDefault();
            this._paginator.previousPage();
            return;
        }
    }
    renderCustomHtmlTemplate(columnHtml, keys, value) {
        // из шаблона вырезаем все пробелы внутри {{ }}
        let html = columnHtml.replace(/{{(.*?)}}/g, (_, content) => `{{${content.replace(/\s+/g, '')}}}`);
        if (Utility.isEmpty(keys)) {
            keys = (html.match(/{{(.*?)}}/g) ?? []).map(match => {
                return match.replace('{{', '').replace('}}', '').trim();
            });
        }
        keys.forEach(x => {
            let key = '';
            let directive = '';
            if (x.indexOf('|') !== -1) {
                const arr = x.split('|');
                key = arr[0];
                directive = arr[1];
            }
            else {
                key = x;
            }
            let v = '';
            if (key.indexOf('.') !== -1) {
                const arr = key.split('.');
                let obj = value;
                arr.forEach(key => {
                    if (!Utility.isEmpty(obj)) {
                        obj = obj[key];
                    }
                });
                v = obj;
            }
            else {
                v = value[key];
            }
            if (Utility.isEmpty(directive) === false) {
                let pipe = this._injector.get(CoreGirdDynamicPipe);
                v = pipe.transform(v, directive);
            }
            if (Utility.isEmpty(v)) {
                v = '';
            }
            html = html.replace('{{' + x + '}}', v);
        });
        return html;
    }
    onRowDoubleClick(row) {
        if (this.settings.doubleClickUsed === true && this.settings.doubleClickFunction) {
            this.settings.doubleClickFunction(row);
        }
    }
    expandOnClick(row, event) {
        if (this.settings.expanded === true) {
            if (this._expandedElement === row) {
                this._expandedElement = null;
            }
            else {
                if (this.settings.expandedFunction(row)) {
                    this._expandedElement = row;
                }
                else {
                    this._expandedElement = null;
                }
            }
        }
        if (this.settings.selectLogicMode === 'row') {
            if (this.settings.selectLogicRowView === undefined || this.settings.selectLogicRowView(row) === true) {
                this.onCheckboxClick(event, row);
            }
        }
    }
    directSelectCheckbox(event, row) {
        if (this.settings.selectLogicMode === 'checkbox') {
            this.onCheckboxClick(event, row);
        }
    }
    onCheckboxClick(event, row) {
        if (this.canSelect()) {
            const rowHandling = () => {
                const wasSelected = this.isSelectedRow(row);
                this._selectRow(row, !wasSelected);
            };
            if (event && event.shiftKey) {
                if (this._lastSelectedRowIndex >= 0) {
                    // Обрабатываем выбор диапазона
                    this._selectRange(this._lastSelectedRowIndex, row);
                    // Сбрасываем индекс 
                    this._lastSelectedRowIndex = -1;
                }
                else {
                    rowHandling();
                    // При первом клике просто обновляем индекс последней выбранной строки
                    this._updateLastSelectedIndex(row);
                }
            }
            else {
                rowHandling();
                //если второй клик после шифта идет без шифта, то сбрасываем индекс
                this._lastSelectedRowIndex = -1;
            }
        }
    }
    changeFilterItems(events) {
        if (this._isInit === true) {
            this._userFilters = events;
            if (!!this._paginator) {
                this._dataSource.useFilters(this._userFilters, () => { this._paginator.pageIndex = 0; this._dataSource.setPageIndex(0); }, () => { const param = this.loadAdditionalParams(); return param; });
                this._saveUserGridConfiguration({ viewKey: this.settings.viewKey, filters: this._userFilters });
            }
        }
    }
    multiRunEvent() {
        this._progress = 0;
        this._progressHide = false;
    }
    multiProgressEvent(event) {
        this._progress = event;
    }
    multiFinishEvent(callback) {
        this._progressHide = true;
        callback();
    }
    cell(element, key) { return `${element[key] ? element[key] : ``}`; }
    getPosition(element, suffix) {
        switch (element.align) {
            case Align.Center: return 'sln-grid-content-' + suffix + 'center';
            case Align.Right: return 'sln-grid-content-' + suffix + 'right';
            default: return 'sln-grid-content-' + suffix + 'left';
        }
    }
    _getSortField(columnKey) {
        const column = this.settings.columns.find(c => c.key === columnKey);
        return column?.sortKey ?? columnKey;
    }
    getSortDirection(columnKey) {
        const sortField = this._getSortField(columnKey);
        const item = this._sortItems.find(x => x.field === sortField);
        return item?.direction ?? '';
    }
    getSortOrder(columnKey) {
        const sortField = this._getSortField(columnKey);
        const index = this._sortItems.findIndex(x => x.field === sortField);
        return index >= 0 ? index + 1 : null;
    }
    isSortActive(columnKey) {
        return this.getSortDirection(columnKey) !== '';
    }
    hasMultipleSorts() {
        return this._sortItems.length > 1;
    }
    onSortHeaderClick(event, column) {
        if (!column?.useSort) {
            return;
        }
        event.preventDefault();
        event.stopPropagation();
        const sortField = this._getSortField(column.key);
        const isMultiMode = event.shiftKey === true;
        const currentIndex = this._sortItems.findIndex(x => x.field === sortField);
        const currentDirection = currentIndex >= 0 ? this._sortItems[currentIndex].direction : '';
        const nextDirection = currentDirection === '' ? 'asc' : currentDirection === 'asc' ? 'desc' : '';
        if (isMultiMode) {
            if (currentIndex >= 0) {
                this._sortItems.splice(currentIndex, 1);
            }
            if (nextDirection !== '') {
                this._sortItems.push({ field: sortField, direction: nextDirection });
            }
        }
        else {
            this._sortItems = nextDirection !== '' ? [{ field: sortField, direction: nextDirection }] : [];
        }
        this._applySortAndReload();
    }
    _applySortAndReload() {
        this._gridConfig.sorts = [...this._sortItems];
        this._gridConfig.sort = this._sortItems.length > 0 ? this._sortItems[0] : undefined;
        if (this._paginator) {
            this._paginator.pageIndex = 0;
        }
        this._gridConfig.paginator.pageIndex = 0;
        this._lastSelectedRowIndex = -1;
        const params = this.loadAdditionalParams();
        this._dataSource.loadDataSourceItems(params, () => { this.afterLoadingCallback(); });
    }
    _initializeSortStateFromSettings() {
        const active = this.settings.defaultMatSortActive;
        const direction = this.settings.defaultMatSortDirection;
        if (!Utility.isEmpty(active) && (direction === 'asc' || direction === 'desc')) {
            const sortField = this._getSortField(active);
            this._sortItems = [{ field: sortField, direction: direction }];
            this._gridConfig.sorts = [...this._sortItems];
            this._gridConfig.sort = this._sortItems[0];
            return;
        }
        this._sortItems = [];
        this._gridConfig.sorts = [];
        this._gridConfig.sort = undefined;
    }
    initSortConfiguration(that) {
        this._initializeSortStateFromSettings();
        if (this._paginator) {
            this._paginator
                .page
                .pipe(this.takeUntilDestroyed(), tap(() => {
                // сбрасываем индекс последней выбранной строки             
                this._lastSelectedRowIndex = -1;
                // устанавливаем новую конфигурацию педжинации           
                this._gridConfig.paginator.pageIndex = this._paginator ? this._paginator.pageIndex : 0;
                this._gridConfig.paginator.pageSize = this._paginator ? this._paginator.pageSize : (this.settings.defaultPageSize ?? 15);
                const paramsLocal = this.loadAdditionalParams();
                this._dataSource.loadDataSourceItems(paramsLocal, () => { that.afterLoadingCallback(); });
            }))
                .subscribe();
        }
    }
    isSelectedRow(row) {
        return this._selected.includes(row[this.settings.selectLogicKey]);
    }
    setIsAllSelected() {
        if (this._isInit && this.canSelect()) {
            this._isAllSelected = this._dataSource.dataItems?.every((row) => this._selected.includes(row[this.settings.selectLogicKey]));
        }
    }
    selectAll(event) {
        if (this._isInit && this.canSelect()) {
            //при манипуляциях с чекбоксом "выделит все" сбрасываем индекс последней выбранной строки
            this._lastSelectedRowIndex = -1;
            this._dataSource.dataItems.forEach(row => {
                if (this.settings.selectLogicRowView === undefined || this.settings.selectLogicRowView(row) === true) {
                    this._selectRow(row, event.checked);
                }
            });
        }
    }
    canSelect() {
        return this.settings?.useSelectLogic === true && (this.settings?.selectLogicAccess === undefined || this.settings?.selectLogicAccess() === true);
    }
    shouldRenderCell(row, column) {
        return !column.columnAccess || !!column.columnAccess();
    }
    _selectRow(row, checked) {
        const rowId = row[this.settings.selectLogicKey];
        if (checked) {
            if (!this.isSelectedRow(row)) {
                this._selected.push(rowId);
            }
            this._selectedRowsById.set(rowId, row);
        }
        else {
            const index = this._selected.findIndex(x => x === rowId);
            if (index >= 0) {
                this._selected.splice(index, 1);
            }
            this._selectedRowsById.delete(rowId);
        }
        this.selectItem.emit(this._selected);
    }
    getSelectedRows(ids) {
        if (!ids?.length) {
            return [];
        }
        return ids
            .map(id => this._selectedRowsById.get(id))
            .filter(row => !!row);
    }
    clearSelection() {
        this._selected = [];
        this._selectedRowsById.clear();
        this.selectItem.emit(this._selected);
    }
    _updateLastSelectedIndex(row) {
        if (this._dataSource?.dataItems) {
            const index = this._dataSource.dataItems.findIndex(r => r[this.settings.selectLogicKey] === row[this.settings.selectLogicKey]);
            if (index >= 0) {
                this._lastSelectedRowIndex = index;
            }
        }
    }
    _selectRange(startIndex, endRow) {
        if (!this._dataSource?.dataItems) {
            return;
        }
        const endIndex = this._dataSource.dataItems.findIndex(r => r[this.settings.selectLogicKey] === endRow[this.settings.selectLogicKey]);
        if (startIndex < 0 || endIndex < 0) {
            return;
        }
        const minIndex = Math.min(startIndex, endIndex);
        const maxIndex = Math.max(startIndex, endIndex);
        // Определяем целевое состояние на основе конечной строки (инвертируем её текущее состояние)
        const targetState = !this.isSelectedRow(endRow);
        // Устанавливаем одинаковое состояние для всех строк в диапазоне
        for (let i = minIndex; i <= maxIndex; i++) {
            const row = this._dataSource.dataItems[i];
            if (this.settings.selectLogicRowView === undefined || this.settings.selectLogicRowView(row) === true) {
                this._selectRow(row, targetState);
            }
        }
        this._updateLastSelectedIndex(endRow);
    }
    /* Default Botton */
    refreshClick() {
        const params = this.loadAdditionalParams();
        if (this._dataSource) {
            const that = this;
            this._dataSource.forceLoading();
            this._dataSource.loadDataSourceItems(params, () => { that.afterLoadingCallback(); });
        }
    }
    exportExcel() {
        if (this._exportedColumns?.length > 0) {
            const popup = this._injector.get(PopupResults);
            const onCompleted = () => { this._progressHide = true; };
            const onError = () => {
                this._progressHide = true;
                popup.HandleIEntityResponse({
                    response: {
                        isSuccess: false,
                        message: 'Что-то пошло не так...',
                        entity: null
                    }
                });
            };
            if (this.settings.userServerConfiguration === true) {
                CoreDialog.window(CoreGridExportModeDialogWindow, {}, (mode) => {
                    switch (mode) {
                        case ExportMode.All:
                            this._progressHide = false;
                            this._dataSource.exportExcel(this._exportedColumns, this.settings.exportAdditionalParamsFunc, onCompleted, onError);
                            break;
                        case ExportMode.OnlyVisible:
                            const visibleColumns = this.settings.columns.filter(c => c.visible);
                            const exportedColumns = [];
                            visibleColumns.forEach(c => {
                                const columns = this._exportedColumns.filter(x => x.accociatedKey === c.key);
                                if (columns?.length > 0) {
                                    exportedColumns.push(...columns);
                                }
                            });
                            this._progressHide = false;
                            this._dataSource.exportExcel(exportedColumns, this.settings.exportAdditionalParamsFunc, onCompleted, onError);
                            break;
                    }
                });
            }
            else {
                this._progressHide = false;
                this._dataSource.exportExcel(this._exportedColumns, this.settings.exportAdditionalParamsFunc, onCompleted, onError);
            }
        }
        else {
            console.error('Нет столбцов для экспорта');
        }
    }
    showFilters() {
        const data = {
            userView: this.getViewKey(),
            columns: this.settings.columns,
            componentTemplateMap: this.settings.componentTemplateMap,
            storage: this._gridStoreService.read(this.getViewKey(), this.settings.notSaveFilters)
        };
        CoreDialog.window(CoreGridDialogFilterComponent, data, (result) => {
            const filtes = new Array();
            result.forEach(event => {
                if (!Utility.isEmpty(event.field) && !Utility.isEmpty(event.condition)) {
                    filtes.push({
                        field: event.field,
                        condition: event.condition,
                        value: event.value,
                        dataType: event.dataType
                    });
                }
            });
            if (!!this._paginator) {
                this._dataSource.useFilters(filtes, () => { this._paginator.pageIndex = 0; }, () => { const param = this.loadAdditionalParams(); return param; });
                this._saveUserGridConfiguration({ viewKey: this.settings.viewKey, filters: filtes });
            }
        }, (result) => {
            if (Utility.isEmpty(result)) {
                this.clearStorageFilters();
            }
        });
    }
    clearStorageFilters(noNeedRefresh) {
        this._gridStoreService.clear(this.getViewKey());
        this._saveUserGridConfiguration({ viewKey: this.settings.viewKey, callback: () => {
                if (!noNeedRefresh) {
                    this._refreshGrid();
                }
            } });
    }
    editColumns() {
        const data = {
            systemObjectId: this.settings.objectId,
            viewKey: this.settings.viewKey,
            columns: this.settings.userServerConfiguration !== true ? this.settings.columns : undefined
        };
        CoreDialog.window(CoreGridConfigUserColumnDialogWindow, data, (result) => {
            this.settings.columns = result;
            this._saveUserGridConfiguration({ viewKey: this.settings.viewKey, callback: () => { this._refreshGrid(); } });
        });
    }
    createUserView() {
        const callWindow = (item) => {
            const coreDataGridSrv = this._injector.get(GridConfigutarionService);
            CoreDialog.window(CoreUserViewDialogWindow, item, (view) => {
                const viewName = this._saveUserGridConfiguration({ viewKey: view.key, viewTitle: view.title, userId: Number(view.creator.id), callback: () => {
                        if (view.needShare === true) {
                            coreDataGridSrv
                                .saveOrganizationColumn(viewName, view)
                                .pipe(this.takeUntilDestroyed())
                                .subscribe(() => {
                                this._redirectToView(view);
                            });
                        }
                        else {
                            if (view.creator.id === this._injector.get(ContextService).session.userId) {
                                //если это администратор и он деактивировал флаг что представление для всех, то нужно удалить настройку организации
                                coreDataGridSrv
                                    .deleteOrganizationColumn(viewName)
                                    .pipe(this.takeUntilDestroyed())
                                    .subscribe(() => {
                                    this._redirectToView(view);
                                });
                            }
                            else {
                                this._redirectToView(view);
                            }
                        }
                    } });
                this._gridStoreService.write(viewName);
            });
        };
        if (this.settings.userServerConfiguration === true) {
            if (Utility.isEmpty(this.settings.viewKey)) {
                callWindow();
            }
            else {
                this._injector.get(GridConfigutarionService)
                    .getUserView(this.getViewKey())
                    .pipe(this.takeUntilDestroyed())
                    .subscribe((response) => this._injector.get(PopupResults).HandleIEntityResponse({
                    response: response,
                    successCallback: (entity) => {
                        callWindow(entity);
                    }
                }));
            }
        }
        else {
            console.error('Для создания пользовательского представления необходимо включить серверную конфигурацию');
            return;
        }
    }
    _redirectToView(view) {
        this._injector.get(Router).navigate(['/requests/' + this.settings.objectId + "/view/" + view.key]);
    }
    // сохранение настроек грида на сервере
    _saveUserGridConfiguration(state) {
        if (Utility.isEmpty(state.viewTitle) === true && this._isSharedView === true) {
            // если представление общее и это не сохранение представления при редактировании, 
            // то не сохраняем пользовательские настройки
            return undefined;
        }
        const viewName = this.setViewKey(state.viewKey);
        const data = {
            systemObjectId: viewName,
            title: state.viewTitle ?? this._title,
            pageSize: state.pageSize ?? this._gridConfig.paginator.pageSize,
            columns: this.settings.columns,
            filters: this.settings.notSaveFilters === true ? undefined : state.filters ?? this._gridStoreService.read(this.getViewKey(), this.settings.notSaveFilters)[0]?.filters,
            isUserView: Utility.isEmpty(state.viewTitle) === false || Utility.isEmpty(this._title) === false,
            userId: state.userId
        };
        if (this.settings?.useVariativeViewMode === true) {
            data.variativeViewMode = state.variativeViewMode ?? this.settings.variativeViewMode;
        }
        this._injector.get(GridConfigutarionService)
            .saveUserColumn(data)
            .pipe(this.takeUntilDestroyed())
            .subscribe(() => {
            if (!!state.callback) {
                state.callback();
            }
        });
        return viewName;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreServerGridComponent, deps: [{ token: i0.Injector }, { token: GridStoreService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreServerGridComponent, isStandalone: false, selector: "core-grid", inputs: { settings: "settings" }, outputs: { selectItem: "selectItem" }, host: { listeners: { "window:keydown": "onWindowKeydown($event)" } }, viewQueries: [{ propertyName: "_filtersComponent", first: true, predicate: CoreGridFiltersComponent, descendants: true }, { propertyName: "_paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "topScroll", first: true, predicate: ["topScroll"], descendants: true }, { propertyName: "bottomScroll", first: true, predicate: ["bottomScroll"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"grid\">\n  <div class=\"data-grid-btn-wrap\" [style.display]=\"settings.hideToolbar === true ? 'none' : 'flex'\">\n    <div class=\"sln-left-side-spacer\">\n      <ng-content select=\"[toolbarLeft]\"></ng-content>\n      @if (settings.useFiltersWindow !== true) {\n        <core-grid-filters [userView]=\"getViewKey()\" [notSaveFilters]=\"settings.notSaveFilters\" [columns]=\"settings.columns\" [smallSize]=\"true\" [componentTemplateMap]=\"settings.componentTemplateMap\" [notSaveFilters]=\"settings.notSaveFilters\" (changeFilterItems)=\"changeFilterItems($event)\"></core-grid-filters>\n      }\n    </div>\n    <div class=\"sln-right-side-spacer\">\n      @if (settings.paginatorUsed === true && settings.paginatorPosition === 'top') {\n        <div class=\"sln-max-width\">\n          <mat-paginator #paginator (page)=\"changePaginator($event)\"\n            [length]=\"_gridConfig?.paginator?.total\"\n            [pageSize]=\"_gridConfig?.paginator?.pageSize\"\n            [pageSizeOptions]=\"[10, 25, 100]\"\n          class=\"sln-mat-paginator\"></mat-paginator>\n        </div>\n      }\n      <ng-content select=\"[toolbarRight]\"></ng-content>\n\n      @if (settings.useFiltersWindow === true) {\n        @if (anyFilters === true) {\n          <button class=\"sln-grid-multi-commands\" (click)=\"clearStorageFilters()\" tid=\"clearStorageFilters\" matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044E\">\n            <div class=\"sln-filter-delete\"></div>\n          </button>\n          <button class=\"sln-grid-multi-commands\" (click)=\"showFilters()\" tid=\"showFilters\" matTooltip=\"\u0424\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044F\">\n            <div class=\"sln-filter-full\"></div>\n          </button>\n        }\n        @if (anyFilters === false) {\n          <button  class=\"sln-grid-multi-commands\" (click)=\"showFilters()\" tid=\"showFilters\" matTooltip=\"\u0424\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044F\">\n            <div class=\"sln-filter-empty\"></div>\n          </button>\n        }\n      }\n\n      @if(settings.useVariativeViewMode === true) {\n        <div class=\"sln-variative-view-mode-group\">\n          <button class=\"sln-variative-view-mode-button sln-variative-view-mode-button-l\"\n                  [class.sln-variative-view-mode-button_active]=\"settings.variativeViewMode !== 2\"\n                  (click)=\"changeVariativeViewMode(1)\">\n            <div class=\"sln-grid-lists\"></div>\n          </button>\n          <button class=\"sln-variative-view-mode-button sln-variative-view-mode-button-r\"\n                  [class.sln-variative-view-mode-button_active]=\"settings.variativeViewMode === 2\"\n                  (click)=\"changeVariativeViewMode(2)\">\n            <div class=\"sln-grid-table\"></div>\n          </button>\n        </div>\n      }\n\n    \n     \n      @if (showMultiCommandsBtn) {\n        <button [disabled]=\"!_progressHide\" class=\"sln-grid-multi-commands\" tid=\"grid-multi-commands\" [matMenuTriggerFor]=\"multiCommandsMenu\" matTooltip=\"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\">\n          <div class=\"sln-grid-grid-management\"></div>\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\n        </button>\n        <mat-menu #multiCommandsMenu=\"matMenu\" class=\"sln-grid-menu\">\n          @if (settings.refreshButtonUsed === true) {\n            <button mat-menu-item (click)=\"refreshClick()\" tid=\"refreshClick\" matTooltip=\"\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C\">\n              <div class=\"sln-grid-update\" #refreshButton></div>\n              <span class=\"b-margin-icon\">\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C</span>\n            </button>\n          }\n          @if (settings.useColumnsSettings === true && settings.variativeViewMode !== 2) {\n            <button mat-menu-item (click)=\"editColumns()\" tid=\"editColumns\">\n              <div class=\"sln-grid-mattable-settings\"></div>\n              <span class=\"b-margin-icon\">\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F</span>\n            </button>\n          }\n          @if (settings.userServerConfiguration === true) {\n            <button mat-menu-item (click)=\"createUserView()\" tid=\"createUserView\">\n              <div class=\"sln-grid-save\"></div>\n              <span class=\"b-margin-icon\">{{ settings.viewKey?.length > 0 ? '\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C' : '\u0421\u043E\u0437\u0434\u0430\u0442\u044C' }} \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435</span>\n            </button>\n          }  \n          @if (settings.useExport === true) {\n            <button mat-menu-item (click)=\"exportExcel()\" tid=\"exportExcel\">\n              <div class=\"sln-export-to-excel\"></div>\n              <span class=\"b-margin-icon\">\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 Excel</span>\n            </button>\n          }\n          @if (settings.multiCommands === true && settings.multiCommandsAccess !== undefined && settings.multiCommandsAccess() ===  true) {\n            <ng-content select=\"[multiCommands]\"></ng-content>\n          }        \n        </mat-menu>\n      }\n    </div>\n  </div>\n  \n  @if (!_progressHide) {\n    <mat-progress-bar mode=\"determinate\" [value]=\"_progress\"></mat-progress-bar>\n  }\n  <!--ViewMode.Card-->\n  @if (settings.variativeViewMode === 2) {\n    <div class=\"sln-grid-card-mode-container\">\n        @for (item of _dataSource.dataItems; track item) {\n        <mat-card class=\"settings.viewCardModeSettings?.cardClass\">\n          <mat-card-content>\n            <ng-container [ngTemplateOutlet]=\"settings.viewCardModeSettings.cardTpl()\" [ngTemplateOutletContext]=\"{ row: item }\"></ng-container>\n          </mat-card-content>\n        </mat-card>\n      }\n    </div>\n  }\n  <div [hidden]=\"settings.variativeViewMode === 2\">\n    <core-double-scrollbar >\n      <table mat-table\n        [dataSource]=\"_dataSource\"\n        multiTemplateDataRows\n        class=\"sln-data-grid__table\">\n\n        @if (canSelect()) {\n          <ng-container matColumnDef=\"selected\">\n            <th mat-header-cell *matHeaderCellDef>\n              <mat-checkbox [ngModel]=\"_isAllSelected\" (change)=\"selectAll($event)\" class=\"sln-mat-checkbox\"></mat-checkbox>\n            </th>\n            <td mat-cell *matCellDef=\"let row\">\n              @if (settings.selectLogicRowView === undefined || settings.selectLogicRowView(row) === true) {\n                <mat-checkbox [ngModel]=\"isSelectedRow(row)\" name=\"selected-{{row[settings.selectLogicKey]}}\" class=\"sln-mat-checkbox\" (click)=\"directSelectCheckbox($event, row)\"></mat-checkbox>\n              }\n            </td>\n            @if (settings.aggregateUsed === true) {\n              <td mat-footer-cell *matFooterCellDef></td>\n            }            \n          </ng-container>\n        }\n\n        <!-- columns start-->\n        @for (column of settings.columns; track column) {\n          <ng-container [cdkColumnDef]=\"column.key\">\n            <!--header start-->\n            @if (column.useSort) {\n              <th class=\"sln-default-label sln-sortable-header\" mat-header-cell *matHeaderCellDef [grid-column-resize]=\"settings.resizeColumnUsed !== false ? column : null\" (columnResized)=\"onColumnResized($event)\" [style.width.px]=\"column.width\" [style.minWidth.px]=\"column.width\" [style.maxWidth.px]=\"column.width\" [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true\" (click)=\"onSortHeaderClick($event, column)\">\n                <div class=\"{{ getPosition(column, '') }}\">\n                  {{ column.title !== \"*\" ? column.title : \"\" }}\n                  <span class=\"sln-sort-indicator\" [class.sln-sort-indicator_active]=\"isSortActive(column.key)\" [class.sln-sort-indicator_desc]=\"getSortDirection(column.key) === 'desc'\">\n                    <span class=\"sln-sort-indicator__arrow\" title=\"\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0442\u0435 Shift, \u0447\u0442\u043E\u0431\u044B \u043E\u0442\u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u0438\u043C \u0441\u0442\u043E\u043B\u0431\u0446\u0430\u043C\"></span>\n                    @if (isSortActive(column.key) && hasMultipleSorts() && getSortOrder(column.key) !== null) {\n                      <span class=\"sln-sort-indicator__order\">{{ getSortOrder(column.key) }}</span>\n                    }\n                  </span>\n                </div>\n              </th>\n            }\n            @if (!column.useSort) {\n              <th class=\"sln-default-label\" mat-header-cell *matHeaderCellDef [grid-column-resize]=\"settings.resizeColumnUsed !== false ? column : null\" (columnResized)=\"onColumnResized($event)\" [style.width.px]=\"column.width\" [style.minWidth.px]=\"column.width\" [style.maxWidth.px]=\"column.width\" [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true\">\n                <div class=\"{{ getPosition(column, '') }}\">\n                  {{ column.title !== \"*\" ? column.title : \"\" }}\n                </div>\n              </th>\n            }\n            <!--header end-->\n            <!--row start-->\n            @if (!!column.columnTemplate) {\n              <td mat-cell *matCellDef=\"let row\" [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true || !shouldRenderCell(row, column)\">\n                <div class=\"{{ getPosition(column, 'b-') }}\">\n                  @if (column.columnTemplateHtml && (column.checkRowContentFn === undefined || column.checkRowContentFn(row) === true)) {\n                    <div [innerHTML]=\"renderCustomHtmlTemplate(column.columnTemplateHtml, column.columnTemplateHtmlKeys, row)\"></div>\n                  }\n                  @if (!column.columnTemplateHtml && (column.checkRowContentFn === undefined || column.checkRowContentFn(row) === true)) {\n                    <core-grid-column-template [component]=\"column.columnTemplateType\" [componentTemplateMap]=\"settings.componentTemplateMap\" [value]=\"row\"\n                      [inputs]=\"column.columnTemplateTypeInputs\" [outputs]=\"column.columnTemplateTypeOutputs\"\n                      (refreshEvent)=\"refreshClick()\"\n                      (multiRunEvent)=\"multiRunEvent()\"\n                      (multiProgressEvent)=\"multiProgressEvent($event)\"\n                    (multiFinishEvent)=\"multiFinishEvent($event)\"></core-grid-column-template>\n                  }\n                </div>\n              </td>\n\n              @if (settings.aggregateUsed === true) {\n                <td mat-footer-cell *matFooterCellDef [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true\">\n                  <div class=\"{{ getPosition(column, '') }}\">\n                    \n                  </div>\n                </td>\n              }\n            }\n            @if (!column.columnTemplate) {\n              <td mat-cell *matCellDef=\"let row\" [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true || !shouldRenderCell(row, column)\">\n                @if (column.checkRowContentFn === undefined || column.checkRowContentFn(row) === true) {\n                  <div class=\"{{ getPosition(column, '') }}\">\n                    {{ cell(row, column.key) | dynamicPipe: column.pipeType }}\n                  </div>\n                }\n              </td>\n              @if (settings.aggregateUsed === true) {\n                <td mat-footer-cell *matFooterCellDef [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true\">\n                  <div class=\"{{ getPosition(column, '') }}\">\n                    \n                  </div>\n                </td>\n              }\n            }\n            <!--row end-->\n          </ng-container>\n        }\n        <!-- columns end-->\n        <!-- expanded row detail start-->\n        @if (settings.expanded) {\n          <ng-container matColumnDef=\"expandedDetail\">\n            <td mat-cell *matCellDef=\"let row\" [attr.colspan]=\"_displayedColumns.length\">\n              @if (row === _expandedElement) {\n                <div\n                  class=\"expanded-element-detail\"\n                  [class.expanded]=\"row === _expandedElement\"\n                >\n                  <ng-container [ngTemplateOutlet]=\"settings.expandedElementTpl()\" [ngTemplateOutletContext]=\"{ row: row }\"></ng-container>\n                </div>\n              }\n            </td>\n          </ng-container>\n        }\n        <!-- expanded row detail end-->\n        <tr mat-header-row *matHeaderRowDef=\"_displayedColumns\"></tr>\n        <tr mat-row\n          *matRowDef=\"let row; columns: _displayedColumns\"\n          [matTooltip]=\"(settings.rowTooltipFunction ? settings.rowTooltipFunction(row) : undefined)\" matTooltipPosition=\"above\" matTooltipClass=\"custom-tooltip\"\n          class=\"grid-element-row {{ settings.rowBackgroundFunction !== undefined ? settings.rowBackgroundFunction(row) : '' }}\"\n          [class.grid-expanded-row]=\"_expandedElement === row\"\n          [class.sln-grid-row-clickable]=\"settings.doubleClickUsed === true\"\n          (click)=\"expandOnClick(row, $event)\"\n          (dblclick)=\"onRowDoubleClick(row)\">\n        </tr>\n        @if (settings.expanded) {\n          <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"grid-detail-row\"></tr>\n        }\n        @if (settings.aggregateUsed === true) {\n          <tr mat-footer-row *matFooterRowDef=\"_displayedColumns; sticky: true\" class=\"sln-grid-aggregation-row\" [hidden]=\"!hasDataItems()\"></tr>\n        }\n      </table>\n    </core-double-scrollbar>\n    @if (!hasDataItems()) {\n      <span class=\"sln-info-grid\">\u041F\u043E \u0432\u0430\u0448\u0435\u043C\u0443 \u0437\u0430\u043F\u0440\u043E\u0441\u0443 \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E</span>\n    }\n  </div>\n  @if (settings.paginatorUsed === true && settings.paginatorPosition === 'bottom') {\n    <div class=\"sln-grid-footer\">\n        <div class=\"sln-grid-footer__paginator\">\n          <mat-paginator #paginator (page)=\"changePaginator($event)\"\n            [length]=\"_gridConfig?.paginator?.total\"\n            [pageSize]=\"_gridConfig?.paginator?.pageSize\"\n            [pageSizeOptions]=\"[10, 25, 100]\"\n            class=\"sln-mat-paginator\"></mat-paginator>\n        </div>\n    </div>\n  }\n</div>", styles: ["mat-toolbar.mat-toolbar-single-row{padding:0 20px;min-width:300px;width:100%;height:70px;display:flex;align-items:center;position:sticky;top:0;z-index:9999}.grid{padding-top:10px;padding-bottom:10px;min-width:0;display:flex;flex-direction:column}.table-wrapper{position:relative;width:100%}.sln-data-grid__table mat-form-field:not(:last-child){padding-right:20px}.sln-data-grid__table{width:100%;table-layout:auto;white-space:nowrap}.sln-data-grid__table.sln-resize-active{table-layout:fixed}th{max-width:250px;text-wrap:inherit}td{max-width:250px;text-wrap:auto}.data-grid-btn-wrap{display:flex;align-items:center;justify-content:space-between;background:#fff;padding:0 15px var(--GRID-TOOLBAR-PADDING-BOTTOM, 0);border-radius:3px;position:sticky;gap:20px;top:0;z-index:12}.data-grid-btn-wrap .sln-left-side-spacer{display:flex;align-items:center;gap:10px;flex:1}.data-grid-btn-wrap .sln-left-side-spacer mat-form-field,.data-grid-btn-wrap .sln-left-side-spacer core-organization-search{width:200px;margin-left:5px}.data-grid-btn-wrap .sln-left-side-spacer core-grid-filters{flex:1}.data-grid-btn-wrap .sln-left-side-spacer button p{margin-bottom:0;color:var(--PRIMARY);font-family:var(--font-bold)}.data-grid-btn-wrap .sln-right-side-spacer{display:flex;align-items:center;gap:10px}.sln-info-grid{display:block;width:96%;margin:10px auto;color:var(--DARK-GREY);font-family:var(--font-medium);letter-spacing:.02em;font-size:18px}.sln-grid-menu button img{width:20px;height:20px}.sln-grid-content-left{text-align:left}.sln-grid-content-center{text-align:center}.sln-grid-content-right{text-align:right}th .sln-grid-content-left,th .sln-grid-content-center,th .sln-grid-content-right{font-family:var(--GRID-TH-FONT-FAMILY, var(--font-medium))}td .sln-grid-content-left,td .sln-grid-content-center,td .sln-grid-content-right,.sln-grid-content-b-left,.sln-grid-content-b-center,.sln-grid-content-b-right{font-family:var(--GRID-TD-FONT-FAMILY, var(--font-medium))}th .sln-grid-content-left{padding-left:var(--GRID-TH-PADDING-LEFT, 3px)}th .sln-grid-content-right{padding-right:var(--GRID-TH-PADDING-RIGHT, 3px)}.grid table th,.grid .mat-mdc-header-cell,.grid th .sln-grid-content-left,.grid th .sln-grid-content-center,.grid th .sln-grid-content-right{text-align:var(--GRID-TH-TEXT-ALIGN, revert);justify-content:var(--GRID-TH-JUSTIFY-CONTENT, revert)}.sln-grid-content-b-left{display:flex;text-align:left;justify-content:left}.sln-grid-content-b-center{display:flex;text-align:center;justify-content:center}.sln-grid-content-b-right{display:flex;text-align:right;justify-content:right}::-webkit-scrollbar{width:5px}.sln-grid-vertical-dots{background-size:4px}.sln-variative-view-mode-group{display:inline-flex;align-items:center}.sln-variative-view-mode-button{min-width:32px;height:32px;padding:0 6px;border:none;background:var(--LIGHT-GREY);color:var(--DARK-GREY);font-family:var(--font-medium);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.sln-variative-view-mode-button-r{border-radius:0 5px 5px 0;border:2px solid var(--GRAY);border-left:none}.sln-variative-view-mode-button-l{border-radius:5px 0 0 5px;border:2px solid var(--GRAY);border-right:none}.table-scroll-top{position:sticky;height:20px;z-index:22;top:-15px}.table-scroll-top .scroll-content{overflow-x:auto;height:20px}.table-scroll-bottom{overflow-x:auto}::-webkit-scrollbar-thumb{background-color:#cf2f2f;border-radius:10px}.scroll-content{width:100%;display:inline-block}.exportExcel{position:relative}.exportExcel:disabled{opacity:.6;cursor:not-allowed!important;pointer-events:none}.sln-mat-progress-bar{position:absolute;top:24px;width:99%;left:0}.sln-grid-card-mode-container{display:flex;flex-wrap:wrap;gap:16px;justify-content:flex-start}.sln-grid-footer{display:flex;align-items:center;justify-content:flex-start;gap:16px;padding:6px 15px 0}.sln-grid-footer__paginator{flex:0 0 auto;margin-left:0}.sln-grid-footer__paginator ::ng-deep .mat-mdc-paginator-container{justify-content:flex-start}.sln-grid-footer__paginator ::ng-deep .mat-mdc-paginator-page-size{order:2}.sln-grid-footer__paginator ::ng-deep .mat-mdc-paginator-range-actions{order:1}.sln-grid-aggregation-row{background:#fff;position:sticky;bottom:0;z-index:11}.sln-grid-aggregation-row .mat-mdc-footer-cell,.sln-grid-aggregation-row .mat-footer-cell{background:#fff}.sln-resizable-column{overflow:visible;cursor:default}.sln-resizable-column .mat-sort-header-container{padding-right:12px;cursor:pointer}.sln-resizable-column.sln-resize-hover,.sln-resizable-column.sln-resize-hover .mat-sort-header-container{cursor:col-resize}.sln-resizable-column:hover:before,.sln-resizable-column:hover:after,.sln-resizable-column.sln-resize-hover:before{opacity:1}.sln-resizable-column.sln-resize-hover:after{background:linear-gradient(#3f51b5bf,#3f51b5bf) right 0 center/1px 18px no-repeat,linear-gradient(#3f51b58c,#3f51b58c) right 5px center/1px 12px no-repeat,linear-gradient(#3f51b559,#3f51b559) right 10px center/1px 6px no-repeat}.sln-resizable-column:before{content:\"\";position:absolute;top:0;right:0;bottom:0;width:12px;background:transparent;opacity:0;transition:opacity .12s ease;pointer-events:none}.sln-resizable-column:after{content:\"\";position:absolute;top:0;bottom:0;right:0;width:12px;background:linear-gradient(#3f51b540,#3f51b540) right 0 center/1px 18px no-repeat,linear-gradient(#3f51b533,#3f51b533) right 5px center/1px 12px no-repeat,linear-gradient(#3f51b529,#3f51b529) right 10px center/1px 6px no-repeat;opacity:0;transition:opacity .12s ease;pointer-events:none}.sln-grid-row-clickable{cursor:pointer}.sln-sortable-header{cursor:pointer;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.sln-sortable-header .sln-grid-content-left,.sln-sortable-header .sln-grid-content-center,.sln-sortable-header .sln-grid-content-right{display:flex;align-items:center;gap:6px}.sln-sortable-header .sln-grid-content-right{justify-content:flex-end}.sln-sortable-header .sln-grid-content-center{justify-content:center}.sln-sort-indicator{width:28px;display:inline-flex;align-items:center;justify-content:flex-start;opacity:0;transition:opacity .15s ease}.sln-sortable-header:hover .sln-sort-indicator{opacity:.45}.sln-sort-indicator.sln-sort-indicator_active{opacity:1!important}.sln-sort-indicator__arrow{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:8px solid var(--PRIMARY)}.sln-sort-indicator_desc .sln-sort-indicator__arrow{border-bottom:none;border-top:8px solid var(--PRIMARY)}.sln-sort-indicator__order{min-width:16px;height:16px;margin-left:5px;padding:0 3px;border-radius:50%;background:var(--PRIMARY);color:#fff;font-size:10px;line-height:16px;text-align:center;font-family:var(--font-medium);display:inline-flex;align-items:center;justify-content:center}\n"], dependencies: [{ kind: "component", type: i2$5.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i2$5.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4$6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: i5$2.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: i6$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i7.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i7.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i7.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i7.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i7.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i7.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i7.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i7.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i7.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i7.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i7.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i7.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i7.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i7.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i11.CdkColumnDef, selector: "[cdkColumnDef]", inputs: ["cdkColumnDef", "sticky", "stickyEnd"] }, { kind: "directive", type: CoreGridColumnResizeDirective, selector: "[grid-column-resize]", inputs: ["grid-column-resize"], outputs: ["columnResized"] }, { kind: "component", type: CoreGridColumnTemplateComponent, selector: "core-grid-column-template", inputs: ["component", "inputs", "outputs", "value", "componentTemplateMap"], outputs: ["refreshEvent", "multiRunEvent", "multiProgressEvent", "multiFinishEvent"] }, { kind: "component", type: CoreGridFiltersComponent, selector: "core-grid-filters", inputs: ["userView", "smallSize", "notSaveFilters", "columns", "componentTemplateMap"], outputs: ["changeFilterItems"] }, { kind: "component", type: DoubleScrollbarsComponent, selector: "core-double-scrollbar", inputs: ["doubleScrollBarHorizontal"] }, { kind: "pipe", type: CoreGirdDynamicPipe, name: "dynamicPipe" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreServerGridComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-grid', standalone: false, template: "<div class=\"grid\">\n  <div class=\"data-grid-btn-wrap\" [style.display]=\"settings.hideToolbar === true ? 'none' : 'flex'\">\n    <div class=\"sln-left-side-spacer\">\n      <ng-content select=\"[toolbarLeft]\"></ng-content>\n      @if (settings.useFiltersWindow !== true) {\n        <core-grid-filters [userView]=\"getViewKey()\" [notSaveFilters]=\"settings.notSaveFilters\" [columns]=\"settings.columns\" [smallSize]=\"true\" [componentTemplateMap]=\"settings.componentTemplateMap\" [notSaveFilters]=\"settings.notSaveFilters\" (changeFilterItems)=\"changeFilterItems($event)\"></core-grid-filters>\n      }\n    </div>\n    <div class=\"sln-right-side-spacer\">\n      @if (settings.paginatorUsed === true && settings.paginatorPosition === 'top') {\n        <div class=\"sln-max-width\">\n          <mat-paginator #paginator (page)=\"changePaginator($event)\"\n            [length]=\"_gridConfig?.paginator?.total\"\n            [pageSize]=\"_gridConfig?.paginator?.pageSize\"\n            [pageSizeOptions]=\"[10, 25, 100]\"\n          class=\"sln-mat-paginator\"></mat-paginator>\n        </div>\n      }\n      <ng-content select=\"[toolbarRight]\"></ng-content>\n\n      @if (settings.useFiltersWindow === true) {\n        @if (anyFilters === true) {\n          <button class=\"sln-grid-multi-commands\" (click)=\"clearStorageFilters()\" tid=\"clearStorageFilters\" matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044E\">\n            <div class=\"sln-filter-delete\"></div>\n          </button>\n          <button class=\"sln-grid-multi-commands\" (click)=\"showFilters()\" tid=\"showFilters\" matTooltip=\"\u0424\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044F\">\n            <div class=\"sln-filter-full\"></div>\n          </button>\n        }\n        @if (anyFilters === false) {\n          <button  class=\"sln-grid-multi-commands\" (click)=\"showFilters()\" tid=\"showFilters\" matTooltip=\"\u0424\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044F\">\n            <div class=\"sln-filter-empty\"></div>\n          </button>\n        }\n      }\n\n      @if(settings.useVariativeViewMode === true) {\n        <div class=\"sln-variative-view-mode-group\">\n          <button class=\"sln-variative-view-mode-button sln-variative-view-mode-button-l\"\n                  [class.sln-variative-view-mode-button_active]=\"settings.variativeViewMode !== 2\"\n                  (click)=\"changeVariativeViewMode(1)\">\n            <div class=\"sln-grid-lists\"></div>\n          </button>\n          <button class=\"sln-variative-view-mode-button sln-variative-view-mode-button-r\"\n                  [class.sln-variative-view-mode-button_active]=\"settings.variativeViewMode === 2\"\n                  (click)=\"changeVariativeViewMode(2)\">\n            <div class=\"sln-grid-table\"></div>\n          </button>\n        </div>\n      }\n\n    \n     \n      @if (showMultiCommandsBtn) {\n        <button [disabled]=\"!_progressHide\" class=\"sln-grid-multi-commands\" tid=\"grid-multi-commands\" [matMenuTriggerFor]=\"multiCommandsMenu\" matTooltip=\"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\">\n          <div class=\"sln-grid-grid-management\"></div>\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\n        </button>\n        <mat-menu #multiCommandsMenu=\"matMenu\" class=\"sln-grid-menu\">\n          @if (settings.refreshButtonUsed === true) {\n            <button mat-menu-item (click)=\"refreshClick()\" tid=\"refreshClick\" matTooltip=\"\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C\">\n              <div class=\"sln-grid-update\" #refreshButton></div>\n              <span class=\"b-margin-icon\">\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C</span>\n            </button>\n          }\n          @if (settings.useColumnsSettings === true && settings.variativeViewMode !== 2) {\n            <button mat-menu-item (click)=\"editColumns()\" tid=\"editColumns\">\n              <div class=\"sln-grid-mattable-settings\"></div>\n              <span class=\"b-margin-icon\">\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F</span>\n            </button>\n          }\n          @if (settings.userServerConfiguration === true) {\n            <button mat-menu-item (click)=\"createUserView()\" tid=\"createUserView\">\n              <div class=\"sln-grid-save\"></div>\n              <span class=\"b-margin-icon\">{{ settings.viewKey?.length > 0 ? '\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C' : '\u0421\u043E\u0437\u0434\u0430\u0442\u044C' }} \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435</span>\n            </button>\n          }  \n          @if (settings.useExport === true) {\n            <button mat-menu-item (click)=\"exportExcel()\" tid=\"exportExcel\">\n              <div class=\"sln-export-to-excel\"></div>\n              <span class=\"b-margin-icon\">\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 Excel</span>\n            </button>\n          }\n          @if (settings.multiCommands === true && settings.multiCommandsAccess !== undefined && settings.multiCommandsAccess() ===  true) {\n            <ng-content select=\"[multiCommands]\"></ng-content>\n          }        \n        </mat-menu>\n      }\n    </div>\n  </div>\n  \n  @if (!_progressHide) {\n    <mat-progress-bar mode=\"determinate\" [value]=\"_progress\"></mat-progress-bar>\n  }\n  <!--ViewMode.Card-->\n  @if (settings.variativeViewMode === 2) {\n    <div class=\"sln-grid-card-mode-container\">\n        @for (item of _dataSource.dataItems; track item) {\n        <mat-card class=\"settings.viewCardModeSettings?.cardClass\">\n          <mat-card-content>\n            <ng-container [ngTemplateOutlet]=\"settings.viewCardModeSettings.cardTpl()\" [ngTemplateOutletContext]=\"{ row: item }\"></ng-container>\n          </mat-card-content>\n        </mat-card>\n      }\n    </div>\n  }\n  <div [hidden]=\"settings.variativeViewMode === 2\">\n    <core-double-scrollbar >\n      <table mat-table\n        [dataSource]=\"_dataSource\"\n        multiTemplateDataRows\n        class=\"sln-data-grid__table\">\n\n        @if (canSelect()) {\n          <ng-container matColumnDef=\"selected\">\n            <th mat-header-cell *matHeaderCellDef>\n              <mat-checkbox [ngModel]=\"_isAllSelected\" (change)=\"selectAll($event)\" class=\"sln-mat-checkbox\"></mat-checkbox>\n            </th>\n            <td mat-cell *matCellDef=\"let row\">\n              @if (settings.selectLogicRowView === undefined || settings.selectLogicRowView(row) === true) {\n                <mat-checkbox [ngModel]=\"isSelectedRow(row)\" name=\"selected-{{row[settings.selectLogicKey]}}\" class=\"sln-mat-checkbox\" (click)=\"directSelectCheckbox($event, row)\"></mat-checkbox>\n              }\n            </td>\n            @if (settings.aggregateUsed === true) {\n              <td mat-footer-cell *matFooterCellDef></td>\n            }            \n          </ng-container>\n        }\n\n        <!-- columns start-->\n        @for (column of settings.columns; track column) {\n          <ng-container [cdkColumnDef]=\"column.key\">\n            <!--header start-->\n            @if (column.useSort) {\n              <th class=\"sln-default-label sln-sortable-header\" mat-header-cell *matHeaderCellDef [grid-column-resize]=\"settings.resizeColumnUsed !== false ? column : null\" (columnResized)=\"onColumnResized($event)\" [style.width.px]=\"column.width\" [style.minWidth.px]=\"column.width\" [style.maxWidth.px]=\"column.width\" [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true\" (click)=\"onSortHeaderClick($event, column)\">\n                <div class=\"{{ getPosition(column, '') }}\">\n                  {{ column.title !== \"*\" ? column.title : \"\" }}\n                  <span class=\"sln-sort-indicator\" [class.sln-sort-indicator_active]=\"isSortActive(column.key)\" [class.sln-sort-indicator_desc]=\"getSortDirection(column.key) === 'desc'\">\n                    <span class=\"sln-sort-indicator__arrow\" title=\"\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0442\u0435 Shift, \u0447\u0442\u043E\u0431\u044B \u043E\u0442\u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u0438\u043C \u0441\u0442\u043E\u043B\u0431\u0446\u0430\u043C\"></span>\n                    @if (isSortActive(column.key) && hasMultipleSorts() && getSortOrder(column.key) !== null) {\n                      <span class=\"sln-sort-indicator__order\">{{ getSortOrder(column.key) }}</span>\n                    }\n                  </span>\n                </div>\n              </th>\n            }\n            @if (!column.useSort) {\n              <th class=\"sln-default-label\" mat-header-cell *matHeaderCellDef [grid-column-resize]=\"settings.resizeColumnUsed !== false ? column : null\" (columnResized)=\"onColumnResized($event)\" [style.width.px]=\"column.width\" [style.minWidth.px]=\"column.width\" [style.maxWidth.px]=\"column.width\" [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true\">\n                <div class=\"{{ getPosition(column, '') }}\">\n                  {{ column.title !== \"*\" ? column.title : \"\" }}\n                </div>\n              </th>\n            }\n            <!--header end-->\n            <!--row start-->\n            @if (!!column.columnTemplate) {\n              <td mat-cell *matCellDef=\"let row\" [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true || !shouldRenderCell(row, column)\">\n                <div class=\"{{ getPosition(column, 'b-') }}\">\n                  @if (column.columnTemplateHtml && (column.checkRowContentFn === undefined || column.checkRowContentFn(row) === true)) {\n                    <div [innerHTML]=\"renderCustomHtmlTemplate(column.columnTemplateHtml, column.columnTemplateHtmlKeys, row)\"></div>\n                  }\n                  @if (!column.columnTemplateHtml && (column.checkRowContentFn === undefined || column.checkRowContentFn(row) === true)) {\n                    <core-grid-column-template [component]=\"column.columnTemplateType\" [componentTemplateMap]=\"settings.componentTemplateMap\" [value]=\"row\"\n                      [inputs]=\"column.columnTemplateTypeInputs\" [outputs]=\"column.columnTemplateTypeOutputs\"\n                      (refreshEvent)=\"refreshClick()\"\n                      (multiRunEvent)=\"multiRunEvent()\"\n                      (multiProgressEvent)=\"multiProgressEvent($event)\"\n                    (multiFinishEvent)=\"multiFinishEvent($event)\"></core-grid-column-template>\n                  }\n                </div>\n              </td>\n\n              @if (settings.aggregateUsed === true) {\n                <td mat-footer-cell *matFooterCellDef [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true\">\n                  <div class=\"{{ getPosition(column, '') }}\">\n                    \n                  </div>\n                </td>\n              }\n            }\n            @if (!column.columnTemplate) {\n              <td mat-cell *matCellDef=\"let row\" [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true || !shouldRenderCell(row, column)\">\n                @if (column.checkRowContentFn === undefined || column.checkRowContentFn(row) === true) {\n                  <div class=\"{{ getPosition(column, '') }}\">\n                    {{ cell(row, column.key) | dynamicPipe: column.pipeType }}\n                  </div>\n                }\n              </td>\n              @if (settings.aggregateUsed === true) {\n                <td mat-footer-cell *matFooterCellDef [hidden]=\"column.columnAccess !== undefined && column.columnAccess() !==  true\">\n                  <div class=\"{{ getPosition(column, '') }}\">\n                    \n                  </div>\n                </td>\n              }\n            }\n            <!--row end-->\n          </ng-container>\n        }\n        <!-- columns end-->\n        <!-- expanded row detail start-->\n        @if (settings.expanded) {\n          <ng-container matColumnDef=\"expandedDetail\">\n            <td mat-cell *matCellDef=\"let row\" [attr.colspan]=\"_displayedColumns.length\">\n              @if (row === _expandedElement) {\n                <div\n                  class=\"expanded-element-detail\"\n                  [class.expanded]=\"row === _expandedElement\"\n                >\n                  <ng-container [ngTemplateOutlet]=\"settings.expandedElementTpl()\" [ngTemplateOutletContext]=\"{ row: row }\"></ng-container>\n                </div>\n              }\n            </td>\n          </ng-container>\n        }\n        <!-- expanded row detail end-->\n        <tr mat-header-row *matHeaderRowDef=\"_displayedColumns\"></tr>\n        <tr mat-row\n          *matRowDef=\"let row; columns: _displayedColumns\"\n          [matTooltip]=\"(settings.rowTooltipFunction ? settings.rowTooltipFunction(row) : undefined)\" matTooltipPosition=\"above\" matTooltipClass=\"custom-tooltip\"\n          class=\"grid-element-row {{ settings.rowBackgroundFunction !== undefined ? settings.rowBackgroundFunction(row) : '' }}\"\n          [class.grid-expanded-row]=\"_expandedElement === row\"\n          [class.sln-grid-row-clickable]=\"settings.doubleClickUsed === true\"\n          (click)=\"expandOnClick(row, $event)\"\n          (dblclick)=\"onRowDoubleClick(row)\">\n        </tr>\n        @if (settings.expanded) {\n          <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"grid-detail-row\"></tr>\n        }\n        @if (settings.aggregateUsed === true) {\n          <tr mat-footer-row *matFooterRowDef=\"_displayedColumns; sticky: true\" class=\"sln-grid-aggregation-row\" [hidden]=\"!hasDataItems()\"></tr>\n        }\n      </table>\n    </core-double-scrollbar>\n    @if (!hasDataItems()) {\n      <span class=\"sln-info-grid\">\u041F\u043E \u0432\u0430\u0448\u0435\u043C\u0443 \u0437\u0430\u043F\u0440\u043E\u0441\u0443 \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E</span>\n    }\n  </div>\n  @if (settings.paginatorUsed === true && settings.paginatorPosition === 'bottom') {\n    <div class=\"sln-grid-footer\">\n        <div class=\"sln-grid-footer__paginator\">\n          <mat-paginator #paginator (page)=\"changePaginator($event)\"\n            [length]=\"_gridConfig?.paginator?.total\"\n            [pageSize]=\"_gridConfig?.paginator?.pageSize\"\n            [pageSizeOptions]=\"[10, 25, 100]\"\n            class=\"sln-mat-paginator\"></mat-paginator>\n        </div>\n    </div>\n  }\n</div>", styles: ["mat-toolbar.mat-toolbar-single-row{padding:0 20px;min-width:300px;width:100%;height:70px;display:flex;align-items:center;position:sticky;top:0;z-index:9999}.grid{padding-top:10px;padding-bottom:10px;min-width:0;display:flex;flex-direction:column}.table-wrapper{position:relative;width:100%}.sln-data-grid__table mat-form-field:not(:last-child){padding-right:20px}.sln-data-grid__table{width:100%;table-layout:auto;white-space:nowrap}.sln-data-grid__table.sln-resize-active{table-layout:fixed}th{max-width:250px;text-wrap:inherit}td{max-width:250px;text-wrap:auto}.data-grid-btn-wrap{display:flex;align-items:center;justify-content:space-between;background:#fff;padding:0 15px var(--GRID-TOOLBAR-PADDING-BOTTOM, 0);border-radius:3px;position:sticky;gap:20px;top:0;z-index:12}.data-grid-btn-wrap .sln-left-side-spacer{display:flex;align-items:center;gap:10px;flex:1}.data-grid-btn-wrap .sln-left-side-spacer mat-form-field,.data-grid-btn-wrap .sln-left-side-spacer core-organization-search{width:200px;margin-left:5px}.data-grid-btn-wrap .sln-left-side-spacer core-grid-filters{flex:1}.data-grid-btn-wrap .sln-left-side-spacer button p{margin-bottom:0;color:var(--PRIMARY);font-family:var(--font-bold)}.data-grid-btn-wrap .sln-right-side-spacer{display:flex;align-items:center;gap:10px}.sln-info-grid{display:block;width:96%;margin:10px auto;color:var(--DARK-GREY);font-family:var(--font-medium);letter-spacing:.02em;font-size:18px}.sln-grid-menu button img{width:20px;height:20px}.sln-grid-content-left{text-align:left}.sln-grid-content-center{text-align:center}.sln-grid-content-right{text-align:right}th .sln-grid-content-left,th .sln-grid-content-center,th .sln-grid-content-right{font-family:var(--GRID-TH-FONT-FAMILY, var(--font-medium))}td .sln-grid-content-left,td .sln-grid-content-center,td .sln-grid-content-right,.sln-grid-content-b-left,.sln-grid-content-b-center,.sln-grid-content-b-right{font-family:var(--GRID-TD-FONT-FAMILY, var(--font-medium))}th .sln-grid-content-left{padding-left:var(--GRID-TH-PADDING-LEFT, 3px)}th .sln-grid-content-right{padding-right:var(--GRID-TH-PADDING-RIGHT, 3px)}.grid table th,.grid .mat-mdc-header-cell,.grid th .sln-grid-content-left,.grid th .sln-grid-content-center,.grid th .sln-grid-content-right{text-align:var(--GRID-TH-TEXT-ALIGN, revert);justify-content:var(--GRID-TH-JUSTIFY-CONTENT, revert)}.sln-grid-content-b-left{display:flex;text-align:left;justify-content:left}.sln-grid-content-b-center{display:flex;text-align:center;justify-content:center}.sln-grid-content-b-right{display:flex;text-align:right;justify-content:right}::-webkit-scrollbar{width:5px}.sln-grid-vertical-dots{background-size:4px}.sln-variative-view-mode-group{display:inline-flex;align-items:center}.sln-variative-view-mode-button{min-width:32px;height:32px;padding:0 6px;border:none;background:var(--LIGHT-GREY);color:var(--DARK-GREY);font-family:var(--font-medium);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.sln-variative-view-mode-button-r{border-radius:0 5px 5px 0;border:2px solid var(--GRAY);border-left:none}.sln-variative-view-mode-button-l{border-radius:5px 0 0 5px;border:2px solid var(--GRAY);border-right:none}.table-scroll-top{position:sticky;height:20px;z-index:22;top:-15px}.table-scroll-top .scroll-content{overflow-x:auto;height:20px}.table-scroll-bottom{overflow-x:auto}::-webkit-scrollbar-thumb{background-color:#cf2f2f;border-radius:10px}.scroll-content{width:100%;display:inline-block}.exportExcel{position:relative}.exportExcel:disabled{opacity:.6;cursor:not-allowed!important;pointer-events:none}.sln-mat-progress-bar{position:absolute;top:24px;width:99%;left:0}.sln-grid-card-mode-container{display:flex;flex-wrap:wrap;gap:16px;justify-content:flex-start}.sln-grid-footer{display:flex;align-items:center;justify-content:flex-start;gap:16px;padding:6px 15px 0}.sln-grid-footer__paginator{flex:0 0 auto;margin-left:0}.sln-grid-footer__paginator ::ng-deep .mat-mdc-paginator-container{justify-content:flex-start}.sln-grid-footer__paginator ::ng-deep .mat-mdc-paginator-page-size{order:2}.sln-grid-footer__paginator ::ng-deep .mat-mdc-paginator-range-actions{order:1}.sln-grid-aggregation-row{background:#fff;position:sticky;bottom:0;z-index:11}.sln-grid-aggregation-row .mat-mdc-footer-cell,.sln-grid-aggregation-row .mat-footer-cell{background:#fff}.sln-resizable-column{overflow:visible;cursor:default}.sln-resizable-column .mat-sort-header-container{padding-right:12px;cursor:pointer}.sln-resizable-column.sln-resize-hover,.sln-resizable-column.sln-resize-hover .mat-sort-header-container{cursor:col-resize}.sln-resizable-column:hover:before,.sln-resizable-column:hover:after,.sln-resizable-column.sln-resize-hover:before{opacity:1}.sln-resizable-column.sln-resize-hover:after{background:linear-gradient(#3f51b5bf,#3f51b5bf) right 0 center/1px 18px no-repeat,linear-gradient(#3f51b58c,#3f51b58c) right 5px center/1px 12px no-repeat,linear-gradient(#3f51b559,#3f51b559) right 10px center/1px 6px no-repeat}.sln-resizable-column:before{content:\"\";position:absolute;top:0;right:0;bottom:0;width:12px;background:transparent;opacity:0;transition:opacity .12s ease;pointer-events:none}.sln-resizable-column:after{content:\"\";position:absolute;top:0;bottom:0;right:0;width:12px;background:linear-gradient(#3f51b540,#3f51b540) right 0 center/1px 18px no-repeat,linear-gradient(#3f51b533,#3f51b533) right 5px center/1px 12px no-repeat,linear-gradient(#3f51b529,#3f51b529) right 10px center/1px 6px no-repeat;opacity:0;transition:opacity .12s ease;pointer-events:none}.sln-grid-row-clickable{cursor:pointer}.sln-sortable-header{cursor:pointer;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.sln-sortable-header .sln-grid-content-left,.sln-sortable-header .sln-grid-content-center,.sln-sortable-header .sln-grid-content-right{display:flex;align-items:center;gap:6px}.sln-sortable-header .sln-grid-content-right{justify-content:flex-end}.sln-sortable-header .sln-grid-content-center{justify-content:center}.sln-sort-indicator{width:28px;display:inline-flex;align-items:center;justify-content:flex-start;opacity:0;transition:opacity .15s ease}.sln-sortable-header:hover .sln-sort-indicator{opacity:.45}.sln-sort-indicator.sln-sort-indicator_active{opacity:1!important}.sln-sort-indicator__arrow{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:8px solid var(--PRIMARY)}.sln-sort-indicator_desc .sln-sort-indicator__arrow{border-bottom:none;border-top:8px solid var(--PRIMARY)}.sln-sort-indicator__order{min-width:16px;height:16px;margin-left:5px;padding:0 3px;border-radius:50%;background:var(--PRIMARY);color:#fff;font-size:10px;line-height:16px;text-align:center;font-family:var(--font-medium);display:inline-flex;align-items:center;justify-content:center}\n"] }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: GridStoreService }], propDecorators: { _filtersComponent: [{
                type: ViewChild,
                args: [CoreGridFiltersComponent]
            }], settings: [{
                type: Input
            }], selectItem: [{
                type: Output
            }], _paginator: [{
                type: ViewChild,
                args: [MatPaginator]
            }], topScroll: [{
                type: ViewChild,
                args: ['topScroll']
            }], bottomScroll: [{
                type: ViewChild,
                args: ['bottomScroll']
            }], onWindowKeydown: [{
                type: HostListener,
                args: ['window:keydown', ['$event']]
            }] } });

var DadataType;
(function (DadataType) {
    DadataType["address"] = "address";
    DadataType["bank"] = "bank";
    DadataType["party"] = "party";
    DadataType["fms"] = "fms_unit";
})(DadataType || (DadataType = {}));
var Division;
(function (Division) {
    Division["administrative"] = "administrative";
    Division["municipal"] = "municipal";
})(Division || (Division = {}));
const DadataConfigDefault = {
    type: DadataType.address,
    delay: 500,
    limit: 10,
    width: 'auto',
    minWidth: '0',
    partyAddress: 'city',
    locations: null,
    division: Division.administrative
};

class DadataIntegrationService {
    constructor(http, _startup) {
        this.http = http;
        this._startup = _startup;
    }
    getData(value, type = DadataType.address, config) {
        const url = 'https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/';
        const httpOptions = {
            headers: new HttpHeaders({
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'Authorization': 'Token ' + this._startup.getByKey('DADATA_API_TOKEN'),
            })
        };
        const body = Object.assign({}, { query: value }, { count: config?.limit }, { location: config?.locations }, { location_bust: config?.locationsBoost }, { from_bound: config?.bounds?.fromBound }, { to_bound: config?.bounds?.toBound }, { division: config?.division });
        return this.http.post(url + type, body, httpOptions);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DadataIntegrationService, deps: [{ token: i1$5.HttpClient }, { token: Startup }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DadataIntegrationService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DadataIntegrationService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: i1$5.HttpClient }, { type: Startup }] });

function createDaDataValidator(value) {
    return (c) => {
        const err = {
            rangeError: {
                given: c.value,
                expected: value,
            }
        };
        return (c.value !== value) ? err : null;
    };
}
/**
 * Autocomplete IDs need to be unique across components, so this counter exists outside of
 * the component definition.
 */
let uniqueDadataIdCounter$1 = 0;
class CoreDadataFmsCodeComponent extends CoreAbstractAccessorComponent {
    constructor(_integrationService, r, elRef) {
        super();
        this._integrationService = _integrationService;
        this.r = r;
        this.elRef = elRef;
        this.currentFocus = -1;
        this.opened = false;
        this.data = [];
        this.config = { type: DadataType.fms };
        this.type = DadataType.fms;
        this.limit = DadataConfigDefault.limit;
        this.locations = null;
        this.selected = new EventEmitter();
        this.inputString$ = new Subject();
        /** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
        this.id = `ngx-dadata-${uniqueDadataIdCounter$1++}`;
        this.placeholder = 'Код подразделения';
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.type = this.config.type;
        this.locations = this.config.locations;
        this.inputString$
            .pipe(debounce(() => timer(this.config.delay ? this.config.delay : 500)), this.takeUntilDestroyed())
            .subscribe(x => {
            this._integrationService.getData(x, this.type, this.config).subscribe((y) => {
                this.data = y.suggestions;
                if (this.data.length) {
                    this.opened = true;
                }
            });
        });
    }
    getData(value) {
        this.inputString$.next(value);
        this.currentFocus = -1;
    }
    onClick(e, item) {
        this.selectedSuggestion = item;
        this.data = [];
        this.currentFocus = -1;
        this.opened = false;
        this.selected.emit(item);
    }
    onOutsideClick($event) {
        if (!this.opened) {
            return;
        }
        if (!this.elRef.nativeElement.contains($event.target)) {
            this.data = [];
            this.opened = false;
        }
    }
    onArrowDown() {
        this.removeFocus(this.currentFocus);
        if (this.currentFocus >= this.data.length - 1) {
            this.currentFocus = 0;
        }
        else {
            this.currentFocus++;
        }
        this.setFocus(this.currentFocus);
    }
    onArrowUp() {
        this.removeFocus(this.currentFocus);
        if (this.currentFocus === 0) {
            this.currentFocus = this.data.length - 1;
        }
        else {
            this.currentFocus--;
        }
        this.setFocus(this.currentFocus);
    }
    onEnter(event) {
        this.selectedSuggestion = this.data[this.currentFocus];
        //this.inputValue.nativeElement.value = this.selectedSuggestion.value;
        this.data = [];
        this.currentFocus = -1;
        //this.onChange(this.selectedSuggestion.value);
        this.selected.emit(this.selectedSuggestion);
    }
    setFocus(id) {
        const activeEl = document.getElementById(id + 'item');
        this.r.addClass(activeEl, 'active');
    }
    removeFocus(id) {
        if (id !== -1) {
            const activeEl = document.getElementById(id + 'item');
            this.r.removeClass(activeEl, 'active');
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDadataFmsCodeComponent, deps: [{ token: DadataIntegrationService }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreDadataFmsCodeComponent, isStandalone: false, selector: "core-dadata-fms-code", inputs: { limit: "limit", locations: "locations" }, outputs: { selectedSuggestion: "selectedSuggestion", selected: "selected" }, host: { listeners: { "document:click": "onOutsideClick($event)" } }, providers: [{
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreDadataFmsCodeComponent),
                multi: true
            }], viewQueries: [{ propertyName: "inputValue", first: true, predicate: ["inputValue"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div  provideParentForm class=\"autocomplete\">\n  <div class=\"col-md-12 sln-autocomplete-field\">\n    <mat-form-field>\n      <mat-label class=\"sln-default-label\">{{ placeholder }}</mat-label>\n      <input matInput [(ngModel)]=\"value\" #inputValue=\"ngModel\" (ngModelChange)=\"onValueChange($event)\"\n        [disabled]=\"disabled  ? true : null\" type=\"text\" class=\"search\" (input)=\"getData(inputValue.value)\"\n        [placeholder]=\"placeholder\" [mask]=\"'000-000'\" [required]=\"settings.isRequired\" (keyup.ArrowDown)=\"onArrowDown()\"\n        (keyup.ArrowUp)=\"onArrowUp()\" (keyup.Enter)=\"onEnter($event)\"  [attr.fieldName]=\"fieldName\"\n        name=\"{{ fieldName }}\" [attr.maxlength]=\"250\" autocomplete=\"off\" spellcheck=\"false\" />\n      </mat-form-field>\n    </div>\n    @if (data.length) {\n      <div>\n        <div class=\"autocomplete-items\">\n          @for (item of data; track item; let i = $index) {\n            <div class=\"autocomplele-item\" (click)=\"onClick($event, item)\"\n              [id]=\"i+'item'\">\n              {{item.value}}\n            </div>\n          }\n        </div>\n      </div>\n    }\n  </div>\n", styles: ["input{border:0 solid transparent;padding:5px}input[type=text]{width:100%}input[type=submit]{background-color:#1e90ff;color:#fff}.autocomplete-items{position:fixed;border:1px solid var(--LIGHT-GRAY);z-index:10;margin-bottom:15px;overflow-y:scroll;max-height:280px;background:#fff;border-radius:4px;max-width:658px;transform:translateY(60px)}.autocomplete-items .autocomplele-item{padding:8px 10px;cursor:pointer;background-color:#fff;border-bottom:1px solid #d4d4d4;color:var(--DARK-GREY);font-family:var(--font-medium)}.autocomplete-items .autocomplele-item:hover{background-color:#e9e9e98f}.autocomplete-items .autocomplele-item.active{background-color:#1e90ff!important;color:var(--WHITE)}.autocomplete-items .autocomplele-item span{color:#555;font-size:80%}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDadataFmsCodeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-dadata-fms-code', providers: [{
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreDadataFmsCodeComponent),
                            multi: true
                        }], standalone: false, template: "<div  provideParentForm class=\"autocomplete\">\n  <div class=\"col-md-12 sln-autocomplete-field\">\n    <mat-form-field>\n      <mat-label class=\"sln-default-label\">{{ placeholder }}</mat-label>\n      <input matInput [(ngModel)]=\"value\" #inputValue=\"ngModel\" (ngModelChange)=\"onValueChange($event)\"\n        [disabled]=\"disabled  ? true : null\" type=\"text\" class=\"search\" (input)=\"getData(inputValue.value)\"\n        [placeholder]=\"placeholder\" [mask]=\"'000-000'\" [required]=\"settings.isRequired\" (keyup.ArrowDown)=\"onArrowDown()\"\n        (keyup.ArrowUp)=\"onArrowUp()\" (keyup.Enter)=\"onEnter($event)\"  [attr.fieldName]=\"fieldName\"\n        name=\"{{ fieldName }}\" [attr.maxlength]=\"250\" autocomplete=\"off\" spellcheck=\"false\" />\n      </mat-form-field>\n    </div>\n    @if (data.length) {\n      <div>\n        <div class=\"autocomplete-items\">\n          @for (item of data; track item; let i = $index) {\n            <div class=\"autocomplele-item\" (click)=\"onClick($event, item)\"\n              [id]=\"i+'item'\">\n              {{item.value}}\n            </div>\n          }\n        </div>\n      </div>\n    }\n  </div>\n", styles: ["input{border:0 solid transparent;padding:5px}input[type=text]{width:100%}input[type=submit]{background-color:#1e90ff;color:#fff}.autocomplete-items{position:fixed;border:1px solid var(--LIGHT-GRAY);z-index:10;margin-bottom:15px;overflow-y:scroll;max-height:280px;background:#fff;border-radius:4px;max-width:658px;transform:translateY(60px)}.autocomplete-items .autocomplele-item{padding:8px 10px;cursor:pointer;background-color:#fff;border-bottom:1px solid #d4d4d4;color:var(--DARK-GREY);font-family:var(--font-medium)}.autocomplete-items .autocomplele-item:hover{background-color:#e9e9e98f}.autocomplete-items .autocomplele-item.active{background-color:#1e90ff!important;color:var(--WHITE)}.autocomplete-items .autocomplele-item span{color:#555;font-size:80%}\n"] }]
        }], ctorParameters: () => [{ type: DadataIntegrationService }, { type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { limit: [{
                type: Input
            }], locations: [{
                type: Input
            }], selectedSuggestion: [{
                type: Output
            }], selected: [{
                type: Output
            }], inputValue: [{
                type: ViewChild,
                args: ['inputValue', { static: true }]
            }], onOutsideClick: [{
                type: HostListener,
                args: ['document:click', ['$event']]
            }] } });

function createDaDataFmsValidator(value) {
    return (c) => {
        const err = {
            rangeError: {
                given: c.value,
                expected: value,
            }
        };
        return (c.value !== value) ? err : null;
    };
}
/**
 * Autocomplete IDs need to be unique across components, so this counter exists outside of
 * the component definition.
 */
let uniqueDadataIdCounter = 0;
class CoreDadataSearchComponent extends CoreBaseDestroyComponent {
    constructor(_integrationService, r, _cd, elRef) {
        super();
        this._integrationService = _integrationService;
        this.r = r;
        this._cd = _cd;
        this.elRef = elRef;
        this.v = '';
        this.currentFocus = -1;
        this.opened = false;
        this.data = [];
        this.config = DadataConfigDefault;
        this.configChanged = new EventEmitter();
        this.disabled = null;
        this.type = DadataType.address;
        this.limit = DadataConfigDefault.limit;
        this.placeholder = '';
        this.locations = null;
        this.selected = new EventEmitter();
        this.inputString$ = new Subject();
        /** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
        this.id = `ngx-dadata-${uniqueDadataIdCounter++}`;
        // onSuggestionSelected = (value: string) => {};
        this.onTouched = () => {
        };
        this.propagateChange = () => {
        };
        this.validateFn = () => {
        };
        this.dadataEnableMunitipal = false;
    }
    get value() {
        return this.v;
    }
    set value(v) {
        if (v !== this.v) {
            this.v = v;
            this.propagateChange(v);
        }
    }
    ngOnInit() {
        this.type = this.config.type;
        this.dadataEnableMunitipal = this.config.division === Division.municipal;
        this.locations = this.config.locations;
        this.inputString$
            .pipe(debounce(() => timer(this.config.delay ? this.config.delay : 500)), this.takeUntilDestroyed())
            .subscribe(x => {
            this._integrationService.getData(x, this.type, this.config).subscribe((y) => {
                this.data = y.suggestions;
                if (this.data.length) {
                    this.opened = true;
                }
                this._cd.markForCheck();
            });
        });
        this.writeValue(this.address?.fullAddress);
    }
    getData(value) {
        this.inputString$.next(value);
        this.currentFocus = -1;
        if (Utility.isEmpty(value)) {
            const data = { ...this.selectedSuggestion, data: null };
            this.selected.emit(data);
        }
    }
    onClick(e, item) {
        this.inputValue.nativeElement.value = item.value;
        this.propagateChange(item.value);
        this.inputValue.nativeElement.focus();
        this.selectedSuggestion = item;
        this.data = [];
        this.currentFocus = -1;
        this.opened = false;
        this.selected.emit(item);
    }
    onOutsideClick($event) {
        if (!this.opened) {
            return;
        }
        if (!this.elRef.nativeElement.contains($event.target)) {
            this.data = [];
            this.opened = false;
        }
    }
    onArrowDown() {
        this.removeFocus(this.currentFocus);
        if (this.currentFocus >= this.data.length - 1) {
            this.currentFocus = 0;
        }
        else {
            this.currentFocus++;
        }
        this.setFocus(this.currentFocus);
    }
    onArrowUp() {
        this.removeFocus(this.currentFocus);
        if (this.currentFocus === 0) {
            this.currentFocus = this.data.length - 1;
        }
        else {
            this.currentFocus--;
        }
        this.setFocus(this.currentFocus);
    }
    onEnter(event) {
        this.selectedSuggestion = this.data[this.currentFocus];
        this.inputValue.nativeElement.value = this.selectedSuggestion.value;
        this.data = [];
        this.currentFocus = -1;
        this.propagateChange(this.selectedSuggestion.value);
        this.selected.emit(this.selectedSuggestion);
    }
    setFocus(id) {
        const activeEl = document.getElementById(id + 'item');
        this.r.addClass(activeEl, 'active');
    }
    removeFocus(id) {
        if (id !== -1) {
            const activeEl = document.getElementById(id + 'item');
            this.r.removeClass(activeEl, 'active');
        }
    }
    writeValue(value) {
        if (value !== undefined) {
            this.v = value;
        }
        else {
            this.v = '';
        }
        this.r.setProperty(this.inputValue.nativeElement, 'innerHTML', this.v);
    }
    /**
     * Set the function to be called
     * when the control receives a change event.
     *
     * @param fn a function
     */
    registerOnChange(fn) {
        // this.onSuggestionSelected = fn;
        this.propagateChange = fn;
    }
    /**
     * Set the function to be called
     * when the control receives a touch event.
     *
     * @param fn a function
     */
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    /**
     * Implements disabled state for this element
     *
     * @param isDisabled Disabled state flag
     */
    setDisabledState(isDisabled) {
        this.disabled = isDisabled;
    }
    onDivisionTypeChange($event) {
        if (!Utility.isEmpty($event)) {
            this.config.division = !!$event ? Division.municipal : Division.administrative;
            this._integrationService.getData(this.inputValue.nativeElement.value, this.type, this.config).subscribe((y) => {
                if (y.suggestions.length > 0) {
                    this.selected.emit(y.suggestions[0]);
                    this._cd.markForCheck();
                }
            });
            this.configChanged.emit(this.config);
        }
    }
    cleanForm() {
        this.value = '';
        this.selectedSuggestion = null;
        this.selected.emit(null);
        this.propagateChange(null);
    }
    asParty(obj) {
        return obj;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDadataSearchComponent, deps: [{ token: DadataIntegrationService }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreDadataSearchComponent, isStandalone: false, selector: "core-dadata-search", inputs: { config: "config", disabled: "disabled", type: "type", limit: "limit", placeholder: "placeholder", locations: "locations", address: "address" }, outputs: { configChanged: "configChanged", selectedSuggestion: "selectedSuggestion", selected: "selected" }, host: { listeners: { "document:click": "onOutsideClick($event)" } }, providers: [{
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreDadataSearchComponent),
                multi: true
            }], viewQueries: [{ propertyName: "inputValue", first: true, predicate: ["inputValue"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"autocomplete\">\n  <div class=\"col-md-12 sln-autocomplete-field\">\n    <mat-form-field>\n      <mat-label class=\"sln-default-label\">{{ placeholder }}</mat-label>\n      <input matInput [disabled]=\"disabled  ? true : null\"  type=\"text\" class=\"search\" #inputValue (input)=\"getData(inputValue.value)\"\n         (keyup.ArrowDown)=\"onArrowDown()\" (keyup.ArrowUp)=\"onArrowUp()\"\n        (keyup.Enter)=\"onEnter($event)\" spellcheck=\"false\" [(ngModel)]=\"value\" autocomplete=\"off\"/>\n        <div class=\"sln-position-close\">\n          @if (value) {\n            <div (click)=\"cleanForm()\" class=\"sln-common-cross-table\" matSuffix alt=\"\u0417\u0430\u043A\u0440\u044B\u0442\u044C\"></div>\n          }\n        </div>\n        @if (type === 'address') {\n          <div>\n            <core-field-bool  [(ngModel)]=\"dadataEnableMunitipal\" [settings]=\"{ mode: 'Checkbox'}\" name=\"dadataEnableMunitipal\" fieldName=\"dadataEnableMunitipal\" (valueChange)=\"onDivisionTypeChange($event)\" placeholder=\"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043C\u0443\u043D\u0438\u0446\u0438\u043F\u0430\u043B\u044C\u043D\u043E\u0435 \u0434\u0435\u043B\u0435\u043D\u0438\u0435?\"></core-field-bool>\n          </div>\n        }\n      </mat-form-field>\n    </div>\n    @if (data.length) {\n      <div>\n        <div class=\"autocomplete-items\">\n          @for (item of data; track item; let i = $index) {\n            <div class=\"autocomplele-item\" (click)=\"onClick($event, item)\" [id]=\"i+'item'\">\n              {{item.value}}\n              @if (type === 'party') {\n                <div>\n                  <small>\u0418\u041D\u041D: {{asParty(item.data)?.inn }}</small>,\n                  @if (asParty(item.data)?.kpp) {\n                    <small>  \u041A\u041F\u041F: {{asParty(item.data)?.kpp}}</small>\n                  }, \n                  <small class=\"full-adress\"> {{asParty(item.data)?.address?.value}}</small>\n                </div>\n              }\n            </div>\n          }\n        </div>\n      </div>\n    }\n  </div>\n", styles: ["mat-toolbar.mat-toolbar-single-row{width:98%!important}input{border:0 solid transparent;padding:5px}input[type=text]{width:100%}input[type=submit]{background-color:#1e90ff;color:#fff}.autocomplete-items{overflow:hidden;position:fixed;border:1px solid var(--LIGHT-GRAY);z-index:10;margin-bottom:15px;overflow-y:scroll;max-height:280px;background:#fff;border-radius:4px;max-width:658px;transform:translateY(60px)}.autocomplete-items .autocomplele-item{padding:5px 10px;cursor:pointer;background-color:#fff;border-bottom:1px solid #d4d4d4;font-family:DinProMedium;color:var(--DARK-GREY);font-family:var(--font-medium)}.autocomplete-items .autocomplele-item:hover{background-color:#e9e9e98f}.autocomplete-items .autocomplele-item.active{background-color:#e2e8ea73;color:var(--PRIMARY)}.autocomplete-items .autocomplele-item span{color:#555;font-size:80%}.autocomplete-items .autocomplele-item small{color:var(--MIDLE-GRAY)}.autocomplete-items .autocomplele-item .full-adress{color:var(--MIDLE-GRAY);font-size:13px;display:block;max-width:400px;overflow-wrap:break-word;word-break:break-word;white-space:normal}.col-md-12{padding:0}.sln-position-close{display:flex;position:absolute;right:6px;top:20px;line-height:0;align-items:baseline}.sln-position-close img{height:15px;margin-left:5px;cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDadataSearchComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-dadata-search', providers: [{
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreDadataSearchComponent),
                            multi: true
                        }], standalone: false, template: "<div class=\"autocomplete\">\n  <div class=\"col-md-12 sln-autocomplete-field\">\n    <mat-form-field>\n      <mat-label class=\"sln-default-label\">{{ placeholder }}</mat-label>\n      <input matInput [disabled]=\"disabled  ? true : null\"  type=\"text\" class=\"search\" #inputValue (input)=\"getData(inputValue.value)\"\n         (keyup.ArrowDown)=\"onArrowDown()\" (keyup.ArrowUp)=\"onArrowUp()\"\n        (keyup.Enter)=\"onEnter($event)\" spellcheck=\"false\" [(ngModel)]=\"value\" autocomplete=\"off\"/>\n        <div class=\"sln-position-close\">\n          @if (value) {\n            <div (click)=\"cleanForm()\" class=\"sln-common-cross-table\" matSuffix alt=\"\u0417\u0430\u043A\u0440\u044B\u0442\u044C\"></div>\n          }\n        </div>\n        @if (type === 'address') {\n          <div>\n            <core-field-bool  [(ngModel)]=\"dadataEnableMunitipal\" [settings]=\"{ mode: 'Checkbox'}\" name=\"dadataEnableMunitipal\" fieldName=\"dadataEnableMunitipal\" (valueChange)=\"onDivisionTypeChange($event)\" placeholder=\"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043C\u0443\u043D\u0438\u0446\u0438\u043F\u0430\u043B\u044C\u043D\u043E\u0435 \u0434\u0435\u043B\u0435\u043D\u0438\u0435?\"></core-field-bool>\n          </div>\n        }\n      </mat-form-field>\n    </div>\n    @if (data.length) {\n      <div>\n        <div class=\"autocomplete-items\">\n          @for (item of data; track item; let i = $index) {\n            <div class=\"autocomplele-item\" (click)=\"onClick($event, item)\" [id]=\"i+'item'\">\n              {{item.value}}\n              @if (type === 'party') {\n                <div>\n                  <small>\u0418\u041D\u041D: {{asParty(item.data)?.inn }}</small>,\n                  @if (asParty(item.data)?.kpp) {\n                    <small>  \u041A\u041F\u041F: {{asParty(item.data)?.kpp}}</small>\n                  }, \n                  <small class=\"full-adress\"> {{asParty(item.data)?.address?.value}}</small>\n                </div>\n              }\n            </div>\n          }\n        </div>\n      </div>\n    }\n  </div>\n", styles: ["mat-toolbar.mat-toolbar-single-row{width:98%!important}input{border:0 solid transparent;padding:5px}input[type=text]{width:100%}input[type=submit]{background-color:#1e90ff;color:#fff}.autocomplete-items{overflow:hidden;position:fixed;border:1px solid var(--LIGHT-GRAY);z-index:10;margin-bottom:15px;overflow-y:scroll;max-height:280px;background:#fff;border-radius:4px;max-width:658px;transform:translateY(60px)}.autocomplete-items .autocomplele-item{padding:5px 10px;cursor:pointer;background-color:#fff;border-bottom:1px solid #d4d4d4;font-family:DinProMedium;color:var(--DARK-GREY);font-family:var(--font-medium)}.autocomplete-items .autocomplele-item:hover{background-color:#e9e9e98f}.autocomplete-items .autocomplele-item.active{background-color:#e2e8ea73;color:var(--PRIMARY)}.autocomplete-items .autocomplele-item span{color:#555;font-size:80%}.autocomplete-items .autocomplele-item small{color:var(--MIDLE-GRAY)}.autocomplete-items .autocomplele-item .full-adress{color:var(--MIDLE-GRAY);font-size:13px;display:block;max-width:400px;overflow-wrap:break-word;word-break:break-word;white-space:normal}.col-md-12{padding:0}.sln-position-close{display:flex;position:absolute;right:6px;top:20px;line-height:0;align-items:baseline}.sln-position-close img{height:15px;margin-left:5px;cursor:pointer}\n"] }]
        }], ctorParameters: () => [{ type: DadataIntegrationService }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { config: [{
                type: Input
            }], configChanged: [{
                type: Output
            }], disabled: [{
                type: Input
            }], type: [{
                type: Input
            }], limit: [{
                type: Input
            }], placeholder: [{
                type: Input
            }], locations: [{
                type: Input
            }], address: [{
                type: Input
            }], selectedSuggestion: [{
                type: Output
            }], selected: [{
                type: Output
            }], inputValue: [{
                type: ViewChild,
                args: ['inputValue', { static: true }]
            }], onOutsideClick: [{
                type: HostListener,
                args: ['document:click', ['$event']]
            }] } });

class CoreDaDataModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDaDataModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreDaDataModule, declarations: [CoreDadataSearchComponent,
            CoreDadataFmsCodeComponent], imports: [CoreMatModule,
            CoreBaseModule,
            NgxMaskDirective,
            NgxMaskPipe,
            CoreControlModule,
            CoreDirectiveModule], exports: [CoreDadataSearchComponent,
            CoreDadataFmsCodeComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDaDataModule, providers: [
            DadataIntegrationService,
            provideNgxMask({
                decimalMarker: ','
            })
        ], imports: [CoreMatModule,
            CoreBaseModule,
            CoreControlModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDaDataModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreDadataSearchComponent,
                        CoreDadataFmsCodeComponent
                    ],
                    imports: [
                        CoreMatModule,
                        CoreBaseModule,
                        NgxMaskDirective,
                        NgxMaskPipe,
                        CoreControlModule,
                        CoreDirectiveModule
                    ],
                    providers: [
                        DadataIntegrationService,
                        provideNgxMask({
                            decimalMarker: ','
                        })
                    ],
                    exports: [
                        CoreDadataSearchComponent,
                        CoreDadataFmsCodeComponent
                    ]
                }]
        }] });

class VerificationService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    // верификация (запрос верификации)
    verificationAsk(data) {
        // post
        const url = this._startUp.apiRoot('channels/verification/ask', 'notification');
        return this._ajaxM.post({ url: url, data: data });
    }
    // сохранение и верификация контактных данных
    verificationVerifySave(verification) {
        // post
        const url = this._startUp.apiRoot('channels/verification/verify-save', 'notification');
        return this._ajaxM.post({ url: url, data: verification });
    }
    copySubscriptions(channelId) {
        const url = this._startUp.apiRoot('subscriptions/copy?channelTypeId=' + channelId, 'notification');
        return this._ajaxM.post({ url: url });
    }
    checkEmail(email) {
        const url = this._startUp.apiRoot('persons/email-check/' + email, 'core');
        return this._ajaxM.post({ url: url });
    }
    checkPhone(phone) {
        const url = this._startUp.apiRoot('persons/phone-check/' + phone, 'core');
        return this._ajaxM.post({ url: url });
    }
    unlinkChannel(channel) {
        const url = this._startUp.apiRoot('channels/verification/unlink?channel=' + channel, 'notification');
        return this._ajaxM.post({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: VerificationService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: VerificationService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: VerificationService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

// каналы верификации
var VerificationChannel;
(function (VerificationChannel) {
    VerificationChannel[VerificationChannel["Email"] = 1] = "Email";
    VerificationChannel[VerificationChannel["Sms"] = 2] = "Sms";
    VerificationChannel[VerificationChannel["Mobile"] = 4] = "Mobile";
    VerificationChannel[VerificationChannel["Telegram"] = 5] = "Telegram";
    VerificationChannel[VerificationChannel["Max"] = 6] = "Max";
})(VerificationChannel || (VerificationChannel = {}));
var VerificationFlow;
(function (VerificationFlow) {
    VerificationFlow[VerificationFlow["Inbound"] = 0] = "Inbound";
    VerificationFlow[VerificationFlow["Outbound"] = 1] = "Outbound";
})(VerificationFlow || (VerificationFlow = {}));

class CoreVerificationDialogWindow extends CoreBaseDestroyComponent {
    constructor(injector, dialogRef, data, _registrationService, _popupResult) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
        this._registrationService = _registrationService;
        this._popupResult = _popupResult;
        // время ожидания до запроса повторной отправки уведомления
        this.REPEAT_WAIT = 30;
        this.hasFooter = true;
        this.VerificationChannel = VerificationChannel;
        this.VerificationFlow = VerificationFlow;
        this.PhoneNumberFormatter = PhoneNumberFormatter;
        this.vm = injector.get(VisualSettingManager);
        this.dialogTitleValue = 'Подтверждение ';
        switch (this.data.channel) {
            case VerificationChannel.Email:
                this.dialogTitleValue += 'Email';
                this.verificationFlow = VerificationFlow.Outbound;
                break;
            case VerificationChannel.Mobile:
                this.dialogTitleValue += 'мобильного номера';
                this.verificationFlow = VerificationFlow.Inbound;
                this.hasFooter = false;
                break;
            case VerificationChannel.Telegram:
                this.dialogTitleValue += 'Telegram';
                this.verificationFlow = VerificationFlow.Outbound;
                this.hasFooter = false;
                break;
            case VerificationChannel.Max:
                this.dialogTitleValue += 'Max';
                this.verificationFlow = VerificationFlow.Outbound;
                this.hasFooter = false;
                break;
            default:
                break;
        }
        this.model = data;
        this.additionalData = {
            destination: data.destination,
        };
    }
    ngOnInit() {
        this.ask();
    }
    // повторная отправка кода верификации
    repeat() {
        this.ask();
    }
    // подтверждение кода верификации
    confirm() {
        this._registrationService
            .verificationVerifySave(this.model)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => (this._popupResult.HandleIEntityResponse({
            response: {
                ...response,
                message: response.message || 'Неверный код подтверждения'
            },
            successCallback: () => { this.dialogRef.close(this.model); }
        })));
    }
    ask() {
        this.waitRepeat = true;
        this._registrationService
            .verificationAsk(this.data)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popupResult.HandleIEntityResponse({
            response: response,
            successCallback: (data) => {
                this.model.challenge = data.challenge;
                this.additionalData.displayPhone = data.displayPhone;
                if (this.data.channel === VerificationChannel.Max) {
                    this.maxBotLink = `${this.vm.Setting.platform.linkMaxBot}?start=challenge:${this.model?.challenge}`;
                }
                // задаем время ожидания до следующей отправки
                this.waitCount = this.REPEAT_WAIT;
                const interval = setInterval(() => {
                    this.waitCount--;
                    if (this.waitCount < 0) {
                        clearInterval(interval);
                        this.waitRepeat = false;
                    }
                }, 1000);
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreVerificationDialogWindow, deps: [{ token: i0.Injector }, { token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: VerificationService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreVerificationDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog  [hasCansel]=\"false\" [dialogTitle]=\"dialogTitleValue\" [hasFooter]=\"hasFooter\" [width]=\"600\">\n  <div body>\n    <div class=\"sln-dialog-verification-row\">\n      <div class=\"sln-dialog-verification-row__column\">\n        <div>\n          @switch (data.channel) {\n            @case (VerificationChannel.Email) {\n              <div>\n                <span class=\"sln-common-info\">\u041D\u0430 {{ additionalData?.destination }} \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u043A\u043E\u0434 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F. \u0414\u043B\u044F \u0443\u0441\u043F\u0435\u0448\u043D\u043E\u0433\u043E \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043D\u044B\u0439 \u043A\u043E\u0434 \u0432 \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435.</span>\n              </div>\n            }\n            @case (VerificationChannel.Mobile) {\n              <div>\n                <span class=\"sln-common-info\">\u0414\u043B\u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u043E\u0433\u043E \u043D\u043E\u043C\u0435\u0440\u0430 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0432\u043E\u043D\u043E\u043A \u0441 \u043D\u043E\u043C\u0435\u0440\u0430\n                {{ PhoneNumberFormatter.formatRuPhoneNumber(additionalData?.destination) }} \u043D\u0430 \u0431\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440</span>\n                <a class=\"sln-dialog-verification-row__column__phoneLink\" href=\"tel:${additionalData?.displayPhone}\">{{ additionalData?.displayPhone }}</a>\n                <hr class=\"dotted\">\n                @if (this.data.showConfirmHint) {\n                  <small class=\"hint\">\n                    \u041F\u043E\u0441\u043B\u0435 \u0441\u043E\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0437\u0432\u043E\u043D\u043A\u0430 \u043D\u0430 \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043D\u0430\u0436\u0430\u0442\u044C \u043D\u0430 \u043A\u043D\u043E\u043F\u043A\u0443 \"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\"\n                  </small>\n                }\n              </div>\n            }\n            @case (VerificationChannel.Telegram) {\n              <div>\n                \u0414\u043B\u044F \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438 \u043A\u0430\u043D\u0430\u043B\u0430 \u0441\u0432\u044F\u0437\u0438 Telegram \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u043F\u043E\n                <a href=\"{{this.vm.Setting.platform.linkTelegramBot}}\" target=\"_blank\">\u0441\u0441\u044B\u043B\u043A\u0435</a> \u0438\n                \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0431\u043E\u0442\u0430 \u043F\u0440\u0438 \u043F\u043E\u043C\u043E\u0449\u0438 \u043A\u043E\u043C\u0430\u043D\u0434\u044B <p style=\"color:var(--PRIMARY); display:inline;\">/start</p>.\n                <p>\u041F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043A\u043E\u0434\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0435\u0433\u043E \u0432 \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435.</p>\n              </div>\n            }\n            @case (VerificationChannel.Max) {\n              <div>\n                \u0414\u043B\u044F \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438 \u043A\u0430\u043D\u0430\u043B\u0430 \u0441\u0432\u044F\u0437\u0438 Max \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u043F\u043E\n                <a href=\"{{this.maxBotLink}}\" target=\"_blank\">\u0441\u0441\u044B\u043B\u043A\u0435</a> \u0438 \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0431\u043E\u0442\u0430.\n                <p>\u041F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043A\u043E\u0434\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0435\u0433\u043E \u0432 \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435.</p>\n              </div>\n            }\n          }\n        </div>\n      </div>\n    </div>\n    <div>\n      @switch (verificationFlow) {\n        @case (VerificationFlow.Inbound) {\n          <div class=\"sln-dialog-verification-row\">\n            <div class=\"sln-dialog-verification-row__column sln-dialog-verification-row__button\">\n              <button type=\"button\" class=\"light-btn-primary sln-verification__button\" (click)=\"confirm()\">\n                \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\n              </button>\n            </div>\n          </div>\n        }\n        @case (VerificationFlow.Outbound) {\n          <div class=\"sln-dialog-verification-row\">\n            <div class=\"sln-dialog-verification-row__column\">\n              <form #verificationForm=\"ngForm\" novalidate>\n                <mat-form-field>\n                  <mat-label>\u041A\u043E\u0434 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F</mat-label>\n                  <input matInput [(ngModel)]=\"model.code\" name=\"code\" #code=\"ngModel\" (input)=\"model.code = $event.target.value.trim()\" required>\n                </mat-form-field>\n              </form>\n            </div>\n            <div class=\"sln-dialog-verification-body__column sln-dialog-verification-body__button\">\n              <button type=\"button\" class=\"light-btn-primary sln-verification__button\" (click)=\"confirm()\"\n                [disabled]=\"verificationForm.invalid\">\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\n              </button>\n            </div>\n          </div>\n        }\n      }\n    </div>\n    @if (!hasFooter) {\n      <div style=\"margin-bottom: 20px\"></div>\n    }\n  </div>\n  <div footer>\n    <div class=\"sln-dialog-verification-footer\">\n      <div class=\"sln-dialog-verification-footer__item\">\n        @if (waitRepeat) {\n          <p>\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437 {{ waitCount }} \u0441\u0435\u043A.</p>\n        }\n        @if (!waitRepeat) {\n          <a type=\"button\" (click)=\"repeat()\">\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E</a>\n        }\n      </div>\n      <div class=\"sln-dialog-verification-footer__item\">\n        <p class=\"sln-verification-change\"> \u0415\u0441\u043B\u0438 \u043F\u043E \u043A\u0430\u043A\u043E\u0439-\u0442\u043E \u043F\u0440\u0438\u0447\u0438\u043D\u0435 \u043A\u043E\u0434 \u043D\u0435 \u043F\u0440\u0438\u0445\u043E\u0434\u0438\u0442, \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 \"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434\n        \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E\".</p>\n      </div>\n    </div>\n  </div>\n</core-dialog>\n", styles: [".sln-dialog-verification>p{color:var(--DARK-GREY)}.sln-dialog-verification-row{display:flex;flex-direction:row;flex-wrap:wrap;width:100%;gap:8px}.sln-dialog-verification-row__column{display:flex;flex-direction:column;flex:1}.sln-dialog-verification-row__column p{text-align:justify;text-justify:inter-word}.sln-dialog-verification-row__column__phoneLink{display:flex;justify-content:center;flex-direction:column;text-align:center}.sln-dialog-verification-row__button button{width:100%}.sln-dialog-verification-footer{display:flex;gap:20px}.sln-dialog-verification-footer__item{flex:1}.sln-dialog-verification-footer__item:nth-child(2){text-align:right}.sln-dialog-verification-footer__item a{font-size:13px;line-height:120%;letter-spacing:.01em;border-bottom:1px solid;color:var(--ADD-COLOR-1);cursor:pointer;text-decoration:none}@media(max-width:600px){.sln-dialog-verification-footer{flex-direction:column}}.sln-dialog-verification-footer p{color:var(--DARK-GREY);font-size:12px}small.hint{line-height:.1em;letter-spacing:initial;font-size:.7em}hr.dotted{border-top:.1em dotted var(--DEFAULT)}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: 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: CoreVerificationDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog  [hasCansel]=\"false\" [dialogTitle]=\"dialogTitleValue\" [hasFooter]=\"hasFooter\" [width]=\"600\">\n  <div body>\n    <div class=\"sln-dialog-verification-row\">\n      <div class=\"sln-dialog-verification-row__column\">\n        <div>\n          @switch (data.channel) {\n            @case (VerificationChannel.Email) {\n              <div>\n                <span class=\"sln-common-info\">\u041D\u0430 {{ additionalData?.destination }} \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u043A\u043E\u0434 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F. \u0414\u043B\u044F \u0443\u0441\u043F\u0435\u0448\u043D\u043E\u0433\u043E \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043D\u044B\u0439 \u043A\u043E\u0434 \u0432 \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435.</span>\n              </div>\n            }\n            @case (VerificationChannel.Mobile) {\n              <div>\n                <span class=\"sln-common-info\">\u0414\u043B\u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u043E\u0433\u043E \u043D\u043E\u043C\u0435\u0440\u0430 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0432\u043E\u043D\u043E\u043A \u0441 \u043D\u043E\u043C\u0435\u0440\u0430\n                {{ PhoneNumberFormatter.formatRuPhoneNumber(additionalData?.destination) }} \u043D\u0430 \u0431\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440</span>\n                <a class=\"sln-dialog-verification-row__column__phoneLink\" href=\"tel:${additionalData?.displayPhone}\">{{ additionalData?.displayPhone }}</a>\n                <hr class=\"dotted\">\n                @if (this.data.showConfirmHint) {\n                  <small class=\"hint\">\n                    \u041F\u043E\u0441\u043B\u0435 \u0441\u043E\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u0437\u0432\u043E\u043D\u043A\u0430 \u043D\u0430 \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043D\u0430\u0436\u0430\u0442\u044C \u043D\u0430 \u043A\u043D\u043E\u043F\u043A\u0443 \"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\"\n                  </small>\n                }\n              </div>\n            }\n            @case (VerificationChannel.Telegram) {\n              <div>\n                \u0414\u043B\u044F \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438 \u043A\u0430\u043D\u0430\u043B\u0430 \u0441\u0432\u044F\u0437\u0438 Telegram \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u043F\u043E\n                <a href=\"{{this.vm.Setting.platform.linkTelegramBot}}\" target=\"_blank\">\u0441\u0441\u044B\u043B\u043A\u0435</a> \u0438\n                \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0431\u043E\u0442\u0430 \u043F\u0440\u0438 \u043F\u043E\u043C\u043E\u0449\u0438 \u043A\u043E\u043C\u0430\u043D\u0434\u044B <p style=\"color:var(--PRIMARY); display:inline;\">/start</p>.\n                <p>\u041F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043A\u043E\u0434\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0435\u0433\u043E \u0432 \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435.</p>\n              </div>\n            }\n            @case (VerificationChannel.Max) {\n              <div>\n                \u0414\u043B\u044F \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438 \u043A\u0430\u043D\u0430\u043B\u0430 \u0441\u0432\u044F\u0437\u0438 Max \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u043F\u043E\n                <a href=\"{{this.maxBotLink}}\" target=\"_blank\">\u0441\u0441\u044B\u043B\u043A\u0435</a> \u0438 \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0431\u043E\u0442\u0430.\n                <p>\u041F\u043E\u0441\u043B\u0435 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043A\u043E\u0434\u0430 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0435\u0433\u043E \u0432 \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435.</p>\n              </div>\n            }\n          }\n        </div>\n      </div>\n    </div>\n    <div>\n      @switch (verificationFlow) {\n        @case (VerificationFlow.Inbound) {\n          <div class=\"sln-dialog-verification-row\">\n            <div class=\"sln-dialog-verification-row__column sln-dialog-verification-row__button\">\n              <button type=\"button\" class=\"light-btn-primary sln-verification__button\" (click)=\"confirm()\">\n                \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\n              </button>\n            </div>\n          </div>\n        }\n        @case (VerificationFlow.Outbound) {\n          <div class=\"sln-dialog-verification-row\">\n            <div class=\"sln-dialog-verification-row__column\">\n              <form #verificationForm=\"ngForm\" novalidate>\n                <mat-form-field>\n                  <mat-label>\u041A\u043E\u0434 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F</mat-label>\n                  <input matInput [(ngModel)]=\"model.code\" name=\"code\" #code=\"ngModel\" (input)=\"model.code = $event.target.value.trim()\" required>\n                </mat-form-field>\n              </form>\n            </div>\n            <div class=\"sln-dialog-verification-body__column sln-dialog-verification-body__button\">\n              <button type=\"button\" class=\"light-btn-primary sln-verification__button\" (click)=\"confirm()\"\n                [disabled]=\"verificationForm.invalid\">\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\n              </button>\n            </div>\n          </div>\n        }\n      }\n    </div>\n    @if (!hasFooter) {\n      <div style=\"margin-bottom: 20px\"></div>\n    }\n  </div>\n  <div footer>\n    <div class=\"sln-dialog-verification-footer\">\n      <div class=\"sln-dialog-verification-footer__item\">\n        @if (waitRepeat) {\n          <p>\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437 {{ waitCount }} \u0441\u0435\u043A.</p>\n        }\n        @if (!waitRepeat) {\n          <a type=\"button\" (click)=\"repeat()\">\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E</a>\n        }\n      </div>\n      <div class=\"sln-dialog-verification-footer__item\">\n        <p class=\"sln-verification-change\"> \u0415\u0441\u043B\u0438 \u043F\u043E \u043A\u0430\u043A\u043E\u0439-\u0442\u043E \u043F\u0440\u0438\u0447\u0438\u043D\u0435 \u043A\u043E\u0434 \u043D\u0435 \u043F\u0440\u0438\u0445\u043E\u0434\u0438\u0442, \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 \"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434\n        \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E\".</p>\n      </div>\n    </div>\n  </div>\n</core-dialog>\n", styles: [".sln-dialog-verification>p{color:var(--DARK-GREY)}.sln-dialog-verification-row{display:flex;flex-direction:row;flex-wrap:wrap;width:100%;gap:8px}.sln-dialog-verification-row__column{display:flex;flex-direction:column;flex:1}.sln-dialog-verification-row__column p{text-align:justify;text-justify:inter-word}.sln-dialog-verification-row__column__phoneLink{display:flex;justify-content:center;flex-direction:column;text-align:center}.sln-dialog-verification-row__button button{width:100%}.sln-dialog-verification-footer{display:flex;gap:20px}.sln-dialog-verification-footer__item{flex:1}.sln-dialog-verification-footer__item:nth-child(2){text-align:right}.sln-dialog-verification-footer__item a{font-size:13px;line-height:120%;letter-spacing:.01em;border-bottom:1px solid;color:var(--ADD-COLOR-1);cursor:pointer;text-decoration:none}@media(max-width:600px){.sln-dialog-verification-footer{flex-direction:column}}.sln-dialog-verification-footer p{color:var(--DARK-GREY);font-size:12px}small.hint{line-height:.1em;letter-spacing:initial;font-size:.7em}hr.dotted{border-top:.1em dotted var(--DEFAULT)}\n"] }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: VerificationService }, { type: PopupResults }] });

class CoreAbstractVerificationComponent extends CoreAbstractAccessorComponent {
    constructor(_dialog, _verificationService, _popup) {
        super();
        this._dialog = _dialog;
        this._verificationService = _verificationService;
        this._popup = _popup;
        // статус того, что канал подтвержден
        this.isVerificated = false;
        // подтверждение произошло
        this.confirmed = new EventEmitter();
    }
    _confirm(channel, saveSuccessCallback) {
        if (Utility.isEmpty(this.value)) {
            const message = 'Вы не указали данные "' + this.placeholder + '" для верификации.';
            this._dialog.open(CoreInfoDialogWindow, { data: new InfoDiologConfig(InfoType.Danger, message) });
            return;
        }
        const data = { channel: channel, destination: this.value };
        CoreDialog.window(CoreVerificationDialogWindow, data, (result) => {
            this.isVerificated = true;
            this._control.nativeElement.setAttribute('isVerificated', this.isVerificated);
            this.confirmed.emit(this.isVerificated);
            if (saveSuccessCallback) {
                saveSuccessCallback(result);
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAbstractVerificationComponent, deps: [{ token: i1$8.MatDialog }, { token: VerificationService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreAbstractVerificationComponent, isStandalone: false, selector: "ng-component", outputs: { confirmed: "confirmed" }, viewQueries: [{ propertyName: "_control", first: true, predicate: ["control"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAbstractVerificationComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }, { type: VerificationService }, { type: PopupResults }], propDecorators: { _control: [{
                type: ViewChild,
                args: ['control', { read: ElementRef }]
            }], confirmed: [{
                type: Output
            }] } });

class CoreFieldEmailComponent extends CoreAbstractVerificationComponent {
    constructor(dialog, verificationService, popup) {
        super(dialog, verificationService, popup);
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'Электронная почта';
        }
        if (!this.settings) {
            this.settings = { maxLength: 250, isRequired: false, defaultText: '', needVerificate: false };
        }
        if (this.disabled) {
            this.settings.needVerificate = false;
        }
    }
    writeLogic(model) {
    }
    disabledLogic(isDisabled) {
    }
    formatValue(model) {
        return model;
    }
    confirmEmail() {
        this._confirm(VerificationChannel.Email);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldEmailComponent, deps: [{ token: i1$8.MatDialog }, { token: VerificationService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldEmailComponent, isStandalone: false, selector: "core-field-email", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldEmailComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <mat-form-field class=\"{{ cmpClass }}\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput email [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [verification]=\"settings.needVerificate\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\"\n      [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" maxlength=\"50\" />\n\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n      }\n      @if (!disabled && !settings.useMask && !settings.rightHintHide) {\n        <mat-hint align=\"end\">{{ control.value?.length || 0 }} / {{settings.maxLength || 50}}</mat-hint>\n      }\n\n      <div class=\"sln-informer-icongroup\">\n        @if (settings.useInformer) {\n          <div class=\"sln-informer\">\n            <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-question\"></div>\n            </div>\n          </div>\n        }\n        <div matTooltip=\"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"   class=\"sln-alert-position__tooltip\">\n          @if (settings.needVerificate) {\n            <button matSuffix type=\"button\" class=\"sln-alert-position__button\" (click)=\"confirmEmail()\" [disabled]=\"control.hasError('email') || control.hasError('required') || isVerificated\">\n              <div class=\"sln-common-main-ok\"></div>\n            </button>\n          }\n        </div>\n        <div class=\"sln-position-informer\">\n          @if (control.hasError('email')) {\n            <mat-error>\n              <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (control.hasError('verification')) {\n            <mat-error>\n              <div matTooltip=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n        </div>\n      </div>\n    </mat-form-field>\n  </div>", styles: [".sln-alert-position__button{background:var(--GRAY-SOFT);border:none;border-radius:50%;background:none;outline:none;cursor:pointer}.mat-form-field-hint-end{padding:0 2px 0 0}.mat-form-field-appearance-legacy .mat-form-field-wrapper{padding-right:15px!important}.mat-form-field-infix .sln-mistake-email .mat-form-field-subscript-wrapper{width:17px;top:15px!important;left:85%!important}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i4$1.EmailValidator, selector: "[email][formControlName],[email][formControl],[email][ngModel]", inputs: ["email"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: VerificationDirective, selector: "[verification]", inputs: ["verification"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldEmailComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-email', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldEmailComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm>\n  <mat-form-field class=\"{{ cmpClass }}\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput email [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [verification]=\"settings.needVerificate\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\"\n      [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" maxlength=\"50\" />\n\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n      }\n      @if (!disabled && !settings.useMask && !settings.rightHintHide) {\n        <mat-hint align=\"end\">{{ control.value?.length || 0 }} / {{settings.maxLength || 50}}</mat-hint>\n      }\n\n      <div class=\"sln-informer-icongroup\">\n        @if (settings.useInformer) {\n          <div class=\"sln-informer\">\n            <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-question\"></div>\n            </div>\n          </div>\n        }\n        <div matTooltip=\"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"   class=\"sln-alert-position__tooltip\">\n          @if (settings.needVerificate) {\n            <button matSuffix type=\"button\" class=\"sln-alert-position__button\" (click)=\"confirmEmail()\" [disabled]=\"control.hasError('email') || control.hasError('required') || isVerificated\">\n              <div class=\"sln-common-main-ok\"></div>\n            </button>\n          }\n        </div>\n        <div class=\"sln-position-informer\">\n          @if (control.hasError('email')) {\n            <mat-error>\n              <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (control.hasError('verification')) {\n            <mat-error>\n              <div matTooltip=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n        </div>\n      </div>\n    </mat-form-field>\n  </div>", styles: [".sln-alert-position__button{background:var(--GRAY-SOFT);border:none;border-radius:50%;background:none;outline:none;cursor:pointer}.mat-form-field-hint-end{padding:0 2px 0 0}.mat-form-field-appearance-legacy .mat-form-field-wrapper{padding-right:15px!important}.mat-form-field-infix .sln-mistake-email .mat-form-field-subscript-wrapper{width:17px;top:15px!important;left:85%!important}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }, { type: VerificationService }, { type: PopupResults }] });

class CoreFieldPhoneComponent extends CoreAbstractVerificationComponent {
    constructor(dialog, verificationService, popup, _cd) {
        super(dialog, verificationService, popup);
        this._cd = _cd;
        this.isPasteChange = false;
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'Телефон';
        }
        if (!this.settings) {
            this.settings = { maxLength: 250, isRequired: false, defaultText: '', needVerificate: false };
        }
        if (this.disabled) {
            this.settings.needVerificate = false;
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        return model;
    }
    confirmPhone() {
        this._confirm(VerificationChannel.Mobile);
    }
    onValueChange(model) {
        if (!this.isPasteChange) {
            super.onValueChange(model);
            return;
        }
        this.handlePasteString(this.value);
        this.isPasteChange = false;
    }
    onPaste(event) {
        let clipboardData = event.clipboardData;
        let pastedText = clipboardData.getData('text');
        this.handlePasteString(pastedText);
        this._cd.detectChanges();
    }
    handlePasteString(str) {
        const checkExp = /^(\+7|7|8)/;
        if (checkExp.test(str)) {
            this.value = str.substring(str.match(checkExp)[0].length, str.length);
            this.isPasteChange = true;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldPhoneComponent, deps: [{ token: i1$8.MatDialog }, { token: VerificationService }, { token: PopupResults }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldPhoneComponent, isStandalone: false, selector: "core-field-phone", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldPhoneComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" (paste)=\"onPaste($event)\" [required]=\"settings.isRequired\" [verification]=\"settings.needVerificate\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\"\n    [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" prefix=\"+7 \" mask=\"000 000 00 00\" />\n\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div matTooltip=\"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0442\u0435\u043B\u0435\u0444\u043E\u043D\" matTooltipPosition=\"above\"   class=\"sln-alert-position__tooltip\">\n        @if (settings.needVerificate) {\n          <button matSuffix type=\"button\" class=\"sln-alert-position__button\" (click)=\"confirmPhone()\" [disabled]=\"control.hasError('mask') || control.hasError('required') || isVerificated\">\n            <div class=\"sln-common-main-ok\" alt=\"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\"></div>\n          </button>\n        }\n      </div>\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('mask')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (control.hasError('verification')) {\n          <mat-error>\n            <div matTooltip=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"   class=\"sln-control-mistake__tooltip\">\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n\n\n    @if (settings.leftHint?.length > 0) {\n      <mat-hint>{{ settings.leftHint }}</mat-hint>\n    }\n\n  </mat-form-field>\n", styles: [".sln-alert-position__button{background:var(--GRAY-SOFT);border:none;border-radius:50%;background:none;outline:none;cursor:pointer}.mat-form-field-hint-end{padding:0 2px 0 0}.mat-form-field-appearance-legacy .mat-form-field-wrapper{padding-right:15px!important}.mat-form-field-infix .sln-mistake-email .mat-form-field-subscript-wrapper{width:17px;top:15px!important;left:85%!important}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: VerificationDirective, selector: "[verification]", inputs: ["verification"] }, { kind: "directive", type: i6.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldPhoneComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-phone', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldPhoneComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<mat-form-field provideParentForm>\n  <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n  <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\" (paste)=\"onPaste($event)\" [required]=\"settings.isRequired\" [verification]=\"settings.needVerificate\" [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\"\n    [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" prefix=\"+7 \" mask=\"000 000 00 00\" />\n\n    <div class=\"sln-informer-icongroup\">\n      @if (settings.useInformer) {\n        <div class=\"sln-informer\">\n          <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n            <div class=\"sln-control-question\"></div>\n          </div>\n        </div>\n      }\n      <div matTooltip=\"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0442\u0435\u043B\u0435\u0444\u043E\u043D\" matTooltipPosition=\"above\"   class=\"sln-alert-position__tooltip\">\n        @if (settings.needVerificate) {\n          <button matSuffix type=\"button\" class=\"sln-alert-position__button\" (click)=\"confirmPhone()\" [disabled]=\"control.hasError('mask') || control.hasError('required') || isVerificated\">\n            <div class=\"sln-common-main-ok\" alt=\"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\"></div>\n          </button>\n        }\n      </div>\n      <div class=\"sln-position-informer\">\n        @if (control.hasError('mask')) {\n          <mat-error matSuffix>\n            <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n        @if (control.hasError('verification')) {\n          <mat-error>\n            <div matTooltip=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"   class=\"sln-control-mistake__tooltip\">\n              <div class=\"sln-control-mistake\"></div>\n            </div>\n          </mat-error>\n        }\n      </div>\n    </div>\n\n\n    @if (settings.leftHint?.length > 0) {\n      <mat-hint>{{ settings.leftHint }}</mat-hint>\n    }\n\n  </mat-form-field>\n", styles: [".sln-alert-position__button{background:var(--GRAY-SOFT);border:none;border-radius:50%;background:none;outline:none;cursor:pointer}.mat-form-field-hint-end{padding:0 2px 0 0}.mat-form-field-appearance-legacy .mat-form-field-wrapper{padding-right:15px!important}.mat-form-field-infix .sln-mistake-email .mat-form-field-subscript-wrapper{width:17px;top:15px!important;left:85%!important}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }, { type: VerificationService }, { type: PopupResults }, { type: i0.ChangeDetectorRef }] });

class CoreFieldTelegramComponent extends CoreAbstractVerificationComponent {
    constructor(dialog, verificationService, popup) {
        super(dialog, verificationService, popup);
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = 'Логин Telegram';
        }
        if (!this.settings) {
            this.settings = {
                isRequired: false
            };
        }
        if (this.disabled) {
            this.settings.needVerificate = false;
        }
        this.settings.useMask = false;
        // this.settings.maskExpression = '@A*{0,30}';
        this.settings.maxLength = 33;
    }
    writeLogic(model) {
        // Применяем валидацию и форматирование в реальном времени
        if (model && typeof model === 'string') {
            const formattedValue = this.formatValue(model);
            if (formattedValue !== model) {
                // Обновляем значение если оно изменилось после валидации
                setTimeout(() => {
                    this.value = formattedValue;
                }, 0);
            }
        }
    }
    disabledLogic(isDisabled) {
    }
    formatValue(model) {
        if (model && typeof model === 'string') {
            // Убираем все символы кроме букв, цифр, @ и _
            let cleanValue = model.replace(/[^a-zA-Z0-9@_]/g, '');
            // Обеспечиваем что @ только в начале
            if (cleanValue.includes('@')) {
                const parts = cleanValue.split('@');
                cleanValue = '@' + parts.join(''); // @ только в начале, остальные @ убираем
            }
            // Автоматически добавляем @ в начало если его нет
            if (!cleanValue.startsWith('@')) {
                cleanValue = '@' + cleanValue;
            }
            // Проверяем что после @ идет буква (если есть символы после @)
            if (cleanValue.length > 1) {
                const firstCharAfterAt = cleanValue[1];
                if (!/[a-zA-Z]/.test(firstCharAfterAt)) {
                    // Если первый символ после @ не буква, убираем его
                    cleanValue = '@' + cleanValue.substring(2);
                }
            }
            // Ограничиваем длину (максимум 32 символа после @)
            if (cleanValue.length > 33) {
                cleanValue = cleanValue.substring(0, 33);
            }
            return cleanValue;
        }
        return model;
    }
    confirmTelegram() {
        this._confirm(VerificationChannel.Telegram, () => {
            this._saveVerification();
        });
    }
    _saveVerification() {
        CoreDialog.confirm(() => {
            this._verificationService.copySubscriptions(VerificationChannel.Telegram)
                .subscribe((resp) => this._popup.HandleIResponse({
                response: resp,
                msg: "Подписки скопированы",
                successCallback: () => window.location.reload()
            }));
        }, () => window.location.reload(), {
            button: 'Да',
            cancel: 'Нет',
            message: 'Подписаться на события для канала связи "Telegram" (текущие подписки будут скопированы)?'
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTelegramComponent, deps: [{ token: i1$8.MatDialog }, { token: VerificationService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldTelegramComponent, isStandalone: false, selector: "core-field-telegram", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldTelegramComponent),
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <mat-form-field class=\"{{ cmpClass }}\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\"\n      [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [verification]=\"settings.needVerificate\"\n      [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\"\n      [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" maxlength=\"{{ settings.maxLength }}\"/>\n\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n      }\n      @if (!disabled && !settings.rightHintHide) {\n        <mat-hint align=\"end\">{{ control.value?.length || 0 }}\n          / {{ settings.useMask ? settings.maxLength - 1 : settings.maxLength || 50 }}\n        </mat-hint>\n      }\n      <div class=\"sln-informer-icongroup\">\n        <div matTooltip=\"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"   class=\"sln-alert-position__tooltip\">\n          @if (settings.needVerificate) {\n            <button matSuffix type=\"button\" class=\"sln-alert-position__button\"\n              (click)=\"confirmTelegram()\"\n              [disabled]=\"control.hasError('telegram') || control.hasError('required') || isVerificated\">\n              <div class=\"sln-common-main-ok\"></div>\n            </button>\n          }\n        </div>\n        @if (settings.useInformer) {\n          <div class=\"sln-informer\">\n            <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-question\"></div>\n            </div>\n          </div>\n        }\n        <div class=\"sln-position-informer\">\n          @if (control.hasError('telegram')) {\n            <mat-error>\n              <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (control.hasError('verification')) {\n            <mat-error>\n              <div matTooltip=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n        </div>\n      </div>\n    </mat-form-field>\n  </div>\n", styles: [".sln-alert-position__button{background:var(--GRAY-SOFT);border:none;border-radius:50%;background:none;outline:none;cursor:pointer}.mat-form-field-hint-end{padding:0 2px 0 0}.mat-form-field-appearance-legacy .mat-form-field-wrapper{padding-right:15px!important}.mat-form-field-infix .sln-mistake-email .mat-form-field-subscript-wrapper{width:17px;top:15px!important;left:85%!important}\n"], dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: VerificationDirective, selector: "[verification]", inputs: ["verification"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldTelegramComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-telegram', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldTelegramComponent),
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm>\n  <mat-form-field class=\"{{ cmpClass }}\">\n    <mat-label class=\"{{ labelClass }}\">{{ placeholder }}</mat-label>\n    <input matInput [(ngModel)]=\"value\" #control=\"ngModel\" (ngModelChange)=\"onValueChange($event)\"\n      [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [verification]=\"settings.needVerificate\"\n      [readonly]=\"settings.isReadonly ? settings.isReadonly : null\" [disabled]=\"disabled\"\n      [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" maxlength=\"{{ settings.maxLength }}\"/>\n\n      @if (settings.leftHint?.length > 0) {\n        <mat-hint class=\"sln-left-hint\">{{ settings.leftHint }}</mat-hint>\n      }\n      @if (!disabled && !settings.rightHintHide) {\n        <mat-hint align=\"end\">{{ control.value?.length || 0 }}\n          / {{ settings.useMask ? settings.maxLength - 1 : settings.maxLength || 50 }}\n        </mat-hint>\n      }\n      <div class=\"sln-informer-icongroup\">\n        <div matTooltip=\"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"   class=\"sln-alert-position__tooltip\">\n          @if (settings.needVerificate) {\n            <button matSuffix type=\"button\" class=\"sln-alert-position__button\"\n              (click)=\"confirmTelegram()\"\n              [disabled]=\"control.hasError('telegram') || control.hasError('required') || isVerificated\">\n              <div class=\"sln-common-main-ok\"></div>\n            </button>\n          }\n        </div>\n        @if (settings.useInformer) {\n          <div class=\"sln-informer\">\n            <div matSuffix matTooltip=\"{{ settings.informerText }}\" matTooltipPosition=\"above\"  >\n              <div class=\"sln-control-question\"></div>\n            </div>\n          </div>\n        }\n        <div class=\"sln-position-informer\">\n          @if (control.hasError('telegram')) {\n            <mat-error>\n              <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n          @if (control.hasError('verification')) {\n            <mat-error>\n              <div matTooltip=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <div class=\"sln-control-mistake\"></div>\n              </div>\n            </mat-error>\n          }\n        </div>\n      </div>\n    </mat-form-field>\n  </div>\n", styles: [".sln-alert-position__button{background:var(--GRAY-SOFT);border:none;border-radius:50%;background:none;outline:none;cursor:pointer}.mat-form-field-hint-end{padding:0 2px 0 0}.mat-form-field-appearance-legacy .mat-form-field-wrapper{padding-right:15px!important}.mat-form-field-infix .sln-mistake-email .mat-form-field-subscript-wrapper{width:17px;top:15px!important;left:85%!important}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }, { type: VerificationService }, { type: PopupResults }] });

class CoreContactVerificationModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreContactVerificationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreContactVerificationModule, declarations: [CoreFieldEmailComponent,
            CoreFieldPhoneComponent,
            CoreFieldTelegramComponent,
            CoreVerificationDialogWindow], imports: [CoreMatModule,
            CoreBaseModule,
            CoreControlModule,
            CoreDialogModule,
            CoreDirectiveModule,
            NgxMaskDirective,
            NgxMaskPipe], exports: [CoreFieldEmailComponent,
            CoreFieldPhoneComponent,
            CoreFieldTelegramComponent,
            CoreVerificationDialogWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreContactVerificationModule, providers: [
            VerificationService,
            TwoFactorService,
            provideNgxMask({
                decimalMarker: ','
            })
        ], imports: [CoreMatModule,
            CoreBaseModule,
            CoreControlModule,
            CoreDialogModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreContactVerificationModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreFieldEmailComponent,
                        CoreFieldPhoneComponent,
                        CoreFieldTelegramComponent,
                        CoreVerificationDialogWindow,
                    ],
                    imports: [
                        CoreMatModule,
                        CoreBaseModule,
                        CoreControlModule,
                        CoreDialogModule,
                        CoreDirectiveModule,
                        NgxMaskDirective,
                        NgxMaskPipe
                    ],
                    providers: [
                        VerificationService,
                        TwoFactorService,
                        provideNgxMask({
                            decimalMarker: ','
                        })
                    ],
                    exports: [
                        CoreFieldEmailComponent,
                        CoreFieldPhoneComponent,
                        CoreFieldTelegramComponent,
                        CoreVerificationDialogWindow,
                    ]
                }]
        }] });

class OrganizationItemTypes {
}
class OrganizationItemExtension {
}
class OrganizationItem {
    constructor() {
        this.id = 0;
        this.enabled = true;
        this.extension = new OrganizationItemExtension();
        this.organizationTypes = new OrganizationItemTypes();
    }
}

class OrganizationSearchResult {
}

class OrganizationBaseService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    // поиск организации для регистрации по ИНН
    searchOrganization(inn) {
        // get
        const url = this._startUp.apiRoot('organizations/search=', 'core') + inn;
        return this._ajaxM.get({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: OrganizationBaseService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: OrganizationBaseService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: OrganizationBaseService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class CoreOrganizationSearchComponent extends CoreBaseDestroyComponent {
    get useDadata() {
        return !Utility.isEmpty(this._startUp.getByKey('DADATA_API_TOKEN'));
    }
    constructor(_organizationService, _popupResult, _dialog, _startUp) {
        super();
        this._organizationService = _organizationService;
        this._popupResult = _popupResult;
        this._dialog = _dialog;
        this._startUp = _startUp;
        this.config = { type: DadataType.party };
        this.searchClick = new EventEmitter();
        this.clearClick = new EventEmitter();
    }
    clearSearch() {
        this.searchInn = '';
        if (this.searchControl) {
            this.searchControl.cleanForm;
        }
        this.clearClick.emit();
    }
    ngOnInit() {
        if (!this.placeholder) {
            this.placeholder = "Введите ИНН " + (this.useDadata ? 'или название компании' : '');
        }
    }
    searchByInn() {
        const inn = (this.searchInn + '').trim();
        if (!(inn.length === 10 || inn.length === 12)) {
            const message = 'Поиск доступен только по ИНН. Необходимо указать корректный ИНН. '
                + 'Для юридического лица длина ИНН равна 10 символам. '
                + 'Для ИП длина ИНН равна 12 символам.';
            this._dialog.open(CoreInfoDialogWindow, {
                data: new InfoDiologConfig(InfoType.Danger, message)
            });
            return;
        }
        this._organizationService.searchOrganization(inn)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popupResult.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                const model = new OrganizationSearchResult();
                if (!Utility.isEmpty(entity)) {
                    model.organizationId = entity.organizationId;
                    model.organizationName = entity.organizationName;
                    model.organizationShortName = entity.organizationShortName;
                    model.inn = entity.inn;
                    model.kpp = entity.kpp;
                    model.ogrn = entity.ogrn;
                    if (!Utility.isEmpty(entity.okopf) && entity.okopf.id !== 0) {
                        model.okopf = entity.okopf;
                    }
                }
                this.searchClick.emit(model);
            }
        }));
    }
    onSelected(event) {
        if (!event || !event.data) {
            this.clearClick.emit();
            return;
        }
        const data = event.data;
        if (data) {
            const model = new OrganizationSearchResult();
            model.organizationId = 0;
            model.organizationName = data.name.full_with_opf;
            model.organizationShortName = data.name.short_with_opf;
            model.inn = data.inn;
            model.kpp = data.kpp;
            model.ogrn = data.ogrn;
            model.okopf = { id: data.opf.code, text: '', description: null };
            this.searchClick.emit(model);
        }
        else {
            this.clearClick.emit();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationSearchComponent, deps: [{ token: OrganizationBaseService }, { token: PopupResults }, { token: i1$8.MatDialog }, { token: Startup }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreOrganizationSearchComponent, isStandalone: false, selector: "core-organization-search", inputs: { placeholder: "placeholder", classes: "classes" }, outputs: { searchClick: "searchClick", clearClick: "clearClick" }, viewQueries: [{ propertyName: "searchControl", first: true, predicate: CoreDadataSearchComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"row\">\n  <div class=\"form-group\">\n    <core-dadata-search [(ngModel)]=\"searchInn\" [config]=\"config\" [placeholder]=\"placeholder\" (selected)=\"onSelected($event)\"\n    class=\"{{ classes }}\"></core-dadata-search>\n  </div>\n  @if (useDadata === false) {\n    <div class=\"col-md-2 sln-padding-left\" style=\"text-align: end;\">\n      <button matTooltip=\"\u041F\u043E\u0438\u0441\u043A \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u043F\u043E \u0418\u041D\u041D \u0438\u043B\u0438 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044E\" class=\"btn-primary\" (click)=\"searchByInn()\" style=\"margin-top: 10px\">\n      &nbsp;\u041F\u043E\u0438\u0441\u043A</button>\n    </div>\n  }\n</div>\n", styles: [".col-md-2 button{height:45px;width:79px;color:var(--WHITE);background:var(--PRIMARY);font-size:13px;font-family:var(--font-bold);letter-spacing:.03em;margin-top:0!important}.col-md-2 button:active{outline:none;border:none;box-shadow:none}.col-md-2 button:focus{outline:none;border:none;box-shadow:none}.row{padding-right:1px}\n"], dependencies: [{ kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreDadataSearchComponent, selector: "core-dadata-search", inputs: ["config", "disabled", "type", "limit", "placeholder", "locations", "address"], outputs: ["configChanged", "selectedSuggestion", "selected"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationSearchComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-organization-search', standalone: false, template: "<div class=\"row\">\n  <div class=\"form-group\">\n    <core-dadata-search [(ngModel)]=\"searchInn\" [config]=\"config\" [placeholder]=\"placeholder\" (selected)=\"onSelected($event)\"\n    class=\"{{ classes }}\"></core-dadata-search>\n  </div>\n  @if (useDadata === false) {\n    <div class=\"col-md-2 sln-padding-left\" style=\"text-align: end;\">\n      <button matTooltip=\"\u041F\u043E\u0438\u0441\u043A \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u043F\u043E \u0418\u041D\u041D \u0438\u043B\u0438 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044E\" class=\"btn-primary\" (click)=\"searchByInn()\" style=\"margin-top: 10px\">\n      &nbsp;\u041F\u043E\u0438\u0441\u043A</button>\n    </div>\n  }\n</div>\n", styles: [".col-md-2 button{height:45px;width:79px;color:var(--WHITE);background:var(--PRIMARY);font-size:13px;font-family:var(--font-bold);letter-spacing:.03em;margin-top:0!important}.col-md-2 button:active{outline:none;border:none;box-shadow:none}.col-md-2 button:focus{outline:none;border:none;box-shadow:none}.row{padding-right:1px}\n"] }]
        }], ctorParameters: () => [{ type: OrganizationBaseService }, { type: PopupResults }, { type: i1$8.MatDialog }, { type: Startup }], propDecorators: { placeholder: [{
                type: Input
            }], classes: [{
                type: Input
            }], searchClick: [{
                type: Output
            }], clearClick: [{
                type: Output
            }], searchControl: [{
                type: ViewChild,
                args: [CoreDadataSearchComponent]
            }] } });

class IOrgnizationDialogOptions {
}
class CoreOrganizationDialogWindow extends CoreAbstractComponent {
    get isEmptyValue() {
        return Utility.isEmpty(this.data.item) || Utility.isEmpty(this.data.item.inn);
    }
    get isDisabled() {
        return this.data.readonlyMode || this.isEmptyValue === false;
    }
    get isIp() {
        return this.data.item.inn.length === 12;
    }
    constructor(dialogRef, data) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
        this.setting = { isRequired: true };
    }
    onSearchClick(data) {
        if (data) {
            this.data.item.id = data.organizationId;
            this.data.item.organizationName = data.organizationName;
            this.data.item.organizationShortName = data.organizationShortName;
            this.data.item.inn = data.inn;
            this.data.item.kpp = data.kpp;
            this.data.item.ogrn = data.ogrn;
            this.data.item.okopf = data.okopf;
        }
    }
    save() {
        const row = this.data.item;
        this.dialogRef.close(row);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreOrganizationDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438\"  width=\"700\">\n  <div body style=\"padding: 0 2px 5px 0;\">\n    <form #newForm=\"ngForm\" novalidate>\n      @if (data.readonlyMode === false) {\n        <div>\n          <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">\n              <core-organization-search (searchClick)=\"onSearchClick($event)\"></core-organization-search>\n            </div>\n          </div>\n        </div>\n      }\n      @if (isEmptyValue === false) {\n        <div>\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [(ngModel)]=\"data.item.organizationName\" name=\"organizationName\" fieldName=\"organizationName\" placeholder=\"\u041F\u043E\u043B\u043D\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435\" [settings]=\"{ isRequired: true, maxLength: 400 }\" [disabled]=\"isDisabled && data.item.organizationName\"></core-field-string>\n              </div>\n            </div>\n          </div>\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [(ngModel)]=\"data.item.organizationShortName\" name=\"organizationShortName\" fieldName=\"organizationShortName\" placeholder=\"\u041A\u0440\u0430\u0442\u043A\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435\" [settings]=\"{ isRequired: true, maxLength: 200 }\" [disabled]=\"isDisabled && data.item.organizationShortName\"></core-field-string>\n              </div>\n            </div>\n          </div>\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-combobox [(ngModel)]=\"data.item.okopf\" name=\"okopf\" fieldName=\"okopf\" placeholder=\"\u041E\u041A\u041E\u041F\u0424\" [settings]=\"{ sourceCode:'Okopfs', isRequired: true }\" [disabled]=\"isDisabled && data.item.okopf\" class=\"sln-core-field-combobox\"></core-field-combobox>\n              </div>\n            </div>\n          </div>\n          <div class=\"row\">\n            <div class=\"col-md-{{ isIp ? '6' : '4'}} sln-padding-left sln-padding-right\" >\n              <div class=\"form-group\">\n                <core-field-ogrn [(ngModel)]=\"data.item.ogrn\" name=\"ogrn\" fieldName=\"ogrn\" [settings]=\"setting\" [disabled]=\"isDisabled && data.item.ogrn\"></core-field-ogrn>\n              </div>\n            </div>\n            <div class=\"col-md-{{ isIp ? '6' : '4'}}\">\n              <div class=\"form-group\">\n                <core-field-inn [(ngModel)]=\"data.item.inn\" name=\"inn\" fieldName=\"inn\" [settings]=\"setting\" [disabled]=\"isDisabled && data.item.inn\"></core-field-inn>\n              </div>\n            </div>\n            @if (!isIp) {\n              <div class=\"col-md-4 sln-padding-left sln-padding-right\">\n                <div class=\"form-group\">\n                  <core-field-kpp [(ngModel)]=\"data.item.kpp\" name=\"kpp\" [fieldName]=\"'kpp'\" [settings]=\"setting\" [disabled]=\"isDisabled && data.item.kpp\"></core-field-kpp>\n                </div>\n              </div>\n            }\n          </div>\n          <div class=\"row\">\n            <div class=\"col-md-6 sln-padding-left\">\n              <div class=\"form-group\">\n                <core-field-phone [(ngModel)]=\"data.item.phone\" name=\"phone\" fieldName=\"phone\" placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430\" [disabled]=\"data.readonlyMode\"></core-field-phone>\n              </div>\n            </div>\n            <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <mat-form-field>\n                  <mat-label class=\"sln-default-label\">\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430</mat-label>\n                  <input matInput [(ngModel)]=\"data.item.email\" name=\"email\" #email=\"ngModel\" placeholder=\"\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430\" maxlength=\"120\" email [disabled]=\"data.readonlyMode\" />\n                  <mat-hint [hidden]=\"data.readonlyMode\" align=\"end\">{{ email.value === undefined ? 0 : email.value?.length}} / 120</mat-hint>\n                  @if (email.hasError('email')) {\n                    <mat-error>\n                      <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n                        <div class=\"sln-control-mistake\"></div>\n                      </div>\n                    </mat-error>\n                  }\n                </mat-form-field>\n              </div>\n            </div>\n          </div>\n        </div>\n      }\n    </form>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newForm.invalid || isEmptyValue\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i4$1.EmailValidator, selector: "[email][formControlName],[email][formControl],[email][ngModel]", inputs: ["email"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldInnComponent, selector: "core-field-inn" }, { kind: "component", type: CoreFieldKppComponent, selector: "core-field-kpp" }, { kind: "component", type: CoreFieldOgrnComponent, selector: "core-field-ogrn" }, { kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: CoreFieldPhoneComponent, selector: "core-field-phone" }, { kind: "component", type: CoreOrganizationSearchComponent, selector: "core-organization-search", inputs: ["placeholder", "classes"], outputs: ["searchClick", "clearClick"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438\"  width=\"700\">\n  <div body style=\"padding: 0 2px 5px 0;\">\n    <form #newForm=\"ngForm\" novalidate>\n      @if (data.readonlyMode === false) {\n        <div>\n          <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">\n              <core-organization-search (searchClick)=\"onSearchClick($event)\"></core-organization-search>\n            </div>\n          </div>\n        </div>\n      }\n      @if (isEmptyValue === false) {\n        <div>\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [(ngModel)]=\"data.item.organizationName\" name=\"organizationName\" fieldName=\"organizationName\" placeholder=\"\u041F\u043E\u043B\u043D\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435\" [settings]=\"{ isRequired: true, maxLength: 400 }\" [disabled]=\"isDisabled && data.item.organizationName\"></core-field-string>\n              </div>\n            </div>\n          </div>\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [(ngModel)]=\"data.item.organizationShortName\" name=\"organizationShortName\" fieldName=\"organizationShortName\" placeholder=\"\u041A\u0440\u0430\u0442\u043A\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435\" [settings]=\"{ isRequired: true, maxLength: 200 }\" [disabled]=\"isDisabled && data.item.organizationShortName\"></core-field-string>\n              </div>\n            </div>\n          </div>\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-combobox [(ngModel)]=\"data.item.okopf\" name=\"okopf\" fieldName=\"okopf\" placeholder=\"\u041E\u041A\u041E\u041F\u0424\" [settings]=\"{ sourceCode:'Okopfs', isRequired: true }\" [disabled]=\"isDisabled && data.item.okopf\" class=\"sln-core-field-combobox\"></core-field-combobox>\n              </div>\n            </div>\n          </div>\n          <div class=\"row\">\n            <div class=\"col-md-{{ isIp ? '6' : '4'}} sln-padding-left sln-padding-right\" >\n              <div class=\"form-group\">\n                <core-field-ogrn [(ngModel)]=\"data.item.ogrn\" name=\"ogrn\" fieldName=\"ogrn\" [settings]=\"setting\" [disabled]=\"isDisabled && data.item.ogrn\"></core-field-ogrn>\n              </div>\n            </div>\n            <div class=\"col-md-{{ isIp ? '6' : '4'}}\">\n              <div class=\"form-group\">\n                <core-field-inn [(ngModel)]=\"data.item.inn\" name=\"inn\" fieldName=\"inn\" [settings]=\"setting\" [disabled]=\"isDisabled && data.item.inn\"></core-field-inn>\n              </div>\n            </div>\n            @if (!isIp) {\n              <div class=\"col-md-4 sln-padding-left sln-padding-right\">\n                <div class=\"form-group\">\n                  <core-field-kpp [(ngModel)]=\"data.item.kpp\" name=\"kpp\" [fieldName]=\"'kpp'\" [settings]=\"setting\" [disabled]=\"isDisabled && data.item.kpp\"></core-field-kpp>\n                </div>\n              </div>\n            }\n          </div>\n          <div class=\"row\">\n            <div class=\"col-md-6 sln-padding-left\">\n              <div class=\"form-group\">\n                <core-field-phone [(ngModel)]=\"data.item.phone\" name=\"phone\" fieldName=\"phone\" placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430\" [disabled]=\"data.readonlyMode\"></core-field-phone>\n              </div>\n            </div>\n            <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <mat-form-field>\n                  <mat-label class=\"sln-default-label\">\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430</mat-label>\n                  <input matInput [(ngModel)]=\"data.item.email\" name=\"email\" #email=\"ngModel\" placeholder=\"\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430\" maxlength=\"120\" email [disabled]=\"data.readonlyMode\" />\n                  <mat-hint [hidden]=\"data.readonlyMode\" align=\"end\">{{ email.value === undefined ? 0 : email.value?.length}} / 120</mat-hint>\n                  @if (email.hasError('email')) {\n                    <mat-error>\n                      <div matTooltip=\"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442\" matTooltipPosition=\"above\"  >\n                        <div class=\"sln-control-mistake\"></div>\n                      </div>\n                    </mat-error>\n                  }\n                </mat-form-field>\n              </div>\n            </div>\n          </div>\n        </div>\n      }\n    </form>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newForm.invalid || isEmptyValue\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: IOrgnizationDialogOptions, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class CoreFieldOrganizationComponent extends CoreAbstractAccessorComponent {
    get isImageEmpty() {
        return Utility.isEmpty(this.value);
    }
    constructor(_dialog) {
        super();
        this._dialog = _dialog;
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return null;
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    setDefault() {
        super.setDefault();
    }
    editValue() {
        const dialogRef = this._dialog.open(CoreOrganizationDialogWindow, {
            data: { item: this.value ? this.value : new OrganizationItem(), readonlyMode: this.disabled ?? false }
        });
        const sub = dialogRef.afterClosed().subscribe((result) => {
            if (result && result.state !== DialogReason.cancel) {
                if (result !== this.value) {
                    this.onValueChange(result);
                }
                this.valueChange.emit(this.value);
            }
            sub.unsubscribe();
        });
    }
    // implements Validator
    validate(control) {
        if (this.settings?.isRequired) {
            if (control.value === null || control.value === undefined) {
                return { 'required': true };
            }
        }
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldOrganizationComponent, deps: [{ token: i1$8.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldOrganizationComponent, isStandalone: false, selector: "core-field-organization", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldOrganizationComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFieldOrganizationComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"complex-field sln-invalid-rule-row\" >\n    <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n      <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n      @if (value?.organizationShortName || value?.organizationName) {\n        <h2>\n          <span copyClipboard class=\"sln-complex-field-organizationShortName sln-complex-field-copy\">{{ value?.organizationShortName ?? value?.organizationName }} </span>\n          <span copyClipboard class=\"sln-complex-field-inn sln-complex-field-copy\">\u0418\u041D\u041D:{{ value?.inn }}</span><span copyClipboard class=\"sln-complex-field-ogrn sln-complex-field-copy\">\u041E\u0413\u0420\u041D:{{ value?.ogrn }}</span>\n        </h2>\n      }\n    </div>\n    <button (click)=\"editValue()\" style=\"min-width: 20px;\">\n      @if (!disabled) {\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\">\n          @if (isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @else {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n      }\n      @if (disabled) { \n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\">\n          <div class=\"sln-control-eye\"></div>\n        </div>\n      }\n    </button>\n  </div>\n  <mat-form-field style=\"display: none;\">\n    <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n  </mat-form-field>\n</div>\n", dependencies: [{ kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: CopyClipboardDirective, selector: "[copyClipboard]", inputs: ["tooltip", "delay"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldOrganizationComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-organization', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldOrganizationComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFieldOrganizationComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm>\n  <div class=\"complex-field sln-invalid-rule-row\" >\n    <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n      <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n      @if (value?.organizationShortName || value?.organizationName) {\n        <h2>\n          <span copyClipboard class=\"sln-complex-field-organizationShortName sln-complex-field-copy\">{{ value?.organizationShortName ?? value?.organizationName }} </span>\n          <span copyClipboard class=\"sln-complex-field-inn sln-complex-field-copy\">\u0418\u041D\u041D:{{ value?.inn }}</span><span copyClipboard class=\"sln-complex-field-ogrn sln-complex-field-copy\">\u041E\u0413\u0420\u041D:{{ value?.ogrn }}</span>\n        </h2>\n      }\n    </div>\n    <button (click)=\"editValue()\" style=\"min-width: 20px;\">\n      @if (!disabled) {\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\">\n          @if (isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @else {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n      }\n      @if (disabled) { \n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\">\n          <div class=\"sln-control-eye\"></div>\n        </div>\n      }\n    </button>\n  </div>\n  <mat-form-field style=\"display: none;\">\n    <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n  </mat-form-field>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }] });

class CoreOrganizationInfoComponent {
    constructor(_context) {
        this._context = _context;
    }
    ngOnInit() {
        const link = this._context.session?.organizations?.currentLink;
        this.isSystem = link?.detail?.globalRoleId === RolesEnum.System;
        this.isNotTeam = this.organization.systemType !== 'Team';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationInfoComponent, deps: [{ token: ContextService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreOrganizationInfoComponent, isStandalone: false, selector: "core-organization-info", inputs: { organization: "organization", disabled: "disabled", showExtension: "showExtension", editableTypes: "editableTypes" }, ngImport: i0, template: "<div provideParentForm class=\"sln-form-organization-info\">\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"organization.organizationName\" name=\"organizationName\" fieldName=\"organizationName\" placeholder=\"\u041F\u043E\u043B\u043D\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435\"\n        [settings]=\"{ isRequired: true, maxLength: 400 }\" [disabled]=\"disabled\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-8 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"organization.organizationShortName\" name=\"organizationShortName\" fieldName=\"organizationShortName\" placeholder=\"\u041A\u0440\u0430\u0442\u043A\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435\"\n        [settings]=\"{ isRequired: true, maxLength: 200 }\" [disabled]=\"disabled\"></core-field-string>\n      </div>\n    </div>\n    <div class=\"col-md-4 sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"organization.uniqueCode\" name=\"uniqueCode\" fieldName=\"uniqueCode\" placeholder=\"\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u043E\u0434\"\n        [settings]=\"{ maxLength: 200 }\" [disabled]=\"disabled || !isSystem\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  @if (isNotTeam) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-combobox [(ngModel)]=\"organization.okopf\" name=\"okopf\" fieldName=\"okopf\" placeholder=\"\u041E\u041A\u041E\u041F\u0424\" [disabled]=\"disabled\"\n          [settings]=\"{ sourceCode:'Okopfs', isRequired: true }\" class=\"sln-core-field-combobox\"></core-field-combobox>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam) {\n    <div class=\"row\">\n      <div class=\"col-md-4 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-ogrn [(ngModel)]=\"organization.ogrn\" name=\"ogrn\" fieldName=\"ogrn\" [disabled]=\"disabled || !isSystem\"\n          [settings]=\"{ isRequired: true }\" ></core-field-ogrn>\n        </div>\n      </div>\n      <div class=\"col-md-4 sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-inn [(ngModel)]=\"organization.inn\" name=\"inn\" fieldName=\"inn\" [disabled]=\"disabled || !isSystem\"\n          [settings]=\"{ isRequired: true }\"></core-field-inn>\n        </div>\n      </div>\n      <div class=\"col-md-4 sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-kpp [(ngModel)]=\"organization.kpp\" name=\"kpp\" fieldName=\"kpp\"  [disabled]=\"disabled\"\n          [settings]=\"{ isRequired: organization.inn?.length === 10 }\"></core-field-kpp>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam && showExtension) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveTitle\" name=\"chiefExecutiveTitle\" fieldName=\"chiefExecutiveTitle\" placeholder=\"\u0415\u0418\u041E \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C\"\n          [settings]=\"{ maxLength: 100 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveBaseOn\" name=\"chiefExecutiveBaseOn\" fieldName=\"chiefExecutiveBaseOn\" placeholder=\"\u0415\u0418\u041E \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u0430\u043D\u0438\u0438\"\n          [settings]=\"{ maxLength: 100 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam && showExtension) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveLastName\" name=\"chiefExecutiveLastName\" fieldName=\"chiefExecutiveLastName\" placeholder=\"\u0415\u0418\u041E \u0424\u0430\u043C\u0438\u043B\u0438\u044F\"\n          [settings]=\"{ maxLength: 50 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam && showExtension) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveFirstName\" name=\"chiefExecutiveFirstName\" fieldName=\"chiefExecutiveFirstName\" placeholder=\"\u0415\u0418\u041E \u0418\u043C\u044F\"\n          [settings]=\"{ maxLength: 50 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveMiddleName\" name=\"chiefExecutiveMiddleName\" fieldName=\"chiefExecutiveMiddleName\" placeholder=\"\u0415\u0418\u041E \u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E\"\n          [settings]=\"{ maxLength: 50 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-phone [(ngModel)]=\"organization.phone\" name=\"phone\" fieldName=\"phone\" placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430\" [disabled]=\"disabled\"></core-field-phone>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right sln-form-organization-info__email\">\n        <div class=\"form-group\">\n          <core-field-email [(ngModel)]=\"organization.email\" name=\"email\" fieldName=\"email\" [disabled]=\"disabled\"></core-field-email>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isSystem && editableTypes) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isClient\" name=\"organizationTypes_isClient\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u043A\u043B\u0438\u0435\u043D\u0442\n          </mat-checkbox>\n        </div>\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isBroker\" name=\"organizationTypes_isBroker\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0430\u0433\u0435\u043D\u0442\n          </mat-checkbox>\n        </div>\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isOperator\" name=\"organizationTypes_isOperator\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u043E\u043F\u0435\u0440\u0430\u0442\u043E\u0440\n          </mat-checkbox>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right\">\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isBank\" name=\"organizationTypes_isBank\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0431\u0430\u043D\u043A\n          </mat-checkbox>\n        </div>\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isFinancial\" name=\"organizationTypes_isFinancial\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u0443\u044E\u0449\u0430\u044F\n          </mat-checkbox>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isSystem && !editableTypes) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-padding-left sln-padding-right sln-form-organization-info__link\">\n        <p>\n          \"{{organization.organizationShortName}}\" \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0435 \u043A\u0430\u043A:\n          @if (organization.organizationTypes.isSystem) {\n            <span>\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u0430\u044F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u044F;</span>\n          }\n          @if (organization.organizationTypes.isClient) {\n            <span>\u041A\u043B\u0438\u0435\u043D\u0442;</span>\n          }\n          @if (organization.organizationTypes.isBroker) {\n            <span>\u0410\u0433\u0435\u043D\u0442;</span>\n          }\n          @if (organization.organizationTypes.isOperator) {\n            <span>\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440;</span>\n          }\n          @if (organization.organizationTypes.isBank) {\n            <span>\u0411\u0430\u043D\u043A</span>\n          }\n          @if (organization.organizationTypes.isFinancial) {\n            <span>\u0424\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u0443\u044E\u0449\u0430\u044F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438</span>\n          }\n        </p>\n      </div>\n    </div>\n  }\n</div>\n\n", styles: [".ibox-tools{text-align:end}.sln-form-organization-info__link{padding:0 0 0 5px}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"], dependencies: [{ kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldInnComponent, selector: "core-field-inn" }, { kind: "component", type: CoreFieldKppComponent, selector: "core-field-kpp" }, { kind: "component", type: CoreFieldOgrnComponent, selector: "core-field-ogrn" }, { kind: "component", type: CoreFieldEmailComponent, selector: "core-field-email" }, { kind: "component", type: CoreFieldPhoneComponent, selector: "core-field-phone" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationInfoComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-organization-info', standalone: false, template: "<div provideParentForm class=\"sln-form-organization-info\">\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"organization.organizationName\" name=\"organizationName\" fieldName=\"organizationName\" placeholder=\"\u041F\u043E\u043B\u043D\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435\"\n        [settings]=\"{ isRequired: true, maxLength: 400 }\" [disabled]=\"disabled\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-8 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"organization.organizationShortName\" name=\"organizationShortName\" fieldName=\"organizationShortName\" placeholder=\"\u041A\u0440\u0430\u0442\u043A\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435\"\n        [settings]=\"{ isRequired: true, maxLength: 200 }\" [disabled]=\"disabled\"></core-field-string>\n      </div>\n    </div>\n    <div class=\"col-md-4 sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"organization.uniqueCode\" name=\"uniqueCode\" fieldName=\"uniqueCode\" placeholder=\"\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u043E\u0434\"\n        [settings]=\"{ maxLength: 200 }\" [disabled]=\"disabled || !isSystem\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  @if (isNotTeam) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-combobox [(ngModel)]=\"organization.okopf\" name=\"okopf\" fieldName=\"okopf\" placeholder=\"\u041E\u041A\u041E\u041F\u0424\" [disabled]=\"disabled\"\n          [settings]=\"{ sourceCode:'Okopfs', isRequired: true }\" class=\"sln-core-field-combobox\"></core-field-combobox>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam) {\n    <div class=\"row\">\n      <div class=\"col-md-4 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-ogrn [(ngModel)]=\"organization.ogrn\" name=\"ogrn\" fieldName=\"ogrn\" [disabled]=\"disabled || !isSystem\"\n          [settings]=\"{ isRequired: true }\" ></core-field-ogrn>\n        </div>\n      </div>\n      <div class=\"col-md-4 sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-inn [(ngModel)]=\"organization.inn\" name=\"inn\" fieldName=\"inn\" [disabled]=\"disabled || !isSystem\"\n          [settings]=\"{ isRequired: true }\"></core-field-inn>\n        </div>\n      </div>\n      <div class=\"col-md-4 sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-kpp [(ngModel)]=\"organization.kpp\" name=\"kpp\" fieldName=\"kpp\"  [disabled]=\"disabled\"\n          [settings]=\"{ isRequired: organization.inn?.length === 10 }\"></core-field-kpp>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam && showExtension) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveTitle\" name=\"chiefExecutiveTitle\" fieldName=\"chiefExecutiveTitle\" placeholder=\"\u0415\u0418\u041E \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C\"\n          [settings]=\"{ maxLength: 100 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveBaseOn\" name=\"chiefExecutiveBaseOn\" fieldName=\"chiefExecutiveBaseOn\" placeholder=\"\u0415\u0418\u041E \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u0430\u043D\u0438\u0438\"\n          [settings]=\"{ maxLength: 100 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam && showExtension) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveLastName\" name=\"chiefExecutiveLastName\" fieldName=\"chiefExecutiveLastName\" placeholder=\"\u0415\u0418\u041E \u0424\u0430\u043C\u0438\u043B\u0438\u044F\"\n          [settings]=\"{ maxLength: 50 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam && showExtension) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveFirstName\" name=\"chiefExecutiveFirstName\" fieldName=\"chiefExecutiveFirstName\" placeholder=\"\u0415\u0418\u041E \u0418\u043C\u044F\"\n          [settings]=\"{ maxLength: 50 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"organization.extension.chiefExecutiveMiddleName\" name=\"chiefExecutiveMiddleName\" fieldName=\"chiefExecutiveMiddleName\" placeholder=\"\u0415\u0418\u041E \u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E\"\n          [settings]=\"{ maxLength: 50 }\" [disabled]=\"disabled\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isNotTeam) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-phone [(ngModel)]=\"organization.phone\" name=\"phone\" fieldName=\"phone\" placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430\" [disabled]=\"disabled\"></core-field-phone>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right sln-form-organization-info__email\">\n        <div class=\"form-group\">\n          <core-field-email [(ngModel)]=\"organization.email\" name=\"email\" fieldName=\"email\" [disabled]=\"disabled\"></core-field-email>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isSystem && editableTypes) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isClient\" name=\"organizationTypes_isClient\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u043A\u043B\u0438\u0435\u043D\u0442\n          </mat-checkbox>\n        </div>\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isBroker\" name=\"organizationTypes_isBroker\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0430\u0433\u0435\u043D\u0442\n          </mat-checkbox>\n        </div>\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isOperator\" name=\"organizationTypes_isOperator\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u043E\u043F\u0435\u0440\u0430\u0442\u043E\u0440\n          </mat-checkbox>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right\">\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isBank\" name=\"organizationTypes_isBank\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0431\u0430\u043D\u043A\n          </mat-checkbox>\n        </div>\n        <div class=\"form-group\">\n          <mat-checkbox [(ngModel)]=\"organization.organizationTypes.isFinancial\" name=\"organizationTypes_isFinancial\" class=\"sln-mat-checkbox\">\n            \u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0444\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u0443\u044E\u0449\u0430\u044F\n          </mat-checkbox>\n        </div>\n      </div>\n    </div>\n  }\n  @if (isSystem && !editableTypes) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-padding-left sln-padding-right sln-form-organization-info__link\">\n        <p>\n          \"{{organization.organizationShortName}}\" \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0435 \u043A\u0430\u043A:\n          @if (organization.organizationTypes.isSystem) {\n            <span>\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u0430\u044F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u044F;</span>\n          }\n          @if (organization.organizationTypes.isClient) {\n            <span>\u041A\u043B\u0438\u0435\u043D\u0442;</span>\n          }\n          @if (organization.organizationTypes.isBroker) {\n            <span>\u0410\u0433\u0435\u043D\u0442;</span>\n          }\n          @if (organization.organizationTypes.isOperator) {\n            <span>\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440;</span>\n          }\n          @if (organization.organizationTypes.isBank) {\n            <span>\u0411\u0430\u043D\u043A</span>\n          }\n          @if (organization.organizationTypes.isFinancial) {\n            <span>\u0424\u0438\u043D\u0430\u043D\u0441\u0438\u0440\u0443\u044E\u0449\u0430\u044F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438</span>\n          }\n        </p>\n      </div>\n    </div>\n  }\n</div>\n\n", styles: [".ibox-tools{text-align:end}.sln-form-organization-info__link{padding:0 0 0 5px}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"] }]
        }], ctorParameters: () => [{ type: ContextService }], propDecorators: { organization: [{
                type: Input
            }], disabled: [{
                type: Input
            }], showExtension: [{
                type: Input
            }], editableTypes: [{
                type: Input
            }] } });

class CoreOrganizationModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationModule, declarations: [CoreOrganizationDialogWindow,
            CoreFieldOrganizationComponent,
            CoreOrganizationSearchComponent,
            CoreOrganizationInfoComponent], imports: [CoreBaseModule,
            CoreMatModule,
            CoreDirectiveModule,
            CoreControlModule,
            CoreDialogModule,
            CoreDaDataModule,
            CoreContactVerificationModule], exports: [CoreOrganizationDialogWindow,
            CoreFieldOrganizationComponent,
            CoreOrganizationSearchComponent,
            CoreOrganizationInfoComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationModule, providers: [
            OrganizationBaseService
        ], imports: [CoreBaseModule,
            CoreMatModule,
            CoreDirectiveModule,
            CoreControlModule,
            CoreDialogModule,
            CoreDaDataModule,
            CoreContactVerificationModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreOrganizationModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreOrganizationDialogWindow,
                        CoreFieldOrganizationComponent,
                        CoreOrganizationSearchComponent,
                        CoreOrganizationInfoComponent,
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreDirectiveModule,
                        CoreControlModule,
                        CoreDialogModule,
                        CoreDaDataModule,
                        CoreContactVerificationModule,
                    ],
                    providers: [
                        OrganizationBaseService
                    ],
                    exports: [
                        CoreOrganizationDialogWindow,
                        CoreFieldOrganizationComponent,
                        CoreOrganizationSearchComponent,
                        CoreOrganizationInfoComponent,
                    ]
                }]
        }] });

class CoreGridFilterBaseComponent {
    constructor() {
        this.isComponentInit = false;
        this.smallSize = false;
        this.changeFilterItem = new EventEmitter();
        this._valueInitialized = false;
    }
    get initValue() {
        return this._initValue;
    }
    set initValue(value) {
        this._initValue = value;
        if (!Utility.isEmpty(value) && !this._valueInitialized) {
            this._initializeValue();
            this._valueInitialized = true;
        }
    }
    get isPositiveCondition() {
        const conditionMeta = ALTERNATIVE_FILTER_CONDITIONS.find(z => z.cond === this.condition);
        return conditionMeta?.state === '+';
    }
    ngAfterViewInit() {
        this.isComponentInit = true;
    }
    _initializeValue() {
        if (!!this.initValue) {
            if (typeof this.initValue === 'string' || this.initValue instanceof String) {
                this._setStringValue(this.initValue);
            }
            else if (typeof this.initValue === 'number' || this.initValue instanceof Number) {
                this._setNumberValue(this.initValue);
            }
            else if (this.initValue && typeof this.initValue === 'object' && 'id' in this.initValue && 'text' in this.initValue) {
                this._setComboboxValue(this.initValue);
            }
            else {
                this._initializeCustomValue(this.initValue);
            }
        }
    }
    _changeFilterItem(value) {
        this.changeFilterItem.emit({ value: value ?? this._getValue(), condition: this.condition, field: this.columnDef });
    }
    _componentLoaded() {
        return true;
    }
    _setStringValue(_) {
        throw new Error('Initialize not implemented');
    }
    _setNumberValue(_) {
        throw new Error('Initialize not implemented');
    }
    _setComboboxValue(_) {
        throw new Error('Initialize not implemented');
    }
    _initializeCustomValue(_) {
        throw new Error('Initialize not implemented');
    }
    // todo: под вопросом этот метод
    _applyFilter(element, valueProcessor) {
        let filterValue;
        if (valueProcessor) {
            filterValue = valueProcessor(element);
        }
        else {
            filterValue = !Utility.isEmpty(element) ? Number(element.id) : undefined;
        }
        this._changeFilterItem(filterValue);
    }
    changeCond() {
        const conditionMeta = ALTERNATIVE_FILTER_CONDITIONS.find(z => z.cond === this.condition);
        if (!conditionMeta) {
            return;
        }
        this.condition = conditionMeta.alt;
        let filterValue;
        let element = this._getValue();
        if (element && typeof element === 'object' && 'id' in element && 'text' in element) {
            filterValue = !Utility.isEmpty(element) ? element.id : undefined;
        }
        else {
            filterValue = element;
        }
        this._changeFilterItem(filterValue);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridFilterBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreGridFilterBaseComponent, isStandalone: true, selector: "ng-component", inputs: { smallSize: "smallSize", columnDef: "columnDef", condition: "condition", placeholder: "placeholder", initValue: "initValue" }, outputs: { changeFilterItem: "changeFilterItem" }, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridFilterBaseComponent, decorators: [{
            type: Component,
            args: [{
                    template: ''
                }]
        }], propDecorators: { smallSize: [{
                type: Input
            }], columnDef: [{
                type: Input
            }], condition: [{
                type: Input
            }], placeholder: [{
                type: Input
            }], changeFilterItem: [{
                type: Output
            }], initValue: [{
                type: Input
            }] } });

class CoreFilterOrganizationComponent extends CoreGridFilterBaseComponent {
    constructor(_cd) {
        super();
        this._cd = _cd;
        this.condition = 'Contains';
    }
    _getValue() {
        return this.organizationInn;
    }
    _setStringValue(value) {
        this.organizationInn = value;
        setTimeout(() => {
            this.searchControl.searchControl.value = this.organizationInn;
            this._cd.markForCheck();
        }, 100);
    }
    onSearchClick(data) {
        if (data) {
            this.organizationInn = data.inn;
            this._changeFilterItem();
        }
    }
    onCleanClick($event) {
        this.organizationInn = undefined;
        this._changeFilterItem();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFilterOrganizationComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreFilterOrganizationComponent, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "searchControl", first: true, predicate: CoreOrganizationSearchComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-column-filter-template multiple-combobox-with-btn\">\n  <core-organization-search [classes]=\"(smallSize === true ? 'sln-input-s' : '')\" [placeholder]=\"placeholder\" (searchClick)=\"onSearchClick($event)\" (clearClick)=\"onCleanClick($event)\" ></core-organization-search>\n  <button type=\"button\" matTooltip=\"{{isPositiveCondition ? '\u0412\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439' : '\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439'}}\" class=\"sln-column-filter-template-btn\" (click)=\"changeCond()\">\n    <div class=\"{{isPositiveCondition ? 'sln-common-input-plus' : 'sln-common-input-minus'}}\"></div>\n  </button>\n</div>\n<core-field-inn [hidden]=\"true\" [(ngModel)]=\"organizationInn\" name=\"organizationInn\" fieldName=\"organizationInn\" [disabled]=\"true\"></core-field-inn>\n", styles: [".multiple-combobox-with-btn{position:relative}.multiple-combobox-with-btn ::ng-deep .sln-core-field-combobox .mat-mdc-select-value{width:94%}.multiple-combobox-with-btn ::ng-deep .sln-position-close{right:var(--FILTER-COMBO-CLEAR-RIGHT, 52px)!important;top:var(--FILTER-COMBO-CLEAR-TOP, 20px)!important}\n"], dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreFieldInnComponent, selector: "core-field-inn" }, { kind: "component", type: CoreOrganizationSearchComponent, selector: "core-organization-search", inputs: ["placeholder", "classes"], outputs: ["searchClick", "clearClick"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFilterOrganizationComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<div class=\"sln-column-filter-template multiple-combobox-with-btn\">\n  <core-organization-search [classes]=\"(smallSize === true ? 'sln-input-s' : '')\" [placeholder]=\"placeholder\" (searchClick)=\"onSearchClick($event)\" (clearClick)=\"onCleanClick($event)\" ></core-organization-search>\n  <button type=\"button\" matTooltip=\"{{isPositiveCondition ? '\u0412\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439' : '\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439'}}\" class=\"sln-column-filter-template-btn\" (click)=\"changeCond()\">\n    <div class=\"{{isPositiveCondition ? 'sln-common-input-plus' : 'sln-common-input-minus'}}\"></div>\n  </button>\n</div>\n<core-field-inn [hidden]=\"true\" [(ngModel)]=\"organizationInn\" name=\"organizationInn\" fieldName=\"organizationInn\" [disabled]=\"true\"></core-field-inn>\n", styles: [".multiple-combobox-with-btn{position:relative}.multiple-combobox-with-btn ::ng-deep .sln-core-field-combobox .mat-mdc-select-value{width:94%}.multiple-combobox-with-btn ::ng-deep .sln-position-close{right:var(--FILTER-COMBO-CLEAR-RIGHT, 52px)!important;top:var(--FILTER-COMBO-CLEAR-TOP, 20px)!important}\n"] }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { searchControl: [{
                type: ViewChild,
                args: [CoreOrganizationSearchComponent]
            }] } });

class CoreFilterOrganizationInternalComponent extends CoreGridFilterBaseComponent {
    constructor(_cd) {
        super();
        this._cd = _cd;
        this._suppressSearchChange = false;
        this.condition = 'Contains';
    }
    _getValue() {
        return this.organizationInn;
    }
    _setStringValue(value) {
        this.organizationInn = { id: value, text: value };
        this._suppressSearchChange = true;
        this._setInControlValue(this.organizationInn);
        this._cd.markForCheck();
    }
    _setComboboxValue(value) {
        this.organizationInn = value;
        this._suppressSearchChange = true;
        this._setInControlValue(this.organizationInn);
        this._cd.markForCheck();
    }
    _setInControlValue(v) {
        this.searchControl.onChange = (value) => {
            this.searchControl._componentComboboxFilter.setValue(value.text);
        };
        this.searchControl.value = v;
        this.searchControl.onChange = (_) => { };
    }
    onSearchClick(data) {
        if (this._suppressSearchChange) {
            this._suppressSearchChange = false;
            return;
        }
        if (data) {
            this.organizationInn = data;
        }
        else {
            this.organizationInn = undefined;
        }
        this._changeFilterItem(data?.id);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFilterOrganizationInternalComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreFilterOrganizationInternalComponent, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "searchControl", first: true, predicate: CoreFieldTypeComboboxComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-column-filter-template multiple-combobox-with-btn\">\n  <core-field-combobox  name=\"organization\" fieldName=\"organization\"  [placeholder]=\"placeholder\"\n    [settings]=\"{ sourceCode: 'OrganizationsInn'}\"\n    cmpClass=\"sln-grid-filter\" (valueChange)=\"onSearchClick($event)\" class=\"{{(smallSize === true ? 'sln-input-s' : '')}}\">\n  </core-field-combobox>\n  <button type=\"button\" matTooltip=\"{{isPositiveCondition ? '\u0412\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439' : '\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439'}}\" class=\"sln-column-filter-template-btn\" (click)=\"changeCond()\">\n    <div class=\"{{isPositiveCondition ? 'sln-common-input-plus' : 'sln-common-input-minus'}}\"></div>\n  </button>\n</div>\n<core-field-inn [hidden]=\"true\" [(ngModel)]=\"organizationInn\" name=\"organizationInn\" fieldName=\"organizationInn\" [disabled]=\"true\"></core-field-inn>\n", styles: [".multiple-combobox-with-btn{position:relative}.multiple-combobox-with-btn ::ng-deep .sln-core-field-combobox .mat-mdc-select-value{width:94%}.multiple-combobox-with-btn ::ng-deep .sln-position-close{right:var(--FILTER-COMBO-CLEAR-RIGHT, 52px)!important;top:var(--FILTER-COMBO-CLEAR-TOP, 20px)!important}\n"], dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldInnComponent, selector: "core-field-inn" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFilterOrganizationInternalComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<div class=\"sln-column-filter-template multiple-combobox-with-btn\">\n  <core-field-combobox  name=\"organization\" fieldName=\"organization\"  [placeholder]=\"placeholder\"\n    [settings]=\"{ sourceCode: 'OrganizationsInn'}\"\n    cmpClass=\"sln-grid-filter\" (valueChange)=\"onSearchClick($event)\" class=\"{{(smallSize === true ? 'sln-input-s' : '')}}\">\n  </core-field-combobox>\n  <button type=\"button\" matTooltip=\"{{isPositiveCondition ? '\u0412\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439' : '\u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439'}}\" class=\"sln-column-filter-template-btn\" (click)=\"changeCond()\">\n    <div class=\"{{isPositiveCondition ? 'sln-common-input-plus' : 'sln-common-input-minus'}}\"></div>\n  </button>\n</div>\n<core-field-inn [hidden]=\"true\" [(ngModel)]=\"organizationInn\" name=\"organizationInn\" fieldName=\"organizationInn\" [disabled]=\"true\"></core-field-inn>\n", styles: [".multiple-combobox-with-btn{position:relative}.multiple-combobox-with-btn ::ng-deep .sln-core-field-combobox .mat-mdc-select-value{width:94%}.multiple-combobox-with-btn ::ng-deep .sln-position-close{right:var(--FILTER-COMBO-CLEAR-RIGHT, 52px)!important;top:var(--FILTER-COMBO-CLEAR-TOP, 20px)!important}\n"] }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { searchControl: [{
                type: ViewChild,
                args: [CoreFieldTypeComboboxComponent]
            }] } });

class CoreGridModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreGridModule, declarations: [CoreGirdDynamicPipe,
            CoreServerGridComponent,
            CoreGridColumnTemplateComponent,
            CoreGridFiltersComponent,
            CoreGridFilterTemplateComponent,
            CoreGridDialogFilterComponent,
            CoreGridConfigUserColumnDialogWindow,
            CoreUserViewDialogWindow,
            CoreGridExportModeDialogWindow,
            CoreFilterOrganizationComponent,
            CoreFilterOrganizationInternalComponent,
            DoubleScrollbarsComponent,
            CoreGridAlignButtonsComponent], imports: [CoreMatModule,
            CoreBaseModule,
            CoreControlModule,
            CoreDialogModule,
            CoreOrganizationModule,
            CoreGridColumnResizeDirective], exports: [CoreMatModule,
            CoreBaseModule,
            CoreGirdDynamicPipe,
            CoreServerGridComponent,
            CoreGridAlignButtonsComponent,
            CoreFilterOrganizationComponent,
            CoreFilterOrganizationInternalComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridModule, providers: [
            PopupResults,
            GridConfigutarionService,
            GridStoreService,
            CoreGirdDynamicPipe,
            { provide: "money", useValue: new MoneyPipe() },
            { provide: "dateRu", useValue: new RuDatePipe() },
            { provide: "dateTimeRu", useValue: new RuDateTimePipe() },
            { provide: "percentTransform", useValue: new PercentTransformPipe() },
            { provide: "boolean", useValue: new BooleanPipe() },
            { provide: "proportion", useValue: new ProportionPercentPipe() }
        ], imports: [CoreMatModule,
            CoreBaseModule,
            CoreControlModule,
            CoreDialogModule,
            CoreOrganizationModule, CoreMatModule,
            CoreBaseModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreGridModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreGirdDynamicPipe,
                        CoreServerGridComponent,
                        CoreGridColumnTemplateComponent,
                        CoreGridFiltersComponent,
                        CoreGridFilterTemplateComponent,
                        CoreGridDialogFilterComponent,
                        CoreGridConfigUserColumnDialogWindow,
                        CoreUserViewDialogWindow,
                        CoreGridExportModeDialogWindow,
                        CoreFilterOrganizationComponent,
                        CoreFilterOrganizationInternalComponent,
                        DoubleScrollbarsComponent,
                        CoreGridAlignButtonsComponent,
                    ],
                    imports: [
                        CoreMatModule,
                        CoreBaseModule,
                        CoreControlModule,
                        CoreDialogModule,
                        CoreOrganizationModule,
                        CoreGridColumnResizeDirective
                    ],
                    providers: [
                        PopupResults,
                        GridConfigutarionService,
                        GridStoreService,
                        CoreGirdDynamicPipe,
                        { provide: "money", useValue: new MoneyPipe() },
                        { provide: "dateRu", useValue: new RuDatePipe() },
                        { provide: "dateTimeRu", useValue: new RuDateTimePipe() },
                        { provide: "percentTransform", useValue: new PercentTransformPipe() },
                        { provide: "boolean", useValue: new BooleanPipe() },
                        { provide: "proportion", useValue: new ProportionPercentPipe() }
                    ],
                    exports: [
                        CoreMatModule,
                        CoreBaseModule,
                        CoreGirdDynamicPipe,
                        CoreServerGridComponent,
                        CoreGridAlignButtonsComponent,
                        CoreFilterOrganizationComponent,
                        CoreFilterOrganizationInternalComponent
                    ]
                }]
        }] });

class LongTastService {
    _makeOptions(url, actions) {
        return {
            url: url,
            data: actions.data,
            callback: () => {
                actions.doneCollback();
            },
            progress: (count) => {
                actions.progressCallback(count);
            }
        };
    }
}

class GridArrayDataService {
    resolveFieldValue(item, field) {
        if (!item || !field) {
            return undefined;
        }
        if (field.indexOf('.') === -1) {
            return item[field];
        }
        return field.split('.').reduce((acc, key) => {
            return acc === undefined || acc === null ? undefined : acc[key];
        }, item);
    }
    normalizeSortValue(value, field) {
        const isDateField = /date|created|updated/i.test(field ?? '');
        if (isDateField) {
            const date = new Date(value).getTime();
            if (!Number.isNaN(date)) {
                return date;
            }
        }
        if (typeof value === 'number') {
            return value;
        }
        return String(value ?? '').toLowerCase();
    }
    evaluateFilterCondition(source, condition, target) {
        const sourceStr = String(source ?? '').toLowerCase();
        const targetStr = String(target ?? '').toLowerCase();
        switch (condition) {
            case 'Contains':
                return sourceStr.includes(targetStr);
            case 'DoesNotContain':
                return !sourceStr.includes(targetStr);
            case 'EqualTo':
                return sourceStr === targetStr;
            case 'NotEqualTo':
                return sourceStr !== targetStr;
            case 'In':
                return this._splitFilterValues(target).some(x => x === sourceStr);
            case 'NotIn':
                return this._splitFilterValues(target).every(x => x !== sourceStr);
            case 'StartsWith':
                return sourceStr.startsWith(targetStr);
            case 'EndsWith':
                return sourceStr.endsWith(targetStr);
            case 'GreaterThan':
                return this._compare(source, target) > 0;
            case 'GreaterThanOrEqualTo':
                return this._compare(source, target) >= 0;
            case 'LessThan':
                return this._compare(source, target) < 0;
            case 'LessThanOrEqualTo':
                return this._compare(source, target) <= 0;
            default:
                return true;
        }
    }
    getDataSourceItems(query, _params) {
        const parsed = this._parseQuery(query);
        const items = this.ReadItems();
        const filtered = this._applyFilters(items, parsed.filters);
        const sorted = this._applySort(filtered, parsed.sortField, parsed.sortDirection);
        const start = parsed.page * parsed.pageSize;
        const paged = sorted.slice(start, start + parsed.pageSize);
        return of({
            isSuccess: true,
            entity: {
                pageIndex: parsed.page,
                pageSize: parsed.pageSize,
                totalCount: sorted.length,
                entity: paged
            }
        });
    }
    _parseQuery(query) {
        const search = new URLSearchParams(query ?? '');
        const parsed = {
            page: Number(search.get('page') ?? 0),
            pageSize: Number(search.get('pageSize') ?? 10),
            filters: []
        };
        const sort = search.get('sort');
        if (sort && sort.startsWith('{') && sort.endsWith('}')) {
            const raw = sort.substring(1, sort.length - 1);
            const splitIndex = raw.lastIndexOf('-');
            if (splitIndex > 0) {
                parsed.sortField = raw.substring(0, splitIndex);
                parsed.sortDirection = raw.substring(splitIndex + 1);
            }
        }
        const filter = search.get('filter');
        if (filter) {
            const regex = /\(([^~]+)~([^~]+)~([^)]+)\)/g;
            let match = regex.exec(filter);
            while (match) {
                parsed.filters.push({
                    field: match[1],
                    condition: match[2],
                    value: match[3]
                });
                match = regex.exec(filter);
            }
        }
        return parsed;
    }
    _applySort(items, sortField, direction) {
        if (!sortField || !direction) {
            return [...items];
        }
        return [...items].sort((a, b) => {
            const left = this.normalizeSortValue(this.resolveFieldValue(a, sortField), sortField);
            const right = this.normalizeSortValue(this.resolveFieldValue(b, sortField), sortField);
            if (left === right) {
                return 0;
            }
            const base = left > right ? 1 : -1;
            return direction === 'asc' ? base : base * -1;
        });
    }
    _applyFilters(items, filters) {
        if (!filters || filters.length === 0) {
            return [...items];
        }
        return items.filter((item) => {
            return filters.every((filterItem) => this._matchFilter(item, filterItem));
        });
    }
    _matchFilter(item, filterItem) {
        const rawValue = this.resolveFieldValue(item, filterItem.field);
        return this.evaluateFilterCondition(rawValue, filterItem.condition, filterItem.value);
    }
    _splitFilterValues(value) {
        if (Array.isArray(value)) {
            return value.map(x => String(x ?? '').toLowerCase().trim()).filter(x => x.length > 0);
        }
        return String(value ?? '')
            .split(',')
            .map(x => x.toLowerCase().trim())
            .filter(x => x.length > 0);
    }
    _compare(left, right) {
        const leftNum = Number(left);
        const rightNum = Number(right);
        if (!Number.isNaN(leftNum) && !Number.isNaN(rightNum)) {
            if (leftNum === rightNum) {
                return 0;
            }
            return leftNum > rightNum ? 1 : -1;
        }
        const leftDate = new Date(left).getTime();
        const rightDate = new Date(right).getTime();
        if (!Number.isNaN(leftDate) && !Number.isNaN(rightDate)) {
            if (leftDate === rightDate) {
                return 0;
            }
            return leftDate > rightDate ? 1 : -1;
        }
        const leftStr = String(left ?? '').toLowerCase();
        const rightStr = String(right ?? '').toLowerCase();
        if (leftStr === rightStr) {
            return 0;
        }
        return leftStr > rightStr ? 1 : -1;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridArrayDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridArrayDataService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GridArrayDataService, decorators: [{
            type: Injectable
        }] });

class StepperEnabledPipe {
    transform(items) {
        if (!items) {
            return items;
        }
        return items.filter(item => item.enabled === true);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: StepperEnabledPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: StepperEnabledPipe, isStandalone: false, name: "stepperEnabled", pure: false }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: StepperEnabledPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'stepperEnabled',
                    pure: false,
                    standalone: false
                }]
        }] });

class CoreStepperComponent {
    get active() {
        return this.getActive();
    }
    get lastIndex() {
        const active = this.getActive();
        return active[active.length - 1].index;
    }
    constructor(_pipe) {
        this._pipe = _pipe;
        this.directFill = true;
        this.hideButtons = false;
        this.hideFooter = false;
        this.stepperDone = new EventEmitter();
        this.step = 1;
    }
    goToStep(index) {
        if (this.directFill) {
            this.step = index;
        }
    }
    back() {
        const active = this.getActive();
        const current = active.find(x => x.index == this.step);
        const position = active.indexOf(current);
        this.step = active[position - 1].index;
    }
    next() {
        const active = this.getActive();
        const current = active.find(x => x.index == this.step);
        const position = active.indexOf(current);
        this.step = active[position + 1].index;
    }
    accept() {
        this.stepperDone.emit(true);
    }
    getActive() {
        return this._pipe.transform(this.steps);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreStepperComponent, deps: [{ token: StepperEnabledPipe }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreStepperComponent, isStandalone: false, selector: "core-stepper", inputs: { steps: "steps", form: "form", directFill: "directFill", hideButtons: "hideButtons", hideFooter: "hideFooter" }, outputs: { stepperDone: "stepperDone" }, ngImport: i0, template: "<div class=\"sln-core-steps-wrapper\">\n  <div class=\"sln-core-steps-segments\">\n    @for (segment of steps | stepperEnabled; track segment) {\n      <div class=\"sln-core-steps-segment {{ segment.index > step ? 'sln-core-steps-segment-empty' : ''  }}\"\n      [matTooltip]=\"segment.description\" matTooltipPosition=\"above\"   (click)=\"goToStep(segment.index)\"></div>\n    }\n  </div>\n  <div class=\"sln-core-steps-content\">\n    <div style=\"height:60vh; overflow: auto;\">\n      <ng-content></ng-content>\n    </div>\n  </div>\n</div>\n@if (hideFooter === false) {\n  <div class=\"sln-core-steps-footer\">\n    @if (hideButtons === false) {\n      @if (step !== 1) {\n        <button class=\"light-btn-default\" (click)=\"back()\">\u041D\u0430\u0437\u0430\u0434</button>\n      }\n      @if (step !== lastIndex) {\n        <button class=\"btn-primary\" (click)=\"next()\" [disabled]=\"form.invalid\">\u0414\u0430\u043B\u0435\u0435</button>\n      }\n    }\n    @if (step === lastIndex) {\n      <button class=\"btn-primary\" (click)=\"accept()\" [disabled]=\"form.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n}\n", styles: [".sln-core-steps-wrapper{position:relative;margin-bottom:60px}.sln-core-steps-segments{height:10px;width:100%;display:flex}.sln-core-steps-segments .sln-core-steps-segment{width:100%;margin-right:5px;background-color:var(--PRIMARY)}.sln-core-steps-segments .sln-core-steps-segment-empty{opacity:.5}.sln-core-steps-content{margin-top:10px}.sln-core-steps-footer{position:absolute;bottom:10px;right:20px;display:flex;justify-content:flex-end}.sln-core-steps-footer button{margin-left:5px;width:200px}\n"], dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: StepperEnabledPipe, name: "stepperEnabled" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreStepperComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-stepper', standalone: false, template: "<div class=\"sln-core-steps-wrapper\">\n  <div class=\"sln-core-steps-segments\">\n    @for (segment of steps | stepperEnabled; track segment) {\n      <div class=\"sln-core-steps-segment {{ segment.index > step ? 'sln-core-steps-segment-empty' : ''  }}\"\n      [matTooltip]=\"segment.description\" matTooltipPosition=\"above\"   (click)=\"goToStep(segment.index)\"></div>\n    }\n  </div>\n  <div class=\"sln-core-steps-content\">\n    <div style=\"height:60vh; overflow: auto;\">\n      <ng-content></ng-content>\n    </div>\n  </div>\n</div>\n@if (hideFooter === false) {\n  <div class=\"sln-core-steps-footer\">\n    @if (hideButtons === false) {\n      @if (step !== 1) {\n        <button class=\"light-btn-default\" (click)=\"back()\">\u041D\u0430\u0437\u0430\u0434</button>\n      }\n      @if (step !== lastIndex) {\n        <button class=\"btn-primary\" (click)=\"next()\" [disabled]=\"form.invalid\">\u0414\u0430\u043B\u0435\u0435</button>\n      }\n    }\n    @if (step === lastIndex) {\n      <button class=\"btn-primary\" (click)=\"accept()\" [disabled]=\"form.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n}\n", styles: [".sln-core-steps-wrapper{position:relative;margin-bottom:60px}.sln-core-steps-segments{height:10px;width:100%;display:flex}.sln-core-steps-segments .sln-core-steps-segment{width:100%;margin-right:5px;background-color:var(--PRIMARY)}.sln-core-steps-segments .sln-core-steps-segment-empty{opacity:.5}.sln-core-steps-content{margin-top:10px}.sln-core-steps-footer{position:absolute;bottom:10px;right:20px;display:flex;justify-content:flex-end}.sln-core-steps-footer button{margin-left:5px;width:200px}\n"] }]
        }], ctorParameters: () => [{ type: StepperEnabledPipe }], propDecorators: { steps: [{
                type: Input
            }], form: [{
                type: Input
            }], directFill: [{
                type: Input
            }], hideButtons: [{
                type: Input
            }], hideFooter: [{
                type: Input
            }], stepperDone: [{
                type: Output
            }] } });

class StepperAdditionalPipe {
    transform(items) {
        if (!items) {
            return items;
        }
        return items.filter(item => item.isAdditional === true);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: StepperAdditionalPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: StepperAdditionalPipe, isStandalone: false, name: "stepperAdditional", pure: false }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: StepperAdditionalPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'stepperAdditional',
                    pure: false,
                    standalone: false
                }]
        }] });

class CoreStepperModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreStepperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreStepperModule, declarations: [CoreStepperComponent,
            StepperAdditionalPipe,
            StepperEnabledPipe], imports: [CoreBaseModule,
            CoreMatModule], exports: [CoreStepperComponent,
            StepperAdditionalPipe,
            StepperEnabledPipe] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreStepperModule, providers: [
            StepperEnabledPipe
        ], imports: [CoreBaseModule,
            CoreMatModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreStepperModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreStepperComponent,
                        StepperAdditionalPipe,
                        StepperEnabledPipe
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule
                    ],
                    providers: [
                        StepperEnabledPipe
                    ],
                    exports: [
                        CoreStepperComponent,
                        StepperAdditionalPipe,
                        StepperEnabledPipe
                    ]
                }]
        }] });

class SignalRService extends SignalBaseService {
    constructor(_start) {
        super();
        this._start = _start;
        this.isSending = false;
        this.STORAGE_KEY = 'sellan_chat_pending_messages';
        this._pendingMessagesSubject = new BehaviorSubject([]);
        this.pendingMessages$ = this._pendingMessagesSubject.asObservable();
        this.loadFromStorage();
    }
    loadFromStorage() {
        try {
            const stored = localStorage.getItem(this.STORAGE_KEY);
            if (stored) {
                const messages = JSON.parse(stored);
                if (Array.isArray(messages)) {
                    this._pendingMessagesSubject.next(messages);
                }
            }
        }
        catch (e) {
            console.error('Failed to load chat messages from storage', e);
        }
    }
    saveToStorage(messages) {
        try {
            localStorage.setItem(this.STORAGE_KEY, JSON.stringify(messages));
        }
        catch (e) {
            console.error('Failed to save chat messages to storage', e);
        }
    }
    addPendingMessage(message) {
        const currentMessages = this._pendingMessagesSubject.value;
        const dtoCopy = { ...message, cacheMessageId: message['cacheMessageId'] || Math.random() };
        // Check for duplicates
        const exists = currentMessages.some(c => c.cacheMessageId == dtoCopy.cacheMessageId &&
            c.userId == dtoCopy.userId &&
            c.roomId == dtoCopy.roomId);
        if (!exists) {
            const newMessages = [...currentMessages, dtoCopy];
            this._pendingMessagesSubject.next(newMessages);
            this.saveToStorage(newMessages);
        }
    }
    confirmMessageSent(message) {
        const currentMessages = this._pendingMessagesSubject.value;
        if (!currentMessages || currentMessages.length === 0)
            return;
        const newMessages = currentMessages.filter(c => !(c.id == message.id && c.userId == message.userId && c.roomId == message.roomId));
        if (newMessages.length !== currentMessages.length) {
            this._pendingMessagesSubject.next(newMessages);
            this.saveToStorage(newMessages);
        }
    }
    getHubUrl(userId) {
        return this._start.apiRoot('signals/ChatReceiveMessage/' + userId, 'core');
    }
    onReconnected() {
        return (_) => {
            let subOnreconnected = this.pendingMessages$.subscribe(msgs => {
                if (msgs != null && msgs.length > 0) {
                    setTimeout(() => { this.checkAndStartConnection(); subOnreconnected.unsubscribe(); }, 3000);
                }
            });
        };
    }
    onReconnectedLogic() {
        return () => {
            if (this._hubConnection.state == window.signalR.HubConnectionState.Connected && !this.isSending) {
                this._sendStorageMessage();
            }
        };
    }
    onReceived() {
        return (data) => {
            this.confirmMessageSent(data);
        };
    }
    onSent() {
        return (_) => {
            this.isSending = false;
        };
    }
    onSentFail() {
        return (_) => {
            this.isSending = false;
        };
    }
    onCantSent() {
        return (data) => {
            this.addPendingMessage(data);
        };
    }
    sendMessage(message, from, groupId, fileData = null) {
        let dto = {
            id: Guid.newGuid().toString(),
            userId: from,
            roomId: groupId,
            content: message.content,
            onlyOrganizations: message.onlyOrganizations,
            parentMessageId: !!message.parentMessageId ? message.parentMessageId.toString() : null,
            parentMessageType: message.parentMessageType,
            attachment: fileData
        };
        this.sendToHub(dto, 'SendChatMessage', true);
    }
    _sendStorageMessage() {
        if (!this.isSending) {
            this.isSending = true;
            this.pendingMessages$.pipe(take(1)).subscribe(msgs => {
                if (msgs != null && msgs.length > 0) {
                    let storageMessages = Object.assign(msgs);
                    storageMessages.forEach((item) => {
                        this.sendToHub(item, 'SendChatMessage', true);
                    });
                }
                this.isSending = false;
            });
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SignalRService, deps: [{ token: Startup }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SignalRService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SignalRService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: Startup }] });

class SellanChatUsersService {
    constructor(_ajaxM, _startUpM, _extendNotif, _context, _signalRService) {
        this._ajaxM = _ajaxM;
        this._startUpM = _startUpM;
        this._extendNotif = _extendNotif;
        this._context = _context;
        this._signalRService = _signalRService;
        this.isReady = new ReplaySubject(1);
        this.reloadUsersList = new ReplaySubject();
        this.users = null; //TODO поменять после добавления пагинации для
        this.userSelected = new EventEmitter();
        this._context.sessionEnded$.subscribe(() => this.onSessionEnded());
        this._context.sessionStarted$.subscribe(() => this.onSessionStarted());
        this.getChatUserInfo().subscribe({
            next: (z) => {
                this.chatUser = z.entity;
                this.isReady.next(true);
            },
            error: () => undefined,
        });
    }
    onSessionEnded() {
        this._signalRService.stopConnection();
        this.chatUser = undefined;
        this.users = null;
        this.isReady.next(false);
    }
    onSessionStarted() {
        this.getChatUserInfo().subscribe({
            next: (z) => {
                this.chatUser = z.entity;
                this.isReady.next(true);
            },
            error: () => this.isReady.next(false),
        });
    }
    getChatUserInfo() {
        const url = this._startUpM.apiRoot('chat/user', 'core');
        return this._ajaxM.get({ url: url });
    }
    updateChetUserInfo(profile) {
        //post
        const url = this._startUpM.apiRoot('chat/user/update', 'core');
        return this._ajaxM.post({ url: url, data: profile });
    }
    createUserRoom(dto) {
        const url = this._startUpM.apiRoot('chat/chat-room', 'core');
        return this._ajaxM.post({ url: url, data: dto });
    }
    getUserChats() {
        const url = this._startUpM.apiRoot('chat/user-rooms', 'core');
        return this._ajaxM.get({ url: url }).pipe(map(z => {
            if (z && z.entity) {
                this.chatUserHaveNewMessage = z.entity.filter(x => !!x.newMessage).length > 0;
                this._extendNotif.setHaveNewChatMessage(this.chatUserHaveNewMessage);
            }
            return z;
        }));
    }
    addUserIntoGroup(dto) {
        const url = this._startUpM.apiRoot('chat/add-users-room', 'core');
        return this._ajaxM.put({ url: url, data: dto });
    }
    removeUserFromGroup(dto) {
        const url = this._startUpM.apiRoot('chat/remove-users-from-room', 'core');
        return this._ajaxM.put({ url: url, data: dto });
    }
    getChats(tabIndex) {
        switch (tabIndex) {
            case 0: {
                return this.users.slice();
            }
            case 3: {
                return this.users.slice().filter((chat) => chat.config.isFavorite);
            }
            default: {
                return this.users.slice().filter((chat) => chat.config.isFavorite);
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatUsersService, deps: [{ token: AjaxService }, { token: Startup }, { token: PageService }, { token: ContextService }, { token: SignalRService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatUsersService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatUsersService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: AjaxService }, { type: Startup }, { type: PageService }, { type: ContextService }, { type: SignalRService }] });

class SellanChatNotificationService {
    constructor(_signalRService, _chatUserService) {
        this._signalRService = _signalRService;
        this._chatUserService = _chatUserService;
        this.isNotify = new ReplaySubject();
        this._messageAudio = new Audio('assets/sounds/chat-message.mp3');
        this._audioUnlocked = false;
        this._messageAudio.preload = 'auto';
        this._setupAudioUnlock();
        this._chatUserService.isReady.subscribe(z => {
            if (z) {
                this.startChatConnection();
            }
        });
    }
    startChatConnection() {
        this._signalRService.stopConnection();
        const target = 'ChatReceiveMessage';
        this._signalRService.startConnection(this._chatUserService.chatUser.userId);
        this._signalRService.addListener(target, (data) => {
            this.isNotify.next(data);
            this._playIncomingMessageSound(data);
        });
    }
    _setupAudioUnlock() {
        document.addEventListener('pointerdown', () => {
            if (this._audioUnlocked) {
                return;
            }
            this._messageAudio.muted = true;
            this._messageAudio.play()
                .then(() => {
                this._messageAudio.pause();
                this._messageAudio.currentTime = 0;
                this._messageAudio.muted = false;
                this._audioUnlocked = true;
            })
                .catch(() => {
                this._messageAudio.muted = false;
            });
        }, { once: true });
    }
    _playIncomingMessageSound(data) {
        if (!this._audioUnlocked || !data) {
            return;
        }
        if (this._chatUserService.chatUser?.useSound !== true) {
            return;
        }
        const currentUserId = this._chatUserService.chatUser?.id ?? this._chatUserService.chatUser?.userId;
        if (currentUserId && data.userId?.toString() === currentUserId.toString()) {
            return;
        }
        if (!this._messageAudio.paused && !this._messageAudio.ended) {
            return;
        }
        this._messageAudio.currentTime = 0;
        this._messageAudio.play().catch(() => undefined);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatNotificationService, deps: [{ token: SignalRService }, { token: SellanChatUsersService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatNotificationService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatNotificationService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: SignalRService }, { type: SellanChatUsersService }] });

class FilterCertPipe {
    transform(certificates, filter) {
        if (!certificates || !filter) {
            return certificates;
        }
        return certificates.filter(cert => {
            const fullName = `${cert.firstName} ${cert.lastName} ${cert.middleName}`.toLowerCase();
            const companyName = cert.organization.toLowerCase();
            const searchText = filter.toLowerCase();
            return fullName.indexOf(searchText) > -1 || companyName.indexOf(searchText) > -1;
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: FilterCertPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: FilterCertPipe, isStandalone: false, name: "filterCert", pure: false }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: FilterCertPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filterCert',
                    pure: false,
                    standalone: false
                }]
        }] });

class CertificateListComponent extends CoreAbstractComponent {
    set input(element) {
        if (element) {
            element.nativeElement.focus();
        }
    }
    constructor() {
        super();
        this.doubleClick = new EventEmitter();
        this.showCertificates = false;
        this.loaded = false;
        this.filterText = '';
        this.isShowSearch = false;
        this._cryptoProvider = window.CryptoProviderFactory.get();
        this._dataSourceClient = new Array();
    }
    ngOnInit() {
        this._selection = new SelectionModel(false, []);
        this._cryptoProvider.getCertCollection()
            .then((certificates) => {
            for (let i = 0; i < certificates.length; i++) {
                const cert = new Certificate(certificates[i]);
                if (!Utility.isEmpty(cert.inn)) {
                    this._dataSourceClient.push(cert);
                }
            }
            // если сертификат один у пользователя, то сразу помечаем как текущую и выделяем
            if (this._dataSourceClient.length == 1) {
                this._selection.select(this._dataSourceClient[0]);
            }
            else {
                this._dataSourceClient.sort(this.sortBySubject);
            }
            const schema = new GridConfiguration();
            schema.paginator.pageSize = certificates.length;
            // this._dataSource = new ClientSideDataSource(schema);
            // this._dataSource.loadDataSourceItems(this._dataSourceClient);
            this.showCertificates = true;
            this.loaded = true;
        }).catch(_ => {
            this.showCertificates = false;
            this.loaded = true;
        });
    }
    simpleClickEmit(row) {
        this._selection.toggle(row);
    }
    doubleClickEmit(row) {
        this.doubleClick.emit(row);
    }
    checkInput() {
        if (this.filterText.trim() === '') {
            this.filterText = '';
        }
    }
    clearInput() {
        this.filterText = '';
    }
    sortBySubject(a, b) {
        const aName = a.person.toLowerCase();
        const bName = b.person.toLowerCase();
        return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CertificateListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CertificateListComponent, isStandalone: false, selector: "core-certificate-sign-list", outputs: { doubleClick: "doubleClick" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["focus"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-core-certificate-list\">\n  @if (loaded && showCertificates) {\n    <div>\n      <div class=\"sln-input-container\">\n        @if (isShowSearch) {\n          <input #focus type=\"text\" [(ngModel)]=\"filterText\" (input)=\"checkInput()\" placeholder=\"\u041F\u043E\u0438\u0441\u043A\" class=\"search-input\" />\n        }\n        @if (filterText) {\n          <button class=\"sln-clear-btn\" (click)=\"clearInput()\">\n            <div class=\"sln-common-cross-table\" alt=\"delete-search\"></div>\n          </button>\n        }\n      </div>\n      <div class=\"sln-scroll\">\n        @for (row of  _dataSourceClient | filterCert: filterText; track row) {\n          <div class=\"sln-select-sertificate-wrap\" [ngClass]=\"{'highlight': _selection.isSelected(row)}\" (click)=\"simpleClickEmit(row)\" (dblclick)=\"doubleClickEmit(row)\">\n            <div class=\"sln-select-sertificate\">\n              <div class=\"col-md-7 sln-section-left\">\n                @if (row.isOrganization) {\n                  <div class=\"sln-certificate-list-person\">\n                    <div class=\"sln-info-organ\">\n                      <div class=\"sln-common-legal\"></div>\n                      <span class=\"sln-row-person\">{{ row.person }}</span>\n                    </div>\n                    <div class=\"sln-info-text\">\n                      <span class=\"sln-row-organization\">{{ row.organization }}</span>\n                      <p class=\"inn\"> \u0418\u041D\u041D:{{ row.inn }}</p>\n                    </div>\n                  </div>\n                }\n                @if (!row.isOrganization) {\n                  <div class=\"sln-certificate-list-person\">\n                    <div class=\"sln-info-organ\">\n                      <div class=\"sln-common-individuals\"></div>\n                      <span class=\"sln-row-person\">{{ row.person }}</span>\n                    </div>\n                    <div class=\"sln-info-text individuals\">\n                      <p class=\"snils\"> \u0421\u041D\u0418\u041B\u0421:{{ row.snils}}</p>\n                      <p class=\"inn\"> \u0418\u041D\u041D:{{ row.inn }}</p>\n                    </div>\n                  </div>\n                }\n              </div>\n              <div class=\"col-md-6 sln-section-right\">\n                @if (row.enabled === false) {\n                  <span class=\"sln-cert-enabled\">\n                    <div class=\"sln-control-mistake\"></div>\n                    {{ row.displayValidDate }}\n                  </span>\n                }\n                @if (!row.enabled === false) {\n                  <span class=\"sln-cert-not-enabled\">{{ row.displayValidDate }}</span>\n                }\n                <span class=\"sln-certificate-list-issuer\">\u0423\u0426: {{ row.issuer }}</span>\n              </div>\n            </div>\n          </div>\n        }\n        @if ((_dataSourceClient | filterCert: filterText).length === 0) {\n          <div class=\"sln-not-found\">\n            <small>\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E. </small>\n          </div>\n        }\n      </div>\n    </div>\n  }\n  @if (loaded && !showCertificates) {\n    <div>\n      <div class=\"certicates-wrap\">\n        <span>\u0421\u0438\u0441\u0442\u0435\u043C\u0430 \u043D\u0435 \u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u0435\u0442 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0443\u044E \u043F\u043E\u0434\u043F\u0438\u0441\u044C. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043C\u044B \u043F\u043E\u043C\u043E\u0436\u0435\u043C \u0440\u0435\u0448\u0438\u0442\u044C \u044D\u0442\u0443 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0443.</span>\n        <ul class=\"certicates-item\">\n          <li class=\"certicates-items\">\u0412\u0430\u0448\u0430 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0434\u043F\u0438\u0441\u044C \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u043A\u0432\u0430\u043B\u0438\u0444\u0438\u0446\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u0439. \u041A\u042D\u041F \u043C\u043E\u0436\u043D\u043E <a href=\"https://www.nalog.gov.ru/rn77/related_activities/ucfns/el_sign_getting/\" target=\"_blank\">\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0432 \u0424\u041D\u0421</a>  \u0438\u043B\u0438 \u0432 \u043E\u0434\u043D\u043E\u043C \u0438\u0437 \u0430\u043A\u043A\u0440\u0435\u0434\u0438\u0442\u043E\u0432\u0430\u043D\u043D\u044B\u0445 <a href=\"https://digital.gov.ru/ru/activity/govservices/2/\"  target=\"_blank\">\u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0445 \u0446\u0435\u043D\u0442\u0440\u043E\u0432.</a> </li>\n          <li class=\"certicates-items\">\u0418\u043D\u043E\u0433\u0434\u0430 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430 \u0441 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u044C\u044E \u0432\u043E\u0437\u043D\u0438\u043A\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 Google Chrome. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043E \u044D\u0442\u043E \u043F\u043E\u043C\u043E\u0433\u0430\u0435\u0442.</li>\n          <li class=\"certicates-items\">\u0415\u0441\u043B\u0438 \u043D\u0435\u0442, \u043D\u0430\u0439\u0434\u0438\u0442\u0435 \u0442\u0440\u0438 \u0442\u043E\u0447\u043A\u0438 \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u043C \u043F\u0440\u0430\u0432\u043E\u043C \u0443\u0433\u043B\u0443 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u2013 \u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u2013 \u0441\u043B\u0435\u0432\u0430 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043B \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 CryptoPro Extension for CAdES Browser Plug-in. \u0415\u0441\u043B\u0438 \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C \u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D \u2013 \u0432\u043A\u043B\u044E\u0447\u0438\u0442\u0435. \u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440. \u0415\u0441\u043B\u0438 \u0442\u0430\u043A\u043E\u0433\u043E \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F \u0443 \u0432\u0430\u0441 \u043D\u0435\u0442, \u043F\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 <a href=\"https://chrome.google.com/webstore/unsupported/iifchhfnnmpdbibifmljnfjhpififfog?hl=ru\"  target=\"_blank\">\u041C\u0430\u0433\u0430\u0437\u0438\u043D \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0439</a> \u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0435\u0433\u043E. \u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440. </li>\n          <li class=\"certicates-items\">\u0412\u0441\u0451 \u0441\u0434\u0435\u043B\u0430\u043D\u043E, \u043D\u043E \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442? <a href=\"https://cryptopro.ru/sites/default/files/products/cades/demopage/cades_bes_sample.html\">\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0443\u044E \u043F\u043E\u0434\u043F\u0438\u0441\u044C</a> \u2013 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u0438 \u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C\u043E\u0441\u0442\u044C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0445 \u0443\u0442\u0438\u043B\u0438\u0442, \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0445 \u0434\u043B\u044F \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0439 \u0440\u0430\u0431\u043E\u0442\u044B \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u0438 \u043D\u0430 \u0432\u0430\u0448\u0435\u043C \u041F\u041A. \u041E\u043D \u043F\u043E\u043A\u0430\u0436\u0435\u0442, \u0435\u0441\u043B\u0438 \u043F\u043E \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u0430\u043C \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432. \u0412\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u0435\u0433\u043E \u0440\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0430\u0446\u0438\u0438 \u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.</li>\n          <li class=\"certicates-items\">\u0415\u0441\u043B\u0438 \u0432\u044B \u0434\u043E\u0448\u043B\u0438 \u0434\u043E \u044D\u0442\u043E\u0433\u043E \u043F\u0443\u043D\u043A\u0442\u0430, \u043D\u043E \u043D\u0438\u0447\u0435\u0433\u043E \u0435\u0449\u0435 \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u0439\u0442\u0438 \u0441 \u044D\u0442\u043E\u0439 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u044C\u044E \u0441 \u0434\u0440\u0443\u0433\u043E\u0433\u043E \u041F\u041A. \u0412 \u0441\u043B\u0443\u0447\u0430\u0435 \u043F\u043E\u0432\u0442\u043E\u0440\u0435\u043D\u0438\u044F \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u044B \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u0432 \u0432\u0430\u0448 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0439 \u0446\u0435\u043D\u0442\u0440 \u2013 \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0437\u0430\u043C\u0435\u043D\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u0438.</li>\n        </ul>\n      </div>\n    </div>\n  }\n</div>\n", styles: ["table{padding:0}.sln-sert-invalid{display:flex;align-items:center;justify-content:flex-end}.sln-sert-invalid img{margin-right:10px}.sln-sert-invalid span{color:var(--DANGER)}.sln-not-found small{font-size:13px;font-family:var(--font-medium);color:var(--DARK-GREY)}.sln-control-mistake{margin-right:5px}ng-scrollbar{--scrollbar-padding: 0px;--scrollbar-size: 5px !important;--scrollbar-hover-size: 5px !important}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: FilterCertPipe, name: "filterCert" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CertificateListComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-certificate-sign-list', standalone: false, template: "<div class=\"sln-core-certificate-list\">\n  @if (loaded && showCertificates) {\n    <div>\n      <div class=\"sln-input-container\">\n        @if (isShowSearch) {\n          <input #focus type=\"text\" [(ngModel)]=\"filterText\" (input)=\"checkInput()\" placeholder=\"\u041F\u043E\u0438\u0441\u043A\" class=\"search-input\" />\n        }\n        @if (filterText) {\n          <button class=\"sln-clear-btn\" (click)=\"clearInput()\">\n            <div class=\"sln-common-cross-table\" alt=\"delete-search\"></div>\n          </button>\n        }\n      </div>\n      <div class=\"sln-scroll\">\n        @for (row of  _dataSourceClient | filterCert: filterText; track row) {\n          <div class=\"sln-select-sertificate-wrap\" [ngClass]=\"{'highlight': _selection.isSelected(row)}\" (click)=\"simpleClickEmit(row)\" (dblclick)=\"doubleClickEmit(row)\">\n            <div class=\"sln-select-sertificate\">\n              <div class=\"col-md-7 sln-section-left\">\n                @if (row.isOrganization) {\n                  <div class=\"sln-certificate-list-person\">\n                    <div class=\"sln-info-organ\">\n                      <div class=\"sln-common-legal\"></div>\n                      <span class=\"sln-row-person\">{{ row.person }}</span>\n                    </div>\n                    <div class=\"sln-info-text\">\n                      <span class=\"sln-row-organization\">{{ row.organization }}</span>\n                      <p class=\"inn\"> \u0418\u041D\u041D:{{ row.inn }}</p>\n                    </div>\n                  </div>\n                }\n                @if (!row.isOrganization) {\n                  <div class=\"sln-certificate-list-person\">\n                    <div class=\"sln-info-organ\">\n                      <div class=\"sln-common-individuals\"></div>\n                      <span class=\"sln-row-person\">{{ row.person }}</span>\n                    </div>\n                    <div class=\"sln-info-text individuals\">\n                      <p class=\"snils\"> \u0421\u041D\u0418\u041B\u0421:{{ row.snils}}</p>\n                      <p class=\"inn\"> \u0418\u041D\u041D:{{ row.inn }}</p>\n                    </div>\n                  </div>\n                }\n              </div>\n              <div class=\"col-md-6 sln-section-right\">\n                @if (row.enabled === false) {\n                  <span class=\"sln-cert-enabled\">\n                    <div class=\"sln-control-mistake\"></div>\n                    {{ row.displayValidDate }}\n                  </span>\n                }\n                @if (!row.enabled === false) {\n                  <span class=\"sln-cert-not-enabled\">{{ row.displayValidDate }}</span>\n                }\n                <span class=\"sln-certificate-list-issuer\">\u0423\u0426: {{ row.issuer }}</span>\n              </div>\n            </div>\n          </div>\n        }\n        @if ((_dataSourceClient | filterCert: filterText).length === 0) {\n          <div class=\"sln-not-found\">\n            <small>\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E. </small>\n          </div>\n        }\n      </div>\n    </div>\n  }\n  @if (loaded && !showCertificates) {\n    <div>\n      <div class=\"certicates-wrap\">\n        <span>\u0421\u0438\u0441\u0442\u0435\u043C\u0430 \u043D\u0435 \u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u0435\u0442 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0443\u044E \u043F\u043E\u0434\u043F\u0438\u0441\u044C. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043C\u044B \u043F\u043E\u043C\u043E\u0436\u0435\u043C \u0440\u0435\u0448\u0438\u0442\u044C \u044D\u0442\u0443 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0443.</span>\n        <ul class=\"certicates-item\">\n          <li class=\"certicates-items\">\u0412\u0430\u0448\u0430 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0434\u043F\u0438\u0441\u044C \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u043A\u0432\u0430\u043B\u0438\u0444\u0438\u0446\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u0439. \u041A\u042D\u041F \u043C\u043E\u0436\u043D\u043E <a href=\"https://www.nalog.gov.ru/rn77/related_activities/ucfns/el_sign_getting/\" target=\"_blank\">\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0432 \u0424\u041D\u0421</a>  \u0438\u043B\u0438 \u0432 \u043E\u0434\u043D\u043E\u043C \u0438\u0437 \u0430\u043A\u043A\u0440\u0435\u0434\u0438\u0442\u043E\u0432\u0430\u043D\u043D\u044B\u0445 <a href=\"https://digital.gov.ru/ru/activity/govservices/2/\"  target=\"_blank\">\u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0445 \u0446\u0435\u043D\u0442\u0440\u043E\u0432.</a> </li>\n          <li class=\"certicates-items\">\u0418\u043D\u043E\u0433\u0434\u0430 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430 \u0441 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u044C\u044E \u0432\u043E\u0437\u043D\u0438\u043A\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 Google Chrome. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043E \u044D\u0442\u043E \u043F\u043E\u043C\u043E\u0433\u0430\u0435\u0442.</li>\n          <li class=\"certicates-items\">\u0415\u0441\u043B\u0438 \u043D\u0435\u0442, \u043D\u0430\u0439\u0434\u0438\u0442\u0435 \u0442\u0440\u0438 \u0442\u043E\u0447\u043A\u0438 \u0432 \u0432\u0435\u0440\u0445\u043D\u0435\u043C \u043F\u0440\u0430\u0432\u043E\u043C \u0443\u0433\u043B\u0443 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u2013 \u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u2013 \u0441\u043B\u0435\u0432\u0430 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043B \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0435 CryptoPro Extension for CAdES Browser Plug-in. \u0415\u0441\u043B\u0438 \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C \u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D \u2013 \u0432\u043A\u043B\u044E\u0447\u0438\u0442\u0435. \u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440. \u0415\u0441\u043B\u0438 \u0442\u0430\u043A\u043E\u0433\u043E \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F \u0443 \u0432\u0430\u0441 \u043D\u0435\u0442, \u043F\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 <a href=\"https://chrome.google.com/webstore/unsupported/iifchhfnnmpdbibifmljnfjhpififfog?hl=ru\"  target=\"_blank\">\u041C\u0430\u0433\u0430\u0437\u0438\u043D \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u0439</a> \u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0435\u0433\u043E. \u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440. </li>\n          <li class=\"certicates-items\">\u0412\u0441\u0451 \u0441\u0434\u0435\u043B\u0430\u043D\u043E, \u043D\u043E \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442? <a href=\"https://cryptopro.ru/sites/default/files/products/cades/demopage/cades_bes_sample.html\">\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0443\u044E \u043F\u043E\u0434\u043F\u0438\u0441\u044C</a> \u2013 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u0438 \u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C\u043E\u0441\u0442\u044C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0445 \u0443\u0442\u0438\u043B\u0438\u0442, \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0445 \u0434\u043B\u044F \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0439 \u0440\u0430\u0431\u043E\u0442\u044B \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u0438 \u043D\u0430 \u0432\u0430\u0448\u0435\u043C \u041F\u041A. \u041E\u043D \u043F\u043E\u043A\u0430\u0436\u0435\u0442, \u0435\u0441\u043B\u0438 \u043F\u043E \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u0430\u043C \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432. \u0412\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u0435\u0433\u043E \u0440\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0430\u0446\u0438\u0438 \u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.</li>\n          <li class=\"certicates-items\">\u0415\u0441\u043B\u0438 \u0432\u044B \u0434\u043E\u0448\u043B\u0438 \u0434\u043E \u044D\u0442\u043E\u0433\u043E \u043F\u0443\u043D\u043A\u0442\u0430, \u043D\u043E \u043D\u0438\u0447\u0435\u0433\u043E \u0435\u0449\u0435 \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u0439\u0442\u0438 \u0441 \u044D\u0442\u043E\u0439 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u044C\u044E \u0441 \u0434\u0440\u0443\u0433\u043E\u0433\u043E \u041F\u041A. \u0412 \u0441\u043B\u0443\u0447\u0430\u0435 \u043F\u043E\u0432\u0442\u043E\u0440\u0435\u043D\u0438\u044F \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u044B \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u0432 \u0432\u0430\u0448 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0439 \u0446\u0435\u043D\u0442\u0440 \u2013 \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u0437\u0430\u043C\u0435\u043D\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430 \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0434\u043F\u0438\u0441\u0438.</li>\n        </ul>\n      </div>\n    </div>\n  }\n</div>\n", styles: ["table{padding:0}.sln-sert-invalid{display:flex;align-items:center;justify-content:flex-end}.sln-sert-invalid img{margin-right:10px}.sln-sert-invalid span{color:var(--DANGER)}.sln-not-found small{font-size:13px;font-family:var(--font-medium);color:var(--DARK-GREY)}.sln-control-mistake{margin-right:5px}ng-scrollbar{--scrollbar-padding: 0px;--scrollbar-size: 5px !important;--scrollbar-hover-size: 5px !important}\n"] }]
        }], ctorParameters: () => [], propDecorators: { doubleClick: [{
                type: Output
            }], input: [{
                type: ViewChild,
                args: ['focus', { static: false }]
            }] } });

class AttorneyService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    check(thumbprint) {
        const url = this._startUp.apiRoot('attorney/check?thumbprint=' + thumbprint, 'storage');
        return this._ajaxM.get({ url });
    }
    load(fileId, isMachineReadable, model) {
        const url = this._startUp.apiRoot('attorney/load/' + fileId + '?isMachineReadable=' + isMachineReadable, 'storage');
        return this._ajaxM.post({ url, data: model });
    }
    needAttorney(cert) {
        const url = this._startUp.apiRoot('attorney/need-attorney', 'storage');
        return this._ajaxM.post({ url, data: cert });
    }
    uploadFromFns(query) {
        const url = this._startUp.apiRoot('attorney/upload-from-fns', 'storage') + '?' + query;
        return this._ajaxM.get({ url: url });
    }
    getInfo(id) {
        const url = this._startUp.apiRoot('attorney/info/' + id, 'storage');
        return this._ajaxM.get({ url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AttorneyService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AttorneyService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AttorneyService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class UploaderConst {
    static { this.converFilter = {
        'docx': { needConvert: 1 },
        'doc': { needConvert: 1 },
        'xlsx': { needConvert: 1 },
        'xls': { needConvert: 1 },
        'pptx': { needConvert: 1 },
        'ppt': { needConvert: 1 },
        'pdf': { needConvert: 0 },
        'jpg': { needConvert: 0 },
        'jpeg': { needConvert: 0 },
        'png': { needConvert: 0 },
        'bmp': { needConvert: 0 }
    }; }
}

class FileViewerDialogWindow extends CoreAbstractComponent {
    get extensionCond() {
        return this.model.fileExtension?.toLowerCase() === 'pdf';
    }
    constructor(dialogRef, model) {
        super();
        this.dialogRef = dialogRef;
        this.model = model;
    }
    ngOnInit() {
        const file = (this.extensionCond ? true : this.model.isConvert)
            ? new Blob([this.model.data], { type: 'application/pdf' })
            : new Blob([this.model.data], { type: 'application/image' });
        this.url = URL.createObjectURL(file);
    }
    getURL() {
        return this.url;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: FileViewerDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: FileViewerDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\" [resizeble]=\"true\" [hasFooter]=\"false\" minWidth=\"860\">\n  <div body class=\"sln-doc-viewer\">\n    @if (model.isConvert || extensionCond) {\n      <iframe [src]='getURL() | safe' type=\"application/pdf\" frameBorder=\"0\" scrolling=\"auto\"></iframe>\n    } @else {\n      <img alt=\"image\" class=\"img-viewer\" [src]=\"getURL() | safe\" />\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-doc-viewer{min-height:500px;max-height:100%;position:relative;min-width:800px}.sln-doc-viewer iframe{width:100%;height:90vh;display:block}.sln-doc-viewer .img-viewer{max-width:100%;height:90vh;position:absolute}.modal-body{padding:0!important}\n"], dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "pipe", type: SafePipe, name: "safe" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: FileViewerDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\" [resizeble]=\"true\" [hasFooter]=\"false\" minWidth=\"860\">\n  <div body class=\"sln-doc-viewer\">\n    @if (model.isConvert || extensionCond) {\n      <iframe [src]='getURL() | safe' type=\"application/pdf\" frameBorder=\"0\" scrolling=\"auto\"></iframe>\n    } @else {\n      <img alt=\"image\" class=\"img-viewer\" [src]=\"getURL() | safe\" />\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-doc-viewer{min-height:500px;max-height:100%;position:relative;min-width:800px}.sln-doc-viewer iframe{width:100%;height:90vh;display:block}.sln-doc-viewer .img-viewer{max-width:100%;height:90vh;position:absolute}.modal-body{padding:0!important}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class CoreFileSignatureService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    loadFileSignatures(fileId) {
        const url = this._startUp.apiRoot('sign/signatures-info/' + fileId, 'storage');
        return this._ajaxM.get({ url: url });
    }
    saveAuthFile(upload) {
        const url = this._startUp.apiRoot('files', 'storage');
        return this._ajaxM.post({ url: url, data: upload });
    }
    addAuthFile(signId, fileId) {
        const url = this._startUp.apiRoot('sign/' + signId + '/authority-file/add/' + fileId, 'storage');
        return this._ajaxM.post({ url: url });
    }
    getSignerIpCountry(ip) {
        const url = this._startUp.apiRoot('whois/getcountry/?ip=' + ip, 'core');
        return this._ajaxM.get({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignatureService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignatureService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignatureService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class CoreAttorneyPowersDialogWindow {
    constructor(dialogRef, data) {
        this.dialogRef = dialogRef;
        this.powers = data?.powers ?? [];
        dialogRef.disableClose = false;
        dialogRef.backdropClick().subscribe(() => dialogRef.close());
    }
    onEsc() {
        this.dialogRef.close();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyPowersDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreAttorneyPowersDialogWindow, isStandalone: false, selector: "ng-component", host: { listeners: { "window:keydown.esc": "onEsc()" } }, ngImport: i0, template: "<core-dialog dialogTitle=\"\u0421\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043E \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F\u0445\" [hasCansel]=\"true\" canselText=\"X\" width=\"700\">\n  <div body>\n    <ng-scrollbar style=\"height: 60vh;\">\n      @if (powers && powers.length > 0) {\n        <table class=\"table table-hover sln-powers-table\">\n          <thead>\n            <tr>\n              <th>\u041A\u043E\u0434</th>\n              <th>\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F</th>\n            </tr>\n          </thead>\n          <tbody>\n            @for (power of powers; track power.code) {\n              <tr>\n                <td class=\"sln-powers-code\">{{ power.code ?? 'MANUAL' }}</td>\n                <td>{{ power.name }}</td>\n              </tr>\n            }\n          </tbody>\n        </table>\n      } @else {\n        <p class=\"sln-powers-empty\">\u0421\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043E \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F\u0445 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442.</p>\n      }\n    </ng-scrollbar>   \n  </div>\n</core-dialog>\n", dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyPowersDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0421\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043E \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F\u0445\" [hasCansel]=\"true\" canselText=\"X\" width=\"700\">\n  <div body>\n    <ng-scrollbar style=\"height: 60vh;\">\n      @if (powers && powers.length > 0) {\n        <table class=\"table table-hover sln-powers-table\">\n          <thead>\n            <tr>\n              <th>\u041A\u043E\u0434</th>\n              <th>\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F</th>\n            </tr>\n          </thead>\n          <tbody>\n            @for (power of powers; track power.code) {\n              <tr>\n                <td class=\"sln-powers-code\">{{ power.code ?? 'MANUAL' }}</td>\n                <td>{{ power.name }}</td>\n              </tr>\n            }\n          </tbody>\n        </table>\n      } @else {\n        <p class=\"sln-powers-empty\">\u0421\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043E \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F\u0445 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442.</p>\n      }\n    </ng-scrollbar>   \n  </div>\n</core-dialog>\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }], propDecorators: { onEsc: [{
                type: HostListener,
                args: ['window:keydown.esc']
            }] } });

class CoreFileSignaturesWindow extends CoreBaseDestroyComponent {
    get link() {
        return makeAttorneyLink(this.current.attorneyId, this.attroneyInfo.representatives?.[0], this.attroneyInfo.principalInn);
    }
    constructor(data, _popupM, _service, _startUp, _ajaxM, _attorneyService) {
        super();
        this.data = data;
        this._popupM = _popupM;
        this._service = _service;
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
        this._attorneyService = _attorneyService;
        this.atttorneys = {};
        this.fileId = data.fileId;
    }
    ngOnInit() {
        this._service.loadFileSignatures(this.fileId)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popupM.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.signatures = entity;
                if (this.signatures.length > 0) {
                    this.current = this.signatures[0];
                    if (this.current.attorneyId) {
                        this.loadAttorneyInfo();
                    }
                    this.downloadSignatureUrl = this.current.signUrl;
                    this.initAuthority();
                    this.needUploadFile = this.current.needUploadAuthFile;
                }
            }
        }));
    }
    download(url) {
        this._ajaxM.download({
            url: url
        });
    }
    viewSignature(selected) {
        this.current = selected;
        if (this.current.attorneyId) {
            this.loadAttorneyInfo();
        }
        else {
            this.attroneyInfo = null;
        }
        this.downloadSignatureUrl = this.current.signUrl;
        this.initAuthority();
        this.needUploadFile = this.current.needUploadAuthFile;
    }
    showCountryAlert(countryCode) {
        if (countryCode === undefined || countryCode === null)
            return false;
        const normalizedCountryCode = countryCode.replace(/[^a-zA-Z0-9]+/g, '');
        if (normalizedCountryCode === "RU" || normalizedCountryCode === '') {
            return false;
        }
        return true;
    }
    powersClick() {
        CoreDialog.window(CoreAttorneyPowersDialogWindow, { powers: this.attroneyInfo?.powers ?? [] });
    }
    loadAttorneyInfo() {
        if (this.atttorneys[this.current.attorneyId]) {
            this.attroneyInfo = this.atttorneys[this.current.attorneyId];
            return;
        }
        this._attorneyService.getInfo(this.current.attorneyId)
            .subscribe((response) => {
            this._popupM.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this.attroneyInfo = entity;
                    this.atttorneys[this.current.attorneyId] = entity;
                }
            });
        });
    }
    initAuthority() {
        switch (this.current.authority) {
            case AuthorityEnum.Ceo: {
                this.authority = "Единоличный исполнительный орган";
                break;
            }
            case AuthorityEnum.NotCeo: {
                this.authority = "Действует по доверенности";
                break;
            }
            case AuthorityEnum.Ip: {
                this.authority = "Индивидуальный предприниматель";
                break;
            }
        }
    }
    getAttorneyInfo() {
        let result = '';
        if (this.current.authority !== AuthorityEnum.NotCeo) {
            return result;
        }
        if (this.current.attorneyNumber) {
            result += '№ ' + this.current.attorneyNumber;
        }
        if (!Utility.isEmpty(this.current.attorneyDate)) {
            result += ' от ' + DateExtension.format(new Date(this.current.attorneyDate), 'DD.MM.YYYY');
        }
        return result;
    }
    getDownloadAttorneyUrl() {
        const url = this.current.attorneyId
            ? this._startUp.apiRoot('attorney/download/' + this.current.attorneyId, 'storage')
            : null;
        return url;
    }
    getMaxContentHeight() {
        return { height: 400 + 'px' };
    }
    get showAttorneyBlock() {
        return this.current?.authority === AuthorityEnum.NotCeo;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignaturesWindow, deps: [{ token: MAT_DIALOG_DATA }, { token: PopupResults }, { token: CoreFileSignatureService }, { token: Startup }, { token: AjaxService }, { token: AttorneyService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFileSignaturesWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog [leftMenu]=\"true\" [showTicketsVersions]=\"true\" [hasCansel]=\"false\" dialogTitle=\"\u041F\u043E\u0434\u043F\u0438\u0441\u0438 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\"  class=\"sln-dialog-file-signatures\">\n  <div ticketsVersionsMenu class=\"left-menu\">\n    <div class=\"file-signatures-left\">\n      <div class=\"header\">\n        <h4>\u0412\u0430\u0448\u0438 \u0410\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u043F\u043E\u0434\u043F\u0438\u0441\u0438</h4>\n      </div>\n      <ng-scrollbar [ngStyle]=\"getMaxContentHeight()\">\n        <ul class=\"nav nav-tabs\">\n          @for (signature of signatures; track signature; let i = $index) {\n            <li class=\"b-full-width {{ signature?.signId === current?.signId ? 'sln-selected-document-type' : ''}}\" tabindex=\"1\">\n              <a class=\"nav-link {{ signature?.signId === current?.signId ? 'b-current-document' : '' }}\" data-toggle=\"tab\" (click)=\"viewSignature(signature)\">\n                <span class=\"user-name\">{{ signature?.userName }}</span>\n                <small class=\"user-organization\">{{ signature?.organization }}</small>\n              </a>\n            </li>\n          }\n        </ul>\n      </ng-scrollbar>\n    </div>\n  </div>\n  <div body>\n    @if (current) {\n      <div class=\"row\">\n        <div class=\"file-right-info\">\n          <table class=\"table table-hover\">\n            <tbody>\n              <div class=\"table-item\">\n                <div class=\"sln-certificate-owner sln-certificate-owner-position back-img\"></div>\n                <tr class=\"f-items\">\n                  <td width=\"230px\" class=\"name-item\"><span class=\"items-header\">\u0432\u043B\u0430\u0434\u0435\u043B\u0435\u0446 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span></td>\n                  <td class=\"text-center\"><span class=\"items-text\">{{ current?.userName }}</span> </td>\n                </tr>\n                <tr class=\"s-items\">\n                  <div class=\"s-items-l\">\n                    <td class=\"name-item\"><span class=\"items-header\">\u041F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F:</span>\n                    @if (current?.hasUnstructuredPowers) {\n                      <span class=\" sln-badge-warning\" style=\"margin-left: 10px;\">\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0442\u0441\u044F \u043D\u0435\u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F</span>\n                    }\n                  </td>\n                  <td class=\"items-text\">\n                    <span class=\"sln-authority\">\n                      {{ authority }}&nbsp;\n                      <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0430\u0440\u0445\u0438\u0432\" matTooltipPosition=\"above\"   class=\"tooltip-uploader-document-download\">\n                        <a (click)=\"download(current?.attorneyPrintFormUrl)\"> {{getAttorneyInfo()}}&nbsp;</a>\n                        @if (current?.attorneyId) {\n                          <a class=\"btn\" target=\"_blank\" (click)=\"download(getDownloadAttorneyUrl())\">\n                            <div class=\"sln-uploader-document-download sln-uploader-document-position\"></div>\n                          </a>\n                        }\n                      </div>\n                    </span>\n                  </td>\n                </div>\n              </tr>\n            </div>\n            <!-- <div class=\"table-item\">\n            <div class=\"sln-file-name-signature sln-file-name-signature-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td class=\"name-item\"><span class=\"items-header\">\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0444\u0430\u0439\u043B\u0430:</span> </td>\n              <td class=\"items-text\">\n                <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\" matTooltipPosition=\"above\"  >\n                  <a (click)=\"download(current?.fileUrl)\">\n                    {{ current?.fileName }}\n                  </a>\n                </div>\n              </td>\n            </tr>\n            <tr class=\"s-items\">\n              <td class=\"name-item\"><span class=\"items-header-small\">\u0420\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430 - &nbsp;</span> </td>\n              <td class=\"items-header-small\">{{ current?.fileSize }}</td>\n            </tr>\n          </div> -->\n          @if (showAttorneyBlock && !attroneyInfo) {\n            <div class=\"no-attorney-item table-item\">\n              <span class=\"items-header\">\u041C\u0430\u0448\u0438\u043D\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u0430\u044F \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u044C:</span>\n              <span>\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442</span>\n            </div>\n          }\n          @if (showAttorneyBlock && attroneyInfo) {\n            <div class=\"table-item\">\n              <tr class=\"f-items\">\n                <td class=\"name-item\"><span class=\"items-header\">\u041C\u0430\u0448\u0438\u043D\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u0430\u044F \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u044C:</span> </td>\n                <td class=\"text-center\">                         \n                  {{attroneyInfo.persons[0].fioShort}} - {{attroneyInfo.principal.name}}\n                </td>\n                <td class=\"text-center\">\n                  <small>\n                    <a class=\"save-sert\" (click)=\"powersClick()\">\n                      \u0421\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043E \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F\u0445\n                    </a>\n                  </small>\n                </td>\n              </tr>\n              <tr class=\"s-items\">\n                <div class=\"s-items-l\">\n                  <td class=\"name-item\"><span class=\"items-header\">\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438</span> </td>\n                  <td class=\"name-item\"><span class=\"items-header\">\u0418\u041D\u041D \u0434\u043E\u0432\u0435\u0440\u0438\u0442\u0435\u043B\u044F</span> </td>\n                  <td class=\"name-item\"><span class=\"items-header\">\u0418\u041D\u041D \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F</span> </td>\n                  <td class=\"name-item\"><span class=\"items-header\">\u0421\u0440\u043E\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F</span> </td>\n                </div>\n                <div class=\"s-items-r-2\">\n                  <td class=\"items-text\"> \n                    <a href=\"{{ link }}\" target=\"_blank\" style=\"display: flex; gap: 5px;\">\n                      <span>{{current.attorneyId}}</span> \n                      <div class=\"sln-common-to-link\"></div>\n                    </a>  \n                  </td>\n                  <td class=\"items-text\"><span>{{attroneyInfo.principalInn}}</span></td>\n                  <td class=\"items-text\"><span>{{attroneyInfo.representatives[0]}}</span></td>\n                  <td class=\"time\">{{ attroneyInfo.dateFrom | dateTimeRu }} - {{ attroneyInfo.dateTo | dateTimeRu }}</td>\n                </div>\n              </tr>\n            </div>\n          }\n          <div class=\"table-item\">\n            <div class=\"sln-certificate-number sln-certificate-number-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td class=\"name-item\"><span class=\"items-header\">\u041D\u043E\u043C\u0435\u0440 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span> </td>\n              <td class=\"text-center\">\n                <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\" matTooltipPosition=\"above\"  >\n                  <a class=\"save-sert\" target=\"_blank\" [href]=\"current?.certificateUrl\">\n                    {{ current?.serialNumber }}\n                  </a>\n                </div>\n              </td>\n            </tr>\n            <tr class=\"s-items\">\n              <div class=\"s-items-l\">\n                <td class=\"name-item\"><span class=\"items-header\">\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D</span> </td>\n                <td class=\"date\">{{ current?.signingTime | dateTimeRu }}</td>\n              </div>\n              <div class=\"s-items-r-2\">\n                <td class=\"name-item\"><span class=\"items-header\">\u0421\u0440\u043E\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F</span> </td>\n                <td class=\"time\"> {{ current?.validFrom | dateTimeRu }} - {{ current?.validTo | dateTimeRu }}</td>\n              </div>\n            </tr>\n          </div>\n          <div class=\"table-item\">\n            <div class=\"sln-ip-address-signature sln-ip-address-signature-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td class=\"name-item\"><span class=\"items-header\">IP-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442\u0430:</span> </td>\n              <td class=\"items-text\" style=\"font-size: 13px;\" >{{ current?.signerIp ?? \"  -  \" }}</td>\n            </tr>\n            @if (showCountryAlert(current?.signerCountryCode)) {\n              <tr>\n                <td><p class=\"items-text-ip\">IP-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442\u0430 \u043D\u0435 \u043F\u0440\u0438\u043D\u0430\u0434\u043B\u0435\u0436\u0438\u0442 \u0442\u0435\u0440\u0440\u0438\u0442\u043E\u0440\u0438\u0438 \u0420\u0424.</p></td>\n              </tr>\n            }\n          </div>\n        </tbody>\n      </table>\n    </div>\n  </div>\n}\n\n</div>\n<div footer class=\"file-signatures-footer\">\n  <button class=\"btn-primary\">\n    <a  target=\"_blank\" [href]=\"downloadSignatureUrl\">\n      \u0421\u043A\u0430\u0447\u0430\u0442\u044C\n    </a>\n  </button>\n</div>\n</core-dialog>\n", styles: [".toggle-left-menu{width:auto;display:flex}.toggle-left-menu button{background:var(--WHITE);border-radius:4px 0 0 4px;cursor:pointer;padding:0 13px}.modal-header{width:100%}.b-full-width a{cursor:pointer;padding:10px 0}.sln-dialog-file-signatures .b-full-width:hover small{color:var(--DARK-GREY)}.sln-dialog-file-signatures .nav-tabs{width:100%}.sln-dialog-file-signatures .nav-link{display:block;padding-left:10px}.sln-dialog-file-signatures .sln-selected-document-type:focus{border-left:4px solid var(--PRIMARY);background-color:#fff}.sln-dialog-file-signatures .sln-selected-document-type:focus .nav-link{padding-left:6px}.sln-dialog-file-signatures .sln-selected-document-type:focus .nav-link span{color:var(--PRIMARY)}.sln-dialog-file-signatures .sln-selected-document-type:focus .nav-link small{color:var(--PRIMARY)}.sln-dialog-file-signatures .user-name{font-family:var(--font-medium);display:block;font-size:12px;text-transform:uppercase}.sln-dialog-file-signatures .user-organization{color:var(--DARK-GREY);font-family:var(--font);display:block;font-size:12px;text-transform:uppercase}.sln-selected-document-type{display:flex}.left-menu{height:100%;padding-top:25px;padding-bottom:15px;min-width:235px;max-width:300px;padding-right:0}.left-menu .header{width:90%;margin:0 auto}.left-menu .header h4{letter-spacing:.01em;text-transform:uppercase;font-size:12px;padding-bottom:10px}.file-right-info .table-item{background:var(--WHITE);border-radius:4px;min-height:58px;height:auto;display:flex;flex-direction:column;justify-content:space-evenly;padding:10px 30px;margin-bottom:10px;position:relative}.file-right-info .table-item .back-img{position:absolute;height:95%;right:8%;bottom:0;width:153px}.file-right-info .table-item .f-items{display:flex;flex-direction:column;justify-content:center}.file-right-info .table-item .s-items{display:flex;flex-direction:row;align-items:center}.file-right-info .table-item .s-items .s-items-l{display:flex;flex-direction:column;flex:1}.file-right-info .table-item .s-items .s-items-r-2{display:flex;flex-direction:column;margin-left:20px}.file-right-info .table-item .s-items .s-items-r{display:flex;align-items:flex-end;z-index:2}.file-right-info .table-item .s-items .s-items-r label{display:flex;cursor:pointer;color:var(--PRIMARY);align-items:flex-end}.file-right-info .table-item .s-items .s-items-r .add{margin-left:10px}.file-right-info .table-item .s-items .s-items-r span{font-family:var(--font-medium);font-size:15px}.file-right-info .table-item .s-items .date{color:var(--DARK-GREY);font-family:var(--font-medium);font-size:13px}.file-right-info .table-item .s-items .time{font-family:var(--font-medium);font-size:13px;color:var(--MIDLE-GRAY)}.file-right-info .table-item .items-header{letter-spacing:.02em;text-transform:uppercase;font-size:12px;font-family:var(--font-medium)}.file-right-info .table-item .items-header-small{letter-spacing:.02em;color:var(--GRAY);font-size:13px;font-family:var(--font)}.file-right-info .table-item .items-text{color:var(--DARK-GREY);font-family:var(--font-medium);padding:0!important;font-size:15px;max-width:500px}.file-right-info .table-item .items-text-ip{color:var(--DANGER);font-family:var(--font-medium);padding:0!important}.file-right-info .save-sert{border-bottom:1px solid}.sln-authority{display:flex}.sln-authority img{margin-left:8px;width:20px}.name-item{display:flex;align-items:center}.common-btn{color:var(--PRIMARY);text-transform:uppercase}table{width:100%}table tr{height:auto}td a{color:var(--PRIMARY)!important}.file-signatures-footer a{color:var(--WHITE)}.tooltip-uploader-document-download{display:flex}.items-powers{color:var(--GRAY);font-family:var(--font-medium);padding:0!important;font-size:13px;line-height:100%;margin-bottom:10px}.copy-text{cursor:pointer}.copy-text:hover{color:var(--PRIMARY)}.no-attorney-item{color:var(--DANGER)}\n"], dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "pipe", type: RuDateTimePipe, name: "dateTimeRu" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignaturesWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog [leftMenu]=\"true\" [showTicketsVersions]=\"true\" [hasCansel]=\"false\" dialogTitle=\"\u041F\u043E\u0434\u043F\u0438\u0441\u0438 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\"  class=\"sln-dialog-file-signatures\">\n  <div ticketsVersionsMenu class=\"left-menu\">\n    <div class=\"file-signatures-left\">\n      <div class=\"header\">\n        <h4>\u0412\u0430\u0448\u0438 \u0410\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u043F\u043E\u0434\u043F\u0438\u0441\u0438</h4>\n      </div>\n      <ng-scrollbar [ngStyle]=\"getMaxContentHeight()\">\n        <ul class=\"nav nav-tabs\">\n          @for (signature of signatures; track signature; let i = $index) {\n            <li class=\"b-full-width {{ signature?.signId === current?.signId ? 'sln-selected-document-type' : ''}}\" tabindex=\"1\">\n              <a class=\"nav-link {{ signature?.signId === current?.signId ? 'b-current-document' : '' }}\" data-toggle=\"tab\" (click)=\"viewSignature(signature)\">\n                <span class=\"user-name\">{{ signature?.userName }}</span>\n                <small class=\"user-organization\">{{ signature?.organization }}</small>\n              </a>\n            </li>\n          }\n        </ul>\n      </ng-scrollbar>\n    </div>\n  </div>\n  <div body>\n    @if (current) {\n      <div class=\"row\">\n        <div class=\"file-right-info\">\n          <table class=\"table table-hover\">\n            <tbody>\n              <div class=\"table-item\">\n                <div class=\"sln-certificate-owner sln-certificate-owner-position back-img\"></div>\n                <tr class=\"f-items\">\n                  <td width=\"230px\" class=\"name-item\"><span class=\"items-header\">\u0432\u043B\u0430\u0434\u0435\u043B\u0435\u0446 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span></td>\n                  <td class=\"text-center\"><span class=\"items-text\">{{ current?.userName }}</span> </td>\n                </tr>\n                <tr class=\"s-items\">\n                  <div class=\"s-items-l\">\n                    <td class=\"name-item\"><span class=\"items-header\">\u041F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F:</span>\n                    @if (current?.hasUnstructuredPowers) {\n                      <span class=\" sln-badge-warning\" style=\"margin-left: 10px;\">\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0442\u0441\u044F \u043D\u0435\u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F</span>\n                    }\n                  </td>\n                  <td class=\"items-text\">\n                    <span class=\"sln-authority\">\n                      {{ authority }}&nbsp;\n                      <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0430\u0440\u0445\u0438\u0432\" matTooltipPosition=\"above\"   class=\"tooltip-uploader-document-download\">\n                        <a (click)=\"download(current?.attorneyPrintFormUrl)\"> {{getAttorneyInfo()}}&nbsp;</a>\n                        @if (current?.attorneyId) {\n                          <a class=\"btn\" target=\"_blank\" (click)=\"download(getDownloadAttorneyUrl())\">\n                            <div class=\"sln-uploader-document-download sln-uploader-document-position\"></div>\n                          </a>\n                        }\n                      </div>\n                    </span>\n                  </td>\n                </div>\n              </tr>\n            </div>\n            <!-- <div class=\"table-item\">\n            <div class=\"sln-file-name-signature sln-file-name-signature-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td class=\"name-item\"><span class=\"items-header\">\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0444\u0430\u0439\u043B\u0430:</span> </td>\n              <td class=\"items-text\">\n                <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\" matTooltipPosition=\"above\"  >\n                  <a (click)=\"download(current?.fileUrl)\">\n                    {{ current?.fileName }}\n                  </a>\n                </div>\n              </td>\n            </tr>\n            <tr class=\"s-items\">\n              <td class=\"name-item\"><span class=\"items-header-small\">\u0420\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430 - &nbsp;</span> </td>\n              <td class=\"items-header-small\">{{ current?.fileSize }}</td>\n            </tr>\n          </div> -->\n          @if (showAttorneyBlock && !attroneyInfo) {\n            <div class=\"no-attorney-item table-item\">\n              <span class=\"items-header\">\u041C\u0430\u0448\u0438\u043D\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u0430\u044F \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u044C:</span>\n              <span>\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442</span>\n            </div>\n          }\n          @if (showAttorneyBlock && attroneyInfo) {\n            <div class=\"table-item\">\n              <tr class=\"f-items\">\n                <td class=\"name-item\"><span class=\"items-header\">\u041C\u0430\u0448\u0438\u043D\u043E\u0447\u0438\u0442\u0430\u0435\u043C\u0430\u044F \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u044C:</span> </td>\n                <td class=\"text-center\">                         \n                  {{attroneyInfo.persons[0].fioShort}} - {{attroneyInfo.principal.name}}\n                </td>\n                <td class=\"text-center\">\n                  <small>\n                    <a class=\"save-sert\" (click)=\"powersClick()\">\n                      \u0421\u0432\u0435\u0434\u0435\u043D\u0438\u044F \u043E \u043F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F\u0445\n                    </a>\n                  </small>\n                </td>\n              </tr>\n              <tr class=\"s-items\">\n                <div class=\"s-items-l\">\n                  <td class=\"name-item\"><span class=\"items-header\">\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438</span> </td>\n                  <td class=\"name-item\"><span class=\"items-header\">\u0418\u041D\u041D \u0434\u043E\u0432\u0435\u0440\u0438\u0442\u0435\u043B\u044F</span> </td>\n                  <td class=\"name-item\"><span class=\"items-header\">\u0418\u041D\u041D \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F</span> </td>\n                  <td class=\"name-item\"><span class=\"items-header\">\u0421\u0440\u043E\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F</span> </td>\n                </div>\n                <div class=\"s-items-r-2\">\n                  <td class=\"items-text\"> \n                    <a href=\"{{ link }}\" target=\"_blank\" style=\"display: flex; gap: 5px;\">\n                      <span>{{current.attorneyId}}</span> \n                      <div class=\"sln-common-to-link\"></div>\n                    </a>  \n                  </td>\n                  <td class=\"items-text\"><span>{{attroneyInfo.principalInn}}</span></td>\n                  <td class=\"items-text\"><span>{{attroneyInfo.representatives[0]}}</span></td>\n                  <td class=\"time\">{{ attroneyInfo.dateFrom | dateTimeRu }} - {{ attroneyInfo.dateTo | dateTimeRu }}</td>\n                </div>\n              </tr>\n            </div>\n          }\n          <div class=\"table-item\">\n            <div class=\"sln-certificate-number sln-certificate-number-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td class=\"name-item\"><span class=\"items-header\">\u041D\u043E\u043C\u0435\u0440 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span> </td>\n              <td class=\"text-center\">\n                <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\" matTooltipPosition=\"above\"  >\n                  <a class=\"save-sert\" target=\"_blank\" [href]=\"current?.certificateUrl\">\n                    {{ current?.serialNumber }}\n                  </a>\n                </div>\n              </td>\n            </tr>\n            <tr class=\"s-items\">\n              <div class=\"s-items-l\">\n                <td class=\"name-item\"><span class=\"items-header\">\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D</span> </td>\n                <td class=\"date\">{{ current?.signingTime | dateTimeRu }}</td>\n              </div>\n              <div class=\"s-items-r-2\">\n                <td class=\"name-item\"><span class=\"items-header\">\u0421\u0440\u043E\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F</span> </td>\n                <td class=\"time\"> {{ current?.validFrom | dateTimeRu }} - {{ current?.validTo | dateTimeRu }}</td>\n              </div>\n            </tr>\n          </div>\n          <div class=\"table-item\">\n            <div class=\"sln-ip-address-signature sln-ip-address-signature-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td class=\"name-item\"><span class=\"items-header\">IP-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442\u0430:</span> </td>\n              <td class=\"items-text\" style=\"font-size: 13px;\" >{{ current?.signerIp ?? \"  -  \" }}</td>\n            </tr>\n            @if (showCountryAlert(current?.signerCountryCode)) {\n              <tr>\n                <td><p class=\"items-text-ip\">IP-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442\u0430 \u043D\u0435 \u043F\u0440\u0438\u043D\u0430\u0434\u043B\u0435\u0436\u0438\u0442 \u0442\u0435\u0440\u0440\u0438\u0442\u043E\u0440\u0438\u0438 \u0420\u0424.</p></td>\n              </tr>\n            }\n          </div>\n        </tbody>\n      </table>\n    </div>\n  </div>\n}\n\n</div>\n<div footer class=\"file-signatures-footer\">\n  <button class=\"btn-primary\">\n    <a  target=\"_blank\" [href]=\"downloadSignatureUrl\">\n      \u0421\u043A\u0430\u0447\u0430\u0442\u044C\n    </a>\n  </button>\n</div>\n</core-dialog>\n", styles: [".toggle-left-menu{width:auto;display:flex}.toggle-left-menu button{background:var(--WHITE);border-radius:4px 0 0 4px;cursor:pointer;padding:0 13px}.modal-header{width:100%}.b-full-width a{cursor:pointer;padding:10px 0}.sln-dialog-file-signatures .b-full-width:hover small{color:var(--DARK-GREY)}.sln-dialog-file-signatures .nav-tabs{width:100%}.sln-dialog-file-signatures .nav-link{display:block;padding-left:10px}.sln-dialog-file-signatures .sln-selected-document-type:focus{border-left:4px solid var(--PRIMARY);background-color:#fff}.sln-dialog-file-signatures .sln-selected-document-type:focus .nav-link{padding-left:6px}.sln-dialog-file-signatures .sln-selected-document-type:focus .nav-link span{color:var(--PRIMARY)}.sln-dialog-file-signatures .sln-selected-document-type:focus .nav-link small{color:var(--PRIMARY)}.sln-dialog-file-signatures .user-name{font-family:var(--font-medium);display:block;font-size:12px;text-transform:uppercase}.sln-dialog-file-signatures .user-organization{color:var(--DARK-GREY);font-family:var(--font);display:block;font-size:12px;text-transform:uppercase}.sln-selected-document-type{display:flex}.left-menu{height:100%;padding-top:25px;padding-bottom:15px;min-width:235px;max-width:300px;padding-right:0}.left-menu .header{width:90%;margin:0 auto}.left-menu .header h4{letter-spacing:.01em;text-transform:uppercase;font-size:12px;padding-bottom:10px}.file-right-info .table-item{background:var(--WHITE);border-radius:4px;min-height:58px;height:auto;display:flex;flex-direction:column;justify-content:space-evenly;padding:10px 30px;margin-bottom:10px;position:relative}.file-right-info .table-item .back-img{position:absolute;height:95%;right:8%;bottom:0;width:153px}.file-right-info .table-item .f-items{display:flex;flex-direction:column;justify-content:center}.file-right-info .table-item .s-items{display:flex;flex-direction:row;align-items:center}.file-right-info .table-item .s-items .s-items-l{display:flex;flex-direction:column;flex:1}.file-right-info .table-item .s-items .s-items-r-2{display:flex;flex-direction:column;margin-left:20px}.file-right-info .table-item .s-items .s-items-r{display:flex;align-items:flex-end;z-index:2}.file-right-info .table-item .s-items .s-items-r label{display:flex;cursor:pointer;color:var(--PRIMARY);align-items:flex-end}.file-right-info .table-item .s-items .s-items-r .add{margin-left:10px}.file-right-info .table-item .s-items .s-items-r span{font-family:var(--font-medium);font-size:15px}.file-right-info .table-item .s-items .date{color:var(--DARK-GREY);font-family:var(--font-medium);font-size:13px}.file-right-info .table-item .s-items .time{font-family:var(--font-medium);font-size:13px;color:var(--MIDLE-GRAY)}.file-right-info .table-item .items-header{letter-spacing:.02em;text-transform:uppercase;font-size:12px;font-family:var(--font-medium)}.file-right-info .table-item .items-header-small{letter-spacing:.02em;color:var(--GRAY);font-size:13px;font-family:var(--font)}.file-right-info .table-item .items-text{color:var(--DARK-GREY);font-family:var(--font-medium);padding:0!important;font-size:15px;max-width:500px}.file-right-info .table-item .items-text-ip{color:var(--DANGER);font-family:var(--font-medium);padding:0!important}.file-right-info .save-sert{border-bottom:1px solid}.sln-authority{display:flex}.sln-authority img{margin-left:8px;width:20px}.name-item{display:flex;align-items:center}.common-btn{color:var(--PRIMARY);text-transform:uppercase}table{width:100%}table tr{height:auto}td a{color:var(--PRIMARY)!important}.file-signatures-footer a{color:var(--WHITE)}.tooltip-uploader-document-download{display:flex}.items-powers{color:var(--GRAY);font-family:var(--font-medium);padding:0!important;font-size:13px;line-height:100%;margin-bottom:10px}.copy-text{cursor:pointer}.copy-text:hover{color:var(--PRIMARY)}.no-attorney-item{color:var(--DANGER)}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: PopupResults }, { type: CoreFileSignatureService }, { type: Startup }, { type: AjaxService }, { type: AttorneyService }] });

class CoreFileAttributesService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    loadFileAttributes(fileId) {
        const url = this._startUp.apiRoot('file-attributes/' + fileId, 'storage');
        return this._ajaxM.get({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class CoreFileAttributesWindow extends CoreBaseDestroyComponent {
    constructor(data, _service, _popup) {
        super();
        this.data = data;
        this._service = _service;
        this._popup = _popup;
        this.fileId = data.fileId;
    }
    ngOnInit() {
        this._service.loadFileAttributes(this.fileId)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.attributes = entity;
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesWindow, deps: [{ token: MAT_DIALOG_DATA }, { token: CoreFileAttributesService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFileAttributesWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog [hasCansel]=\"false\" dialogTitle=\"\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044B \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\" width=\"500\">\n  <div body>\n    @if (attributes?.length === 0) {\n      <div class=\"sln-alert sln-alert-warning sln-file-attribute-empty\">\n        \u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044B \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442\n      </div>\n    }\n    @if (attributes?.length > 0) {\n      <div>\n        @for (attribute of attributes; track attribute) {\n          <div class=\"row\">\n            <div class=\"col-md-6\">\n              <span>{{ attribute.attributeType }}</span>\n            </div>\n            @switch (attribute.attributeCode) {\n              @case ('LifeSpan') {\n                <div  class=\"col-md-6\">\n                  <span>{{ attribute.value | dateTimeRu }}</span>\n                </div>\n              }\n              @default {\n                <div class=\"col-md-6\">\n                  <span>{{ attribute.value }}</span>\n                </div>\n              }\n            }\n          </div>\n        }\n      </div>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-file-attribute-empty{text-align:center}.col-md-6{padding:0}.col-md-6 span{font-family:var(--font-medium);color:var(--DARK-GREY)}\n"], dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "pipe", type: RuDateTimePipe, name: "dateTimeRu" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog [hasCansel]=\"false\" dialogTitle=\"\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044B \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\" width=\"500\">\n  <div body>\n    @if (attributes?.length === 0) {\n      <div class=\"sln-alert sln-alert-warning sln-file-attribute-empty\">\n        \u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044B \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442\n      </div>\n    }\n    @if (attributes?.length > 0) {\n      <div>\n        @for (attribute of attributes; track attribute) {\n          <div class=\"row\">\n            <div class=\"col-md-6\">\n              <span>{{ attribute.attributeType }}</span>\n            </div>\n            @switch (attribute.attributeCode) {\n              @case ('LifeSpan') {\n                <div  class=\"col-md-6\">\n                  <span>{{ attribute.value | dateTimeRu }}</span>\n                </div>\n              }\n              @default {\n                <div class=\"col-md-6\">\n                  <span>{{ attribute.value }}</span>\n                </div>\n              }\n            }\n          </div>\n        }\n      </div>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-file-attribute-empty{text-align:center}.col-md-6{padding:0}.col-md-6 span{font-family:var(--font-medium);color:var(--DARK-GREY)}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: CoreFileAttributesService }, { type: PopupResults }] });

class CoreFileAttributesModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesModule, declarations: [CoreFileAttributesWindow], imports: [CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreBaseModule,
            CorePipeModule], exports: [CoreFileAttributesWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesModule, providers: [
            CoreFileAttributesService
        ], imports: [CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreBaseModule,
            CorePipeModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileAttributesModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreFileAttributesWindow
                    ],
                    imports: [
                        CoreMatModule,
                        CoreDialogModule,
                        CorePipeModule,
                        CoreBaseModule,
                        CorePipeModule
                    ],
                    providers: [
                        CoreFileAttributesService
                    ],
                    exports: [
                        CoreFileAttributesWindow,
                    ]
                }]
        }] });

class CoreFileUploaderComponent extends CoreBaseDestroyComponent {
    // accessor to data
    get value() {
        if (this.dataSource.length === 1) {
            return this.dataSource[0];
        }
        return this.dataSource;
    }
    set value(v) {
        if (!Utility.isEmpty(v) && (v instanceof Array) && !ArrayExtension.isEquals(this.dataSource, v)) {
            this.dataSource = new Array();
            v.forEach(file => {
                this.dataSource.push(file);
            });
            this.onChange(this.dataSource);
            this.valueChange.emit(this.dataSource);
        }
    }
    get isRequiredSign() {
        return this.config.signConfig ? this.config.signConfig.isRequired : false;
    }
    constructor(_startUp, _ajaxM, _popupM, _context) {
        super();
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
        this._popupM = _popupM;
        this._context = _context;
        this.hideAttributes = false;
        this.hideLoading = true;
        this.loadedDocument = false;
        this.dataSource = [];
        this.valueChange = new EventEmitter();
        this.autogenerateClick = new EventEmitter();
        this.filesLoaded = new EventEmitter();
        this.onTouched = (_) => { };
        this.onChange = (_) => { };
    }
    itCanViewed(val) {
        const fileSplit = val.fileName.split('.');
        const fileExtension = fileSplit[fileSplit.length - 1];
        return !this.config.hideViewBtn && !!UploaderConst.converFilter[fileExtension.toLocaleLowerCase()];
    }
    ngOnInit() {
        if (!this.config) {
            throw Error('\'config\' is empty');
        }
        this.hideAttributes = !this._context.isSystem();
        this.elementId = this.elementId ?? this.config.typeId?.toString() ?? Guid.newGuid().toString();
        if (!this.dataSource) {
            this.dataSource = new Array();
        }
    }
    ngAfterViewInit() {
        setTimeout(() => {
            if (this.dataSource && this.config.files && this.config.files.length > 0) {
                this.config.files.forEach(file => {
                    this.dataSource.push(file);
                });
            }
            if (this.needUpload && this.config.isReadOnly !== true && this.config.isAchiveFile === true) {
                if (Utility.isEmpty(this.config.files) || this.config.files.length === 0) {
                    // если файлов нет, то загружаем из архива
                    this.uploadFromArchive();
                }
            }
        });
    }
    onChangeInput(e, config) {
        config = config ?? this.config;
        if (e.target.files) {
            this._handleFiles(e.target.files, config);
        }
    }
    onChangeSignature(e, config, item) {
        console.log('Выполнено событие onChangeSignature');
        if (!!config && !!item) {
            const callback = config.callback;
            config.url = Utility.isEmpty(config.url)
                ? this._startUp.apiRoot('sign/attach-directly/' + item.fileId, 'storage')
                : config.url;
            config.callback = (entity, uploader) => {
                item.hasSingatures = true;
                if (callback) {
                    callback(entity, uploader);
                }
            };
            this.onChangeInput(e, config);
        }
    }
    uploadFromArchive() {
        this.hideLoading = false;
        const isnew = this.config.isAchiveFileNew === true ? '?isNew=true' : '';
        const url = Utility.isEmpty(this.config.achiveFileMultiId)
            ? this._startUp.apiRoot('archives/current/' + this.config.typeId + isnew, 'storage')
            : this._startUp.apiRoot('archives/current/' + this.config.typeId + '/' + this.config.achiveFileMultiId + isnew, 'storage');
        this._ajaxM.get({ url: url })
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popupM.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                if (entity.length !== 0) {
                    this.clearAction(false);
                    this.addRows(entity);
                    // оповещаем подписчика о том, что изменилось число файлов
                    this.onChange(this.dataSource);
                    this.valueChange.emit(this.dataSource);
                }
                this.hideLoading = true;
            },
            failCallback: () => {
                this.hideLoading = true;
            }
        }));
    }
    loadExternal() {
        this.hideLoading = false;
        const url = Utility.isEmpty(this.config.achiveFileMultiId)
            ? this._startUp.apiRoot('files/external/' + this.config.typeId, 'storage')
            : this._startUp.apiRoot('files/external/' + this.config.typeId + '/' + this.config.achiveFileMultiId, 'storage');
        this._ajaxM.get({ url: url })
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popupM.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.clearAction();
                this.dataSource.push(entity);
                // оповещаем подписчика о том, что изменилось число файлов
                this.onChange(this.dataSource);
                this.valueChange.emit(this.dataSource);
                this.hideLoading = true;
            },
            failCallback: () => {
                this.hideLoading = true;
            }
        }));
    }
    generageDocument() {
        if (this.config.isDgsFile === true) {
            // настройка генерации осуществляется из внешнего контрода, кнопка лишь инициирует внешнюю функцию
            const setting = { typeId: this.config.typeId };
            this.autogenerateClick.emit({ setting, uploader: this });
        }
    }
    addRows(items) {
        items.forEach(item => {
            this.dataSource.push(item);
        });
    }
    viewAction(row) {
        if (this.loadedDocument === false) {
            const fileSplit = row.fileName.split('.');
            const fileExtension = fileSplit[fileSplit.length - 1];
            if (!!UploaderConst.converFilter[fileExtension.toLocaleLowerCase()]) {
                this.loadedDocument = true;
                this.hideLoading = false;
                const url = Utility.isEmpty(this.anonymAccessItemId)
                    ? row.fileUrl + '?convertToPdf=' + UploaderConst.converFilter[fileExtension.toLocaleLowerCase()].needConvert
                    : row.fileUrl + "/" + this.anonymAccessItemId + '?convertToPdf=' + UploaderConst.converFilter[fileExtension.toLocaleLowerCase()].needConvert;
                this._ajaxM.get({ url, httpOptions: { responseType: 'blob' } })
                    .subscribe((response) => {
                    const data = { data: response, isConvert: !!UploaderConst.converFilter[fileExtension.toLocaleLowerCase()].needConvert, fileExtension: fileExtension.toLocaleLowerCase() };
                    CoreDialog.window(FileViewerDialogWindow, data, () => { this.loadedDocument = false; }, () => { this.loadedDocument = false; });
                    this.hideLoading = true;
                });
                return;
            }
        }
    }
    download(row, parameters = '') {
        const url = Utility.isEmpty(this.anonymAccessItemId)
            ? this._startUp.apiRoot('files/' + row.fileId, 'storage') + parameters
            : this._startUp.apiRoot('files/' + row.fileId + '/' + this.anonymAccessItemId, 'storage') + parameters;
        this._ajaxM.download({
            url: url
        });
    }
    signaturesAction(row) {
        CoreDialog.window(CoreFileSignaturesWindow, { fileId: row.fileId });
    }
    attributeAction(row) {
        CoreDialog.window(CoreFileAttributesWindow, { fileId: row.fileId });
    }
    removeAction(item, emitValueChange = true) {
        this.dataSource = this.dataSource.filter(obj => obj !== item);
        if (this.config.signConfig) {
            this.config.signConfig.isRequired = true;
        }
        this.onChange(this.dataSource);
        if (emitValueChange) {
            this.valueChange.emit(this.dataSource);
        }
    }
    clearAction(emitValueChange = true) {
        if (!!this.dataSource) {
            this.dataSource.forEach(file => {
                this.removeAction(file, emitValueChange);
            });
        }
    }
    // implements ControlValueAccessor
    writeValue(value) {
        this.value = value;
    }
    // implements ControlValueAccessor
    registerOnChange(fn) {
        this.onChange = fn;
    }
    // implements ControlValueAccessor
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    // implements ControlValueAccessor
    setDisabledState(isDisabled) {
        if (isDisabled === true) {
            this.config.isReadOnly = true;
        }
        if (isDisabled === false) {
            this.config.isReadOnly = false;
        }
    }
    // implements Validator
    validate(control) {
        if (this.config.isRequired) {
            if (control.value === null || control.value === undefined || control.value?.length === 0) {
                return { 'required': true };
            }
        }
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    filesDropped(files) {
        this._handleFiles(files.map(f => f.file), this.config);
    }
    _handleFiles(files, config) {
        this.hideLoading = false;
        if (config.multiple === false) {
            this.clearAction();
        }
        const promises = [];
        for (let i = 0; i < files.length; i++) {
            const promise = new Promise((resolve, reject) => {
                const reader = new FileReader();
                reader.readAsDataURL(files[i]);
                reader.onload = () => {
                    const result = reader.result.toString();
                    const upload = {
                        isVersioned: config.isAchiveFile ?? false,
                        multiId: config.isAchiveFile ? config.achiveFileMultiId ?? null : null,
                        typeId: config.typeId ? config.typeId : null,
                        isTemp: config.isTemp ?? false,
                        fileName: files[i].name,
                        content: result.substr(result.indexOf(',') + 1),
                        hiddenLink: config.hiddenLink ?? false
                    };
                    const url = !Utility.isEmpty(config.url) ? config.url : this._startUp.apiRoot('files', 'storage') + (Utility.isEmpty(config.folderId) ? '' : '?folderId=' + config.folderId);
                    this._ajaxM.post({ url: url, data: upload }).subscribe({
                        next: (response) => {
                            if (response.isSuccess) {
                                if (config.callback) {
                                    config.callback(response.entity, this);
                                }
                                else {
                                    this.dataSource.push(response.entity);
                                }
                                // оповещаем подписчика о том, что изменилось число файлов
                                this.onChange(this.dataSource);
                                this.valueChange.emit(this.dataSource);
                                resolve(response.entity);
                            }
                            else {
                                CoreDialog.notificate(response.message, InfoType.Danger);
                                resolve(null);
                            }
                            this.hideLoading = true;
                        },
                        error: (_) => {
                            this.hideLoading = true;
                            CoreDialog.notificate('Произошла ошибка при загрузке файла', InfoType.Danger);
                            resolve(null);
                        }
                    });
                };
            });
            promises.push(promise);
        }
        Promise.all(promises).then((value) => {
            const uploaded = value.filter(v => !!v);
            this.filesLoaded.emit(uploaded);
            if (this._uploadInput) {
                this._uploadInput.nativeElement.value = '';
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileUploaderComponent, deps: [{ token: Startup }, { token: AjaxService }, { token: PopupResults }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFileUploaderComponent, isStandalone: false, selector: "core-file-uploader", inputs: { config: "config", needUpload: "needUpload", elementId: "elementId", anonymAccessItemId: "anonymAccessItemId" }, outputs: { valueChange: "valueChange", autogenerateClick: "autogenerateClick", filesLoaded: "filesLoaded" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFileUploaderComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFileUploaderComponent,
                multi: true
            }
        ], viewQueries: [{ propertyName: "_uploadInput", first: true, predicate: ["uploadInput"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-chat-pos-uploader-button\">\n  <div provideParentForm class=\"sln-uploader-wallpaper\">\n    <div class=\"sln-chat-func-btn\" style=\"line-height: 0;\">\n      @if (!config.isReadOnly) {\n        <div class=\"ibox-tools\" style=\"display:none\">\n          <input #uploadInput [id]=\"elementId\" name=\"type-{{elementId}}\" type=\"file\"  (change)=\"onChangeInput($event)\" [attr.multiple]=\"config.multiple ? 'multiple' : null\" [attr.accept]=\"config.accept ? config.accept : null\" />\n        </div>\n      }\n      @if (!config.isReadOnly && config.miniButton) {\n        <label  [for]=\"elementId\">\n          <div class=\"sln-chat-clip sln-chat-clip-position sln-clip\"></div>\n        </label>\n      }\n    </div>\n    <div [hidden]=\"!config.useDragAndDrop || dataSource.length\" class=\"sln-dropzone\" dragUpload (files)=\"filesDropped($event)\">\n      <div class=\"sln-form-wrapp\">\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430</div>\n    </div>\n    <div [hidden]=\"config.miniButton\" class=\"wrap-control\">\n      <div class=\"wrap-header\">\n        <div class=\"wrap-header__title\">\n          <h3 class=\"control__sln-h3\">\n            @if (config.isRequired && dataSource?.length === 0) {\n              <small>\n              </small>\n              } {{ config.typeName }}\n              <mat-error>\n                @if (config.isRequired && dataSource?.length === 0) {\n                  <span cclass=\"mat-form-field-required-marker\">  *</span>\n                }\n              </mat-error>\n              @if (config.useInformer) {\n                <i class=\"fa {{ config.informerIcon }}\" matSuffix matTooltip=\"{{ config.informerText }}\"></i>\n              }\n            </h3>\n          </div>\n          @if (!config.isReadOnly && config.isExternalLoad) {\n            <button (click)=\"loadExternal()\" [disabled]=\"!hideLoading\" matTooltip=\"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437 \u0432\u043D\u0435\u0448\u043D\u0435\u0433\u043E \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430\">             \n              <div class=\"sln-uploader-document-financial-statements sln-uploader-position\"></div>              \n            </button>\n          }\n          @if (!config.isReadOnly && config.isAchiveFile) {\n            <button (click)=\"uploadFromArchive()\" [disabled]=\"!hideLoading\" matTooltip=\"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430\">            \n              <div class=\"sln-uploader-reduction sln-uploader-position\"></div>             \n            </button>\n          }\n          @if (!config.isReadOnly && config.isDgsFile) {\n            <button (click)=\"generageDocument()\" [disabled]=\"!hideLoading\" matTooltip=\"{{ config.dgsBtnName }}\">\n              <div class=\"sln-uploader-document-generation sln-uploader-position\"></div>\n            </button>\n          }\n          <div [hidden]=\"!hideLoading\">\n            @if (!(config.isReadOnly || config.hideSelectBtn || config.miniButton)) {\n              <label class=\"control__btn\" [for]=\"elementId\" tid=\"\u0441hooseDoc\">\n                <p>\u0412\u042B\u0411\u0420\u0410\u0422\u042C</p>\n              </label>\n            }\n          </div>\n        </div>\n        <div [hidden]=\"hideLoading\"><mat-progress-bar mode=\"indeterminate\"></mat-progress-bar></div>\n        <div class=\"wrap-body\" [hidden]=\"config.hideList\">\n          @for (item of dataSource; track item; let i = $index) {\n            <div class=\"action-buttons__flex\">\n              <div class=\"control__left\" (click)=\"viewAction(item)\">\n                <div class=\"sln-common-docs\" alt=\"\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C\"></div>\n                <div matTooltip=\"{{itCanViewed(item) ? '\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442': ''}}\" class=\"sln-text-hide\">\n                  <p>{{ item.fileName }}</p>\n                </div>\n              </div>\n              @if (itCanViewed(item)) {\n                <a (click)=\"viewAction(item)\" matTooltip=\"\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C\">\n                  <div class=\"sln-uploader-document-view sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (!config.hideDownloadBtn) {\n                <a (click)=\"download(item)\" matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C\">\n                    <div class=\"sln-uploader-document-download sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (item.hasSingatures && itCanViewed(item)) {\n                <a (click)=\"download(item, '?convertToPdf=1&visualizeSigns=1')\" matTooltip=\"\u0412\u0438\u0437\u0443\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u041A\u042D\u041F\">\n                    <div class=\"sln-uploader-document-download-with-signatures sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (item.hasSingatures) {\n                <a (click)=\"signaturesAction(item)\" matTooltip=\"\u041F\u043E\u0434\u043F\u0438\u0441\u0438 \u0441\u0442\u043E\u0440\u043E\u043D\">\n                    <div class=\"sln-uploader-document-signatures sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (!config.hideAttributeBtn && !hideAttributes) {\n                <a (click)=\"attributeAction(item)\" matTooltip=\"\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044B\">\n                    <div class=\"sln-uploader-document-attribute sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (item.canDelete && !config.isReadOnly) {\n                <a (click)=\"removeAction(item)\" matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\">\n                    <div class=\"sln-uploader-document-remove sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (config.signConfig && !config.isReadOnly && !config.signConfig.isReadOnly) {\n                <label [for]=\"config.signConfig.typeId + '-' + item.fileId\">\n                  <div class=\"row\" matTooltip=\"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u043E\u0434\u043F\u0438\u0441\u044C\">\n                    @if (!isRequiredSign) {\n                      <div class=\"sln-uploader-document-upload-signature sln-uploader-document-position\"></div>\n                    }\n                    @if (isRequiredSign) {\n                      <div class=\"sln-uploader-document-required-upload-signature sln-uploader-document-position\"></div>\n                    }\n                  </div>\n                  <input [id]=\"config.signConfig.typeId + '-' + item.fileId\" name=\"type-{{config.signConfig.typeId}}-{{item.fileId}}\" type=\"file\" style=\"display:none\" (change)=\"onChangeSignature($event, config.signConfig, item)\" [attr.accept]=\"config.signConfig.accept ? config.signConfig.accept : null\" />\n                </label>\n              }\n            </div>\n          }\n        </div>\n      </div>\n    </div>\n    <button style=\"display: none;\" class=\"sln-context-menu\">\n      <div class=\"sln-chat-context-menu sln-chat-context-menu-position sln-context-menu\"></div>\n    </button>\n  </div>", styles: [".row{display:flex;align-items:center}.mat-mdc-form-field-error{float:right;color:var(--DANGER)}\n"], dependencies: [{ kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i2$2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i6$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: DragUploudDirective, selector: "[dragUpload]", outputs: ["files"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileUploaderComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-file-uploader', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFileUploaderComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFileUploaderComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div class=\"sln-chat-pos-uploader-button\">\n  <div provideParentForm class=\"sln-uploader-wallpaper\">\n    <div class=\"sln-chat-func-btn\" style=\"line-height: 0;\">\n      @if (!config.isReadOnly) {\n        <div class=\"ibox-tools\" style=\"display:none\">\n          <input #uploadInput [id]=\"elementId\" name=\"type-{{elementId}}\" type=\"file\"  (change)=\"onChangeInput($event)\" [attr.multiple]=\"config.multiple ? 'multiple' : null\" [attr.accept]=\"config.accept ? config.accept : null\" />\n        </div>\n      }\n      @if (!config.isReadOnly && config.miniButton) {\n        <label  [for]=\"elementId\">\n          <div class=\"sln-chat-clip sln-chat-clip-position sln-clip\"></div>\n        </label>\n      }\n    </div>\n    <div [hidden]=\"!config.useDragAndDrop || dataSource.length\" class=\"sln-dropzone\" dragUpload (files)=\"filesDropped($event)\">\n      <div class=\"sln-form-wrapp\">\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430</div>\n    </div>\n    <div [hidden]=\"config.miniButton\" class=\"wrap-control\">\n      <div class=\"wrap-header\">\n        <div class=\"wrap-header__title\">\n          <h3 class=\"control__sln-h3\">\n            @if (config.isRequired && dataSource?.length === 0) {\n              <small>\n              </small>\n              } {{ config.typeName }}\n              <mat-error>\n                @if (config.isRequired && dataSource?.length === 0) {\n                  <span cclass=\"mat-form-field-required-marker\">  *</span>\n                }\n              </mat-error>\n              @if (config.useInformer) {\n                <i class=\"fa {{ config.informerIcon }}\" matSuffix matTooltip=\"{{ config.informerText }}\"></i>\n              }\n            </h3>\n          </div>\n          @if (!config.isReadOnly && config.isExternalLoad) {\n            <button (click)=\"loadExternal()\" [disabled]=\"!hideLoading\" matTooltip=\"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437 \u0432\u043D\u0435\u0448\u043D\u0435\u0433\u043E \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0430\">             \n              <div class=\"sln-uploader-document-financial-statements sln-uploader-position\"></div>              \n            </button>\n          }\n          @if (!config.isReadOnly && config.isAchiveFile) {\n            <button (click)=\"uploadFromArchive()\" [disabled]=\"!hideLoading\" matTooltip=\"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430\">            \n              <div class=\"sln-uploader-reduction sln-uploader-position\"></div>             \n            </button>\n          }\n          @if (!config.isReadOnly && config.isDgsFile) {\n            <button (click)=\"generageDocument()\" [disabled]=\"!hideLoading\" matTooltip=\"{{ config.dgsBtnName }}\">\n              <div class=\"sln-uploader-document-generation sln-uploader-position\"></div>\n            </button>\n          }\n          <div [hidden]=\"!hideLoading\">\n            @if (!(config.isReadOnly || config.hideSelectBtn || config.miniButton)) {\n              <label class=\"control__btn\" [for]=\"elementId\" tid=\"\u0441hooseDoc\">\n                <p>\u0412\u042B\u0411\u0420\u0410\u0422\u042C</p>\n              </label>\n            }\n          </div>\n        </div>\n        <div [hidden]=\"hideLoading\"><mat-progress-bar mode=\"indeterminate\"></mat-progress-bar></div>\n        <div class=\"wrap-body\" [hidden]=\"config.hideList\">\n          @for (item of dataSource; track item; let i = $index) {\n            <div class=\"action-buttons__flex\">\n              <div class=\"control__left\" (click)=\"viewAction(item)\">\n                <div class=\"sln-common-docs\" alt=\"\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C\"></div>\n                <div matTooltip=\"{{itCanViewed(item) ? '\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442': ''}}\" class=\"sln-text-hide\">\n                  <p>{{ item.fileName }}</p>\n                </div>\n              </div>\n              @if (itCanViewed(item)) {\n                <a (click)=\"viewAction(item)\" matTooltip=\"\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C\">\n                  <div class=\"sln-uploader-document-view sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (!config.hideDownloadBtn) {\n                <a (click)=\"download(item)\" matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C\">\n                    <div class=\"sln-uploader-document-download sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (item.hasSingatures && itCanViewed(item)) {\n                <a (click)=\"download(item, '?convertToPdf=1&visualizeSigns=1')\" matTooltip=\"\u0412\u0438\u0437\u0443\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u041A\u042D\u041F\">\n                    <div class=\"sln-uploader-document-download-with-signatures sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (item.hasSingatures) {\n                <a (click)=\"signaturesAction(item)\" matTooltip=\"\u041F\u043E\u0434\u043F\u0438\u0441\u0438 \u0441\u0442\u043E\u0440\u043E\u043D\">\n                    <div class=\"sln-uploader-document-signatures sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (!config.hideAttributeBtn && !hideAttributes) {\n                <a (click)=\"attributeAction(item)\" matTooltip=\"\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044B\">\n                    <div class=\"sln-uploader-document-attribute sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (item.canDelete && !config.isReadOnly) {\n                <a (click)=\"removeAction(item)\" matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\">\n                    <div class=\"sln-uploader-document-remove sln-uploader-document-position\"></div>\n                </a>\n              }\n              @if (config.signConfig && !config.isReadOnly && !config.signConfig.isReadOnly) {\n                <label [for]=\"config.signConfig.typeId + '-' + item.fileId\">\n                  <div class=\"row\" matTooltip=\"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u043E\u0434\u043F\u0438\u0441\u044C\">\n                    @if (!isRequiredSign) {\n                      <div class=\"sln-uploader-document-upload-signature sln-uploader-document-position\"></div>\n                    }\n                    @if (isRequiredSign) {\n                      <div class=\"sln-uploader-document-required-upload-signature sln-uploader-document-position\"></div>\n                    }\n                  </div>\n                  <input [id]=\"config.signConfig.typeId + '-' + item.fileId\" name=\"type-{{config.signConfig.typeId}}-{{item.fileId}}\" type=\"file\" style=\"display:none\" (change)=\"onChangeSignature($event, config.signConfig, item)\" [attr.accept]=\"config.signConfig.accept ? config.signConfig.accept : null\" />\n                </label>\n              }\n            </div>\n          }\n        </div>\n      </div>\n    </div>\n    <button style=\"display: none;\" class=\"sln-context-menu\">\n      <div class=\"sln-chat-context-menu sln-chat-context-menu-position sln-context-menu\"></div>\n    </button>\n  </div>", styles: [".row{display:flex;align-items:center}.mat-mdc-form-field-error{float:right;color:var(--DANGER)}\n"] }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }, { type: PopupResults }, { type: ContextService }], propDecorators: { config: [{
                type: Input
            }], needUpload: [{
                type: Input
            }], elementId: [{
                type: Input
            }], anonymAccessItemId: [{
                type: Input
            }], _uploadInput: [{
                type: ViewChild,
                args: ['uploadInput', { read: ElementRef }]
            }], valueChange: [{
                type: Output
            }], autogenerateClick: [{
                type: Output
            }], filesLoaded: [{
                type: Output
            }] } });

class CoreFilePreviewDialogWindow extends CoreAbstractComponent {
    constructor(_dialogRef, item) {
        super();
        this.item = item;
        if (!this.item.metadata) {
            this.item.metadata = {};
        }
        if (!this.item.metadata.dialogRefs) {
            this.item.metadata.dialogRefs = [_dialogRef];
        }
        else {
            this.item.metadata.dialogRefs.push(_dialogRef);
        }
    }
    ngOnInit() {
        this._iniPrintFormUploader();
    }
    accept($event) {
        this.item.metadata.button = $event;
        this.item.callback(this.item.metadata);
    }
    _iniPrintFormUploader() {
        this.filesConfig = new UploaderConfig(Number(this.item.fileType));
        this.filesConfig.isReadOnly = true;
        this.filesConfig.files = this.item.files;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFilePreviewDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreFilePreviewDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog [dialogTitle]=\"item.previewTitle\" [width]=\"800\">\n    <div body>\n        <form #currentForm=\"ngForm\" novalidate class=\"sln-preview-dialog\">\n            <p>{{ item.previewText }}</p>\n            <div class=\"sln-scrollbar\">\n                <div class=\"form-group\">\n                    <core-file-uploader [config]=\"filesConfig\" [anonymAccessItemId]=\"item.anonymAccessItemId\"></core-file-uploader>\n                </div>\n            </div>            \n        </form>\n    </div>\n    <div footer class=\"footer\" style=\"display: flex;\">\n        <p>\u041D\u0430\u0436\u0438\u043C\u0430\u044F \u043A\u043D\u043E\u043F\u043A\u0443 \"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\", \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044E, \u0447\u0442\u043E \u0441 \u043F\u0435\u0447\u0430\u0442\u043D\u044B\u043C\u0438 \u0444\u043E\u0440\u043C\u0430\u043C\u0438 \u043E\u0437\u043D\u0430\u043A\u043E\u043C\u043B\u0435\u043D, <br> \u043A \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u043D\u0438\u044E \u043F\u0440\u0435\u0442\u0435\u043D\u0437\u0438\u0439 \u043D\u0435 \u0438\u043C\u0435\u044E.</p>\n        <button type=\"button\" class=\"btn-primary\" (click)=\"accept($event)\">\n            \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\n            <div [hidden]=\"true\" style=\"width: 100%;\">\n                <mat-progress-bar mode=\"indeterminate\" style=\"top:12px\"></mat-progress-bar>\n            </div>\n        </button>\n    </div>\n</core-dialog>\n", styles: ["form ::ng-deep tr.mat-header-row{height:1px!important;border-top-width:1px!important}form ::ng-deep td.mat-cell{border:none!important;border-bottom-style:dashed!important;border-bottom-width:1px!important;border-top-width:1px!important;border-top-style:dashed!important;border-color:--GRAY!important}form ::ng-deep td.mat-cell a{font-family:var(--font-bold);font-size:12px;letter-spacing:.02em;text-transform:uppercase;color:var(--MIDLE-GRAY);cursor:pointer}.sln-scrollbar{max-height:400px;overflow:scroll}.common-btn .mat-progress-bar{bottom:0!important;position:absolute!important;top:auto!important;left:0!important}.btn-primary{padding:0;width:115px;height:45px}.sln-preview-dialog p{font-size:14px;color:var(--DARK-GREY);line-height:normal;margin-bottom:10px}.footer{width:100%;justify-content:space-between}.footer button:focus{outline:none;box-shadow:none}.footer p{font-size:12px;color:var(--DARK-GREY)}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i6$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: CoreFileUploaderComponent, selector: "core-file-uploader", inputs: ["config", "needUpload", "elementId", "anonymAccessItemId"], outputs: ["valueChange", "autogenerateClick", "filesLoaded"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFilePreviewDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog [dialogTitle]=\"item.previewTitle\" [width]=\"800\">\n    <div body>\n        <form #currentForm=\"ngForm\" novalidate class=\"sln-preview-dialog\">\n            <p>{{ item.previewText }}</p>\n            <div class=\"sln-scrollbar\">\n                <div class=\"form-group\">\n                    <core-file-uploader [config]=\"filesConfig\" [anonymAccessItemId]=\"item.anonymAccessItemId\"></core-file-uploader>\n                </div>\n            </div>            \n        </form>\n    </div>\n    <div footer class=\"footer\" style=\"display: flex;\">\n        <p>\u041D\u0430\u0436\u0438\u043C\u0430\u044F \u043A\u043D\u043E\u043F\u043A\u0443 \"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\", \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044E, \u0447\u0442\u043E \u0441 \u043F\u0435\u0447\u0430\u0442\u043D\u044B\u043C\u0438 \u0444\u043E\u0440\u043C\u0430\u043C\u0438 \u043E\u0437\u043D\u0430\u043A\u043E\u043C\u043B\u0435\u043D, <br> \u043A \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u043D\u0438\u044E \u043F\u0440\u0435\u0442\u0435\u043D\u0437\u0438\u0439 \u043D\u0435 \u0438\u043C\u0435\u044E.</p>\n        <button type=\"button\" class=\"btn-primary\" (click)=\"accept($event)\">\n            \u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C\n            <div [hidden]=\"true\" style=\"width: 100%;\">\n                <mat-progress-bar mode=\"indeterminate\" style=\"top:12px\"></mat-progress-bar>\n            </div>\n        </button>\n    </div>\n</core-dialog>\n", styles: ["form ::ng-deep tr.mat-header-row{height:1px!important;border-top-width:1px!important}form ::ng-deep td.mat-cell{border:none!important;border-bottom-style:dashed!important;border-bottom-width:1px!important;border-top-width:1px!important;border-top-style:dashed!important;border-color:--GRAY!important}form ::ng-deep td.mat-cell a{font-family:var(--font-bold);font-size:12px;letter-spacing:.02em;text-transform:uppercase;color:var(--MIDLE-GRAY);cursor:pointer}.sln-scrollbar{max-height:400px;overflow:scroll}.common-btn .mat-progress-bar{bottom:0!important;position:absolute!important;top:auto!important;left:0!important}.btn-primary{padding:0;width:115px;height:45px}.sln-preview-dialog p{font-size:14px;color:var(--DARK-GREY);line-height:normal;margin-bottom:10px}.footer{width:100%;justify-content:space-between}.footer button:focus{outline:none;box-shadow:none}.footer p{font-size:12px;color:var(--DARK-GREY)}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class CoreFileSignaturesModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignaturesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignaturesModule, declarations: [CoreFileSignaturesWindow,
            CoreAttorneyPowersDialogWindow], imports: [CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreBaseModule,
            CoreDirectiveModule], exports: [CoreFileSignaturesWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignaturesModule, providers: [
            CoreFileSignatureService
        ], imports: [CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreBaseModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignaturesModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreFileSignaturesWindow,
                        CoreAttorneyPowersDialogWindow
                    ],
                    imports: [
                        CoreMatModule,
                        CoreDialogModule,
                        CorePipeModule,
                        CoreBaseModule,
                        CoreDirectiveModule,
                    ],
                    providers: [
                        CoreFileSignatureService
                    ],
                    exports: [
                        CoreFileSignaturesWindow,
                    ]
                }]
        }] });

class CoreUploaderModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUploaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreUploaderModule, declarations: [CoreFileUploaderComponent,
            CoreFilePreviewDialogWindow,
            FileViewerDialogWindow], imports: [CoreBaseModule,
            CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreFileSignaturesModule,
            CoreFileAttributesModule,
            CoreDirectiveModule], exports: [CoreFileUploaderComponent,
            CoreFilePreviewDialogWindow,
            FileViewerDialogWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUploaderModule, imports: [CoreBaseModule,
            CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreFileSignaturesModule,
            CoreFileAttributesModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUploaderModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreFileUploaderComponent,
                        CoreFilePreviewDialogWindow,
                        FileViewerDialogWindow
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreDialogModule,
                        CorePipeModule,
                        CoreFileSignaturesModule,
                        CoreFileAttributesModule,
                        CoreDirectiveModule
                    ],
                    exports: [
                        CoreFileUploaderComponent,
                        CoreFilePreviewDialogWindow,
                        FileViewerDialogWindow
                    ],
                }]
        }] });

class CoreAttorneyUploadWindow extends CoreBaseDestroyComponent {
    constructor(_dialogRef, data, _startUp, _service) {
        super();
        this._dialogRef = _dialogRef;
        this.data = data;
        this._startUp = _startUp;
        this._service = _service;
    }
    ngOnInit() {
        this.fileConfig = new UploaderConfig(FileTypeEnum.MachineReadableAttorneyXml, this._startUp.apiRoot('attorney', 'storage'));
        this.fileConfig.typeName = 'Файл доверенности';
        this.fileConfig.accept = '.xml';
        this.fileConfig.multiple = false;
        this.fileConfig.isRequired = true;
        this.fileConfig.hideViewBtn = true;
        this.fileConfig.hideDownloadBtn = true;
        this.fileConfig.hideAttributeBtn = true;
        this.fileConfig.signConfig = new UploaderConfig(1);
        this.fileConfig.signConfig.accept = '.sign, .sig, .sgn';
        this.fileConfig.signConfig.isRequired = true;
        this.fileConfig.signConfig.callback = (_e, uploader) => {
            this.isAttorneyLoaded = true;
            uploader.config.signConfig.isRequired = false;
        };
        this.personInn = this.data.inn;
    }
    upload() {
        const file = this.files[0];
        if (this.data.uploadButtonCallback) {
            this.data.uploadButtonCallback(file);
            this._dialogRef.close({ state: 'success' });
            return;
        }
        this._service
            .load(file.fileId, true, { personId: this.data.personId, personInn: this.personInn })
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => {
            if (response.isSuccess) {
                this._dialogRef.close({ state: 'success', id: response.entity });
            }
            else {
                CoreNotification.error(response.message);
            }
        });
    }
    onValuesChange($event) {
        if (!$event || $event.length === 0) {
            this.files = null;
            this.isAttorneyLoaded = false;
            return;
        }
        const file = $event[0];
        if (this.fileConfig.signConfig) {
            this.fileConfig.signConfig.url = this._startUp.apiRoot('sign/attach/' + file.fileId, 'storage');
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyUploadWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: Startup }, { token: AttorneyService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreAttorneyUploadWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n  <core-dialog dialogTitle=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438\" hasCansel=\"false\" width=\"600\">\n    <div body style=\"padding: 0 1px 0 0;\">\n      <form #uploadAttorneyForm=\"ngForm\" novalidate>\n        <div class=\"row\">\n          <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">              \n              <core-file-uploader [config]=\"fileConfig\" [(ngModel)]=\"files\" name=\"machineReadable\" (valueChange)=\"onValuesChange($event)\" tid=\"addAttorney\"></core-file-uploader>\n            </div>\n          </div>\n        </div>\n      </form>\n    </div>\n    <div footer>\n      <button class=\"btn-primary\" (click)=\"upload()\" [disabled]=\"uploadAttorneyForm.invalid || !isAttorneyLoaded\">\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C</button>\n    </div>\n  </core-dialog>", styles: [".sln-attorney-info{color:var(--DARK-GREY);margin-bottom:5px}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"], dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreFileUploaderComponent, selector: "core-file-uploader", inputs: ["config", "needUpload", "elementId", "anonymAccessItemId"], outputs: ["valueChange", "autogenerateClick", "filesLoaded"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyUploadWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "\n  <core-dialog dialogTitle=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438\" hasCansel=\"false\" width=\"600\">\n    <div body style=\"padding: 0 1px 0 0;\">\n      <form #uploadAttorneyForm=\"ngForm\" novalidate>\n        <div class=\"row\">\n          <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">              \n              <core-file-uploader [config]=\"fileConfig\" [(ngModel)]=\"files\" name=\"machineReadable\" (valueChange)=\"onValuesChange($event)\" tid=\"addAttorney\"></core-file-uploader>\n            </div>\n          </div>\n        </div>\n      </form>\n    </div>\n    <div footer>\n      <button class=\"btn-primary\" (click)=\"upload()\" [disabled]=\"uploadAttorneyForm.invalid || !isAttorneyLoaded\">\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C</button>\n    </div>\n  </core-dialog>", styles: [".sln-attorney-info{color:var(--DARK-GREY);margin-bottom:5px}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: Startup }, { type: AttorneyService }] });

class CoreAttorneyDownloadWindow extends CoreBaseDestroyComponent {
    constructor(dialogRef, data, _service, _popupResults) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
        this._service = _service;
        this._popupResults = _popupResults;
    }
    ngOnInit() {
        this.personId = this.data.personId;
        this.personInn = this.data.inn;
        this.organizationInn = this.data.organizationInn;
    }
    getFromFns() {
        let query = 'attorneyId=' + this.attorneyId + '&personInn=' + this.personInn;
        if (this.organizationInn) {
            query += '&organizationInn=' + this.organizationInn;
        }
        if (this.personId) {
            query += '&personId=' + this.personId;
        }
        this._service
            .uploadFromFns(query)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => {
            this._popupResults.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this.dialogRef.close({ state: 'success', id: entity.id });
                }
            });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyDownloadWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: AttorneyService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreAttorneyDownloadWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "\n<core-dialog dialogTitle=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438\" width=\"600\">\n  <div body style=\"padding: 0 1px 0 0;\">\n    <form #manualForm=\"ngForm\" novalidate>\n      <div class=\"sln-attorney-info\">\u0427\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438 \u0438\u0437 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u0424\u041D\u0421, \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u043F\u043E\u043B\u044F.</div> \n        <div class=\"row\">\n          <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"attorneyId\" name=\"attorneyId\" fieldName=\"attorneyId\" placeholder=\"\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438\" \n                [settings]=\"{ isRequired: true, maxLength: 36, rightHintHide: true, useMask: true, maskExpression: 'AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA' }\"></core-field-string>\n            </div>\n          </div>\n          <div class=\"col-md-6 sln-padding-left\">     \n              <core-field-inn [(ngModel)]=\"organizationInn\" name=\"organizationInn\" fieldName=\"organizationInn\" placeholder=\"\u0418\u041D\u041D \u0434\u043E\u0432\u0435\u0440\u0438\u0442\u0435\u043B\u044F\" \n                class=\"sln-get-from-fns-inn\" [settings]=\"{ isRequired: true,  maxLength: 12, useInformer: true, informerText: '\u0418\u041D\u041D \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430, \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u043E 12 \u0437\u043D\u0430\u043A\u043E\u0432' }\"></core-field-inn>\n          </div>\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">        \n              <core-field-inn [(ngModel)]=\"personInn\" name=\"personInn\" fieldName=\"personInn\" placeholder=\"\u0418\u041D\u041D \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F\" \n                class=\"sln-get-from-fns-inn\" [settings]=\"{ isRequired: true, maxLength: 12, useInformer: true, informerText: '\u0418\u041D\u041D \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430, \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u043E 12 \u0437\u043D\u0430\u043A\u043E\u0432' }\"></core-field-inn>\n          </div>\n      </div>\n    </form>\n  </div>\n  <div footer>\n    <button class=\"btn-primary\" (click)=\"getFromFns()\" [disabled]=\"manualForm.invalid\">\n      \u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u0438\u0437 \u0424\u041D\u0421\n    </button>\n  </div>\n</core-dialog>", styles: [".sln-attorney-info{color:var(--DARK-GREY);margin-bottom:5px}.sln-get-from-fns-inn{width:100%}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"], dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldInnComponent, selector: "core-field-inn" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyDownloadWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "\n<core-dialog dialogTitle=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438\" width=\"600\">\n  <div body style=\"padding: 0 1px 0 0;\">\n    <form #manualForm=\"ngForm\" novalidate>\n      <div class=\"sln-attorney-info\">\u0427\u0442\u043E\u0431\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438 \u0438\u0437 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u0424\u041D\u0421, \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u043F\u043E\u043B\u044F.</div> \n        <div class=\"row\">\n          <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"attorneyId\" name=\"attorneyId\" fieldName=\"attorneyId\" placeholder=\"\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u043D\u043E\u043C\u0435\u0440 \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u0438\" \n                [settings]=\"{ isRequired: true, maxLength: 36, rightHintHide: true, useMask: true, maskExpression: 'AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA' }\"></core-field-string>\n            </div>\n          </div>\n          <div class=\"col-md-6 sln-padding-left\">     \n              <core-field-inn [(ngModel)]=\"organizationInn\" name=\"organizationInn\" fieldName=\"organizationInn\" placeholder=\"\u0418\u041D\u041D \u0434\u043E\u0432\u0435\u0440\u0438\u0442\u0435\u043B\u044F\" \n                class=\"sln-get-from-fns-inn\" [settings]=\"{ isRequired: true,  maxLength: 12, useInformer: true, informerText: '\u0418\u041D\u041D \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430, \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u043E 12 \u0437\u043D\u0430\u043A\u043E\u0432' }\"></core-field-inn>\n          </div>\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">        \n              <core-field-inn [(ngModel)]=\"personInn\" name=\"personInn\" fieldName=\"personInn\" placeholder=\"\u0418\u041D\u041D \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F\" \n                class=\"sln-get-from-fns-inn\" [settings]=\"{ isRequired: true, maxLength: 12, useInformer: true, informerText: '\u0418\u041D\u041D \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430, \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u043E 12 \u0437\u043D\u0430\u043A\u043E\u0432' }\"></core-field-inn>\n          </div>\n      </div>\n    </form>\n  </div>\n  <div footer>\n    <button class=\"btn-primary\" (click)=\"getFromFns()\" [disabled]=\"manualForm.invalid\">\n      \u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435 \u0438\u0437 \u0424\u041D\u0421\n    </button>\n  </div>\n</core-dialog>", styles: [".sln-attorney-info{color:var(--DARK-GREY);margin-bottom:5px}.sln-get-from-fns-inn{width:100%}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: AttorneyService }, { type: PopupResults }] });

class AttorneyRunService {
    open(data, callback) {
        const positive = () => {
            CoreDialog.window(CoreAttorneyUploadWindow, data, (result) => {
                if (callback) {
                    callback(result);
                }
            });
        };
        const negative = () => {
            CoreDialog.window(CoreAttorneyDownloadWindow, data, (result) => {
                if (callback) {
                    callback(result);
                }
            });
        };
        const options = {
            message: "Есть ли у Вас в наличии файл доверенности и его открепленная подпись?",
            button: "Да",
            cancel: "Нет"
        };
        CoreDialog.confirm(positive, negative, options);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AttorneyRunService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AttorneyRunService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AttorneyRunService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

class CoreAttorneyModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyModule, declarations: [CoreAttorneyUploadWindow,
            CoreAttorneyDownloadWindow], imports: [CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreBaseModule,
            CoreUploaderModule,
            CoreControlModule], exports: [CoreAttorneyUploadWindow,
            CoreAttorneyDownloadWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyModule, providers: [
            AttorneyService,
            AttorneyRunService
        ], imports: [CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreBaseModule,
            CoreUploaderModule,
            CoreControlModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAttorneyModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreAttorneyUploadWindow,
                        CoreAttorneyDownloadWindow
                    ],
                    imports: [
                        CoreMatModule,
                        CoreDialogModule,
                        CorePipeModule,
                        CoreBaseModule,
                        CoreUploaderModule,
                        CoreControlModule
                    ],
                    providers: [
                        AttorneyService,
                        AttorneyRunService
                    ],
                    exports: [
                        CoreAttorneyUploadWindow,
                        CoreAttorneyDownloadWindow
                    ]
                }]
        }] });

class CryptoSignService {
    constructor(_startUp, _dialog, _ajaxM, _attorneyService, _attorneyRunService) {
        this._startUp = _startUp;
        this._dialog = _dialog;
        this._ajaxM = _ajaxM;
        this._attorneyService = _attorneyService;
        this._attorneyRunService = _attorneyRunService;
    }
    // Подписываем массив данных. На вход передается массив объектов с полями {data, isDetached},
    // На выходе получается массив объектов с полями {data, isDetached, signature}
    verification(verificationCallback, isLogin, useOnlyDirector, certificate) {
        if (certificate) {
            this.prepareCertificate(certificate, isLogin, useOnlyDirector, (cert) => this._runVerificationSign(cert, verificationCallback));
            return;
        }
        const dialogRef = this._openWindow(isLogin, useOnlyDirector);
        const sub = dialogRef.afterClosed().subscribe((result) => {
            if (result && result.state !== DialogReason.cancel) {
                this._runVerificationSign(result, verificationCallback);
            }
            sub.unsubscribe();
        });
    }
    prepareCertificate(cert, isLogin, useOnlyDirector, callback) {
        if (!callback) {
            return;
        }
        if (useOnlyDirector === true) {
            CoreNotification.error('Необходимо использовать подпись единоличного исполнительного органа организации');
            return;
        }
        if (isLogin) {
            callback(cert);
            return;
        }
        const checkAttorney = (row) => {
            this._attorneyService.check(row.hash).subscribe((response) => {
                if (response.isSuccess) {
                    row.attorneyId = response.entity;
                    callback(row);
                    return;
                }
                this._attorneyRunService.open({
                    message: response.message,
                    isOrganization: row.isOrganization,
                    inn: row.isOrganization ? null : row.inn,
                    canLoadFromFns: row.inn,
                    organizationInn: row.isOrganization ? row.inn : null
                }, (result) => {
                    row.attorneyId = result.id;
                    callback(row);
                });
            });
        };
        if (!cert.isOrganization) {
            checkAttorney(cert);
            return;
        }
        this._attorneyService.needAttorney(cert).subscribe((response) => {
            if (response.isSuccess) {
                checkAttorney(cert);
            }
            else {
                callback(cert);
            }
        });
    }
    _runVerificationSign(result, verificationCallback) {
        const url = this._startUp.apiRoot('session/verifivation', 'oauth');
        this._ajaxM.get({ url: url }).subscribe((resopnse) => {
            if (resopnse.isSuccess) {
                this._encodeBase64(resopnse.entity).subscribe((tokenResult) => {
                    if (tokenResult.isSuccess) {
                        this._verificationSingProcess(result, tokenResult.entity, true).subscribe((sing) => {
                            if (verificationCallback) {
                                verificationCallback(sing, result);
                            }
                            else {
                                console.error('Не задан метод verificationCallback.');
                            }
                        });
                    }
                    else {
                        this._dialog.open(CoreInfoDialogWindow, { data: new InfoDiologConfig(InfoType.Danger, tokenResult.message) });
                    }
                });
            }
            else {
                this._dialog.open(CoreInfoDialogWindow, { data: new InfoDiologConfig(InfoType.Danger, resopnse.message) });
            }
        });
    }
    _verificationSingProcess(certificate, verificationToken, isEncode) {
        const isDetached = false;
        const cryptoProvider = window.CryptoProviderFactory.get();
        const signProccessData = cryptoProvider.sign(verificationToken, certificate.hash, isDetached, isEncode);
        const observable = from(Promise.all([signProccessData])
            .then(signaturesData => {
            const signature = new CryptoSignature(verificationToken, signaturesData[0].signature, isDetached);
            return signature;
        })
            .catch(ex => {
            console.error(ex);
            return null;
        }));
        return observable;
    }
    // Подписание файлов
    signFiles(filesData, needVersion, signCallback, cancellationCallback, organizationId, allowOnlyCeo, certificate) {
        if (certificate) {
            this._signFiles(certificate, filesData, needVersion, signCallback, cancellationCallback, organizationId, allowOnlyCeo);
            return;
        }
        const dialogRef = this._openWindow();
        const sub = dialogRef.afterClosed().subscribe((result) => {
            if (result?.state === DialogReason.cancel) {
                if (cancellationCallback) {
                    cancellationCallback(result);
                }
            }
            else if (result) {
                this._signFiles(result, filesData, needVersion, signCallback, cancellationCallback, organizationId, allowOnlyCeo);
            }
            sub.unsubscribe();
        });
    }
    _signFiles(certificate, filesData, needVersion, signCallback, cancellationCallback, organizationId, allowOnlyCeo) {
        // получаем контекнт файлов на подписание
        const urlFiles = this._startUp.apiRoot('sign/files', 'storage');
        this._ajaxM.post({ url: urlFiles, data: { ids: filesData.map(x => x.fileId) } }).subscribe((getResponse) => {
            if (getResponse.isSuccess) {
                // осуществляем подпись
                this._signFilesSingProcess(certificate, getResponse.entity).subscribe((signed) => {
                    const urlSign = this._startUp.apiRoot('sign/files/save', 'storage');
                    const signedData = new Array();
                    for (let i = 0; i < signed.length; i++) {
                        signedData.push({ fileId: signed[i].data, signature: signed[i].signature, signedByHash: signed[i].isHashString, multiOrganizationId: filesData.find(x => x.fileId === signed[i].data)?.multiOrganizationId });
                    }
                    this._ajaxM.post({ url: urlSign, data: { needVersion: needVersion, signatures: signedData, attorneyId: certificate.attorneyId, organizationId: organizationId, allowOnlyCeo: allowOnlyCeo } }).subscribe((signResponse) => {
                        if (signResponse.isSuccess) {
                            if (signCallback) {
                                signCallback(signed);
                            }
                        }
                        else {
                            if (cancellationCallback) {
                                cancellationCallback(certificate);
                            }
                            this._dialog.open(CoreInfoDialogWindow, { data: new InfoDiologConfig(InfoType.Danger, signResponse.message) });
                        }
                    });
                });
            }
            else {
                if (cancellationCallback) {
                    cancellationCallback(certificate);
                }
                this._dialog.open(CoreInfoDialogWindow, { data: new InfoDiologConfig(InfoType.Danger, getResponse.message) });
            }
        });
    }
    _signFilesSingProcess(certificate, files) {
        const isDetached = true;
        const signProccess = new Array();
        const cryptoProvider = window.CryptoProviderFactory.get();
        for (let i = 0; i < files.length; i++) {
            const signProccessData = cryptoProvider.sign(files[i].stringForSign, certificate.hash, isDetached);
            signProccess[i] = signProccessData;
        }
        const observable = from(Promise.all(signProccess)
            .then(signaturesData => {
            const signatures = new Array();
            for (let i = 0; i < files.length; i++) {
                const signature = new CryptoSignature(files[i].fileId, signaturesData[i].signature, isDetached, files[i].isHashString);
                signatures.push(signature);
            }
            return signatures;
        })
            .catch(ex => {
            console.error(ex);
            return null;
        }));
        return observable;
    }
    // открытие окна выбора сертификата
    _openWindow(isLogin, useOnlyDirector) {
        const dialogRef = this._dialog.open(CertificateListWindow, { data: { isLogin, useOnlyDirector } });
        return dialogRef;
    }
    // кодирование строки (значения) в base64
    _encodeBase64(text) {
        const url = this._startUp.apiRoot('sign/base64', 'storage');
        return this._ajaxM.post({ url: url, data: { text: text } });
    }
    loadFileSignatures(fileId) {
        const url = this._startUp.apiRoot('sign/signatures-info/' + fileId, 'storage');
        return this._ajaxM.get({ url: url });
    }
    saveAuthFile(upload) {
        const url = this._startUp.apiRoot('files', 'storage');
        return this._ajaxM.post({ url: url, data: upload });
    }
    addAuthFile(signId, fileId) {
        const url = this._startUp.apiRoot('sign/' + signId + '/authority-file/add/' + fileId, 'storage');
        return this._ajaxM.post({ url: url });
    }
    getSignerIpCountry(ip) {
        const url = this._startUp.apiRoot('whois/getcountry/?ip=' + ip, 'core');
        return this._ajaxM.get({ url: url });
    }
    sendContactSupport(item) {
        const url = this._startUp.apiRoot('support/cert', 'core');
        return this._ajaxM.post({ url: url, data: item });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CryptoSignService, deps: [{ token: Startup }, { token: i1$8.MatDialog }, { token: AjaxService }, { token: AttorneyService }, { token: AttorneyRunService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CryptoSignService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CryptoSignService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: i1$8.MatDialog }, { type: AjaxService }, { type: AttorneyService }, { type: AttorneyRunService }] });

class SupportDialogWindow extends CoreBaseDestroyComponent {
    constructor(_dialogRef, _popup, _service) {
        super();
        this._dialogRef = _dialogRef;
        this._popup = _popup;
        this._service = _service;
        this.item = {
            name: "",
            phone: ""
        };
    }
    send() {
        this._service
            .sendContactSupport(this.item)
            .pipe(this.takeUntilDestroyed())
            .subscribe((resposne) => {
            this._popup.HandleIResponse({
                response: resposne,
                msg: 'Обращение направлено в техподдержку',
                successCallback: () => {
                    this._dialogRef.close(true);
                }
            });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SupportDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: PopupResults }, { token: CryptoSignService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: SupportDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u041E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0435 \u0432 \u0442\u0435\u0445\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443\" width=\"500\">\n    <div body>\n        <form #editForm=\"ngForm\" novalidate>\n            <div>\n                <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n                    <div class=\"form-group\">\n                        <core-field-string [(ngModel)]=\"item.name\" name=\"name\" fieldName=\"name\" placeholder=\"\u0418\u043C\u044F\"\n                            [settings]=\"{ isRequired: true, maxLength: 100}\"></core-field-string>\n                    </div>\n                </div>\n                <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n                    <div class=\"form-group\">\n                        <core-field-phone [(ngModel)]=\"item.phone\" name=\"phone\" fieldName=\"phone\" labelClass=\"sln-gray-label\"\n                            placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430\" [settings]=\"{ isRequired: true }\"></core-field-phone>\n                    </div>\n                </div>\n            </div>\n        </form>\n    </div>\n    <div footer>\n        <button class=\"btn-primary\" (click)=\"send()\" [disabled]=\"editForm.invalid\">\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C</button>\n    </div>\n</core-dialog>", dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldPhoneComponent, selector: "core-field-phone" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SupportDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u041E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0435 \u0432 \u0442\u0435\u0445\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443\" width=\"500\">\n    <div body>\n        <form #editForm=\"ngForm\" novalidate>\n            <div>\n                <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n                    <div class=\"form-group\">\n                        <core-field-string [(ngModel)]=\"item.name\" name=\"name\" fieldName=\"name\" placeholder=\"\u0418\u043C\u044F\"\n                            [settings]=\"{ isRequired: true, maxLength: 100}\"></core-field-string>\n                    </div>\n                </div>\n                <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n                    <div class=\"form-group\">\n                        <core-field-phone [(ngModel)]=\"item.phone\" name=\"phone\" fieldName=\"phone\" labelClass=\"sln-gray-label\"\n                            placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430\" [settings]=\"{ isRequired: true }\"></core-field-phone>\n                    </div>\n                </div>\n            </div>\n        </form>\n    </div>\n    <div footer>\n        <button class=\"btn-primary\" (click)=\"send()\" [disabled]=\"editForm.invalid\">\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C</button>\n    </div>\n</core-dialog>" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: PopupResults }, { type: CryptoSignService }] });

class CertificateListWindow extends CoreBaseDestroyComponent {
    get showButtonCertificates() {
        return this.certificateSignListControl?.showCertificates;
    }
    constructor(dialogRef, _cd, _cryptoSignService, data) {
        super();
        this.dialogRef = dialogRef;
        this._cd = _cd;
        this._cryptoSignService = _cryptoSignService;
        this.data = data;
    }
    ngAfterViewInit() {
        this._cd.detectChanges();
    }
    showCertificateTitle() {
        return this.certificateSignListControl?._dataSourceClient.length > 0 ? "Выбор сертификата" : "СЕРТИФИКАТ КЭП НЕ НАЙДЕН";
    }
    showSearch(_) {
        if (this.certificateSignListControl?.showCertificates) {
            this.certificateSignListControl.isShowSearch = !this.certificateSignListControl.isShowSearch;
            this.certificateSignListControl.clearInput();
        }
        else {
            this.dialogRef.close();
        }
    }
    sign($event) {
        const row = $event ?? this.certificateSignListControl._selection.selected[0];
        this._cryptoSignService.prepareCertificate(row, this.data?.isLogin, this.data?.useOnlyDirector, (cert) => {
            this.dialogRef.close(cert);
        });
    }
    sendContactSupport() {
        CoreDialog.window(SupportDialogWindow, undefined, () => {
            this.dialogRef.close();
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CertificateListWindow, deps: [{ token: i1$8.MatDialogRef }, { token: i0.ChangeDetectorRef }, { token: CryptoSignService }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CertificateListWindow, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "certificateSignListControl", first: true, predicate: ["certificateSignListControl"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<core-dialog [dialogTitle]=\"showCertificateTitle()\" [hasCansel]=\"false\" width=\"650\" class=\"sln-select-sertificate\">\n  <div header class=\"sln-search-button\">\n    <button (click)=\"showSearch($event)\">\n      @if (certificateSignListControl.showCertificates) {\n        <div class=\"sln-chat-search\"></div>\n      }\n      @if (!certificateSignListControl.showCertificates) {\n        <div class=\"sln-common-cross-table\"></div>\n      }\n    </button>\n  </div>\n  <div body class=\"certificate-list\">\n    <core-certificate-sign-list (doubleClick)=\"sign($event)\" #certificateSignListControl></core-certificate-sign-list>\n  </div>\n  <div footer class=\"sln-sertificate-footer\">\n    @if (showButtonCertificates) {\n      <button type=\"button\" class=\"light-btn-primary\" (click)=\"sign()\" [disabled]=\"!certificateSignListControl._selection.hasValue()\">\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u0442\u044C</button>\n    }\n    @if (!showButtonCertificates) {\n      <div class=\"certificate-footer\" >\n        <div class=\"certicates-title\"><p>\u0412\u0441\u0451 \u0441\u0434\u0435\u043B\u0430\u043D\u043E \u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u043E, \u043D\u043E \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442? <br>\n        \u041E\u0442\u043F\u0440\u0430\u0432\u044C\u0442\u0435 \u0437\u0430\u044F\u0432\u043A\u0443, \u043C\u044B \u043F\u043E\u043C\u043E\u0436\u0435\u043C \u0443\u0434\u0430\u043B\u0435\u043D\u043E</p></div>\n        <button class=\"btn-primary\" (click)=\"sendContactSupport()\">\u0422\u0415\u0425\u041F\u041E\u0414\u0414\u0415\u0420\u0416\u041A\u0410</button>\n      </div>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-setificate-footer{display:flex;justify-content:flex-start;align-items:center}.sln-setificate-footer img{position:absolute;left:68.5%}.sln-setificate-footer__button{width:182px;height:44px;background:var(--WHITE);border:2px solid var(--PRIMARY);border-radius:5px;text-transform:uppercase;cursor:pointer}.sln-setificate-footer__button:active{border:2px solid var(--PRIMARY);outline:none!important}.sln-setificate-footer__button:focus{border:2px solid var(--PRIMARY);outline:none!important}.sln-search-button button{background:transparent;border:none;outline:none;line-height:0;cursor:pointer}.row{display:flex;align-items:center;justify-content:center}.sln-pencil{background:none;position:absolute;z-index:2;left:63%;top:90%}.common-btn{width:200px;color:var(--PRIMARY);border:2px solid var(--PRIMARY);font-size:15px;letter-spacing:.032em}.certificate-footer{display:flex;justify-content:space-between;width:100%;align-items:center}.certificate-footer .certicates-title{display:flex;justify-content:flex-start}.certificate-footer .certicates-title p{font-size:13px;text-transform:none;text-align:start}.sln-sertificate-footer{width:100%;display:flex;justify-content:flex-end}\n"], dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: CertificateListComponent, selector: "core-certificate-sign-list", outputs: ["doubleClick"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CertificateListWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog [dialogTitle]=\"showCertificateTitle()\" [hasCansel]=\"false\" width=\"650\" class=\"sln-select-sertificate\">\n  <div header class=\"sln-search-button\">\n    <button (click)=\"showSearch($event)\">\n      @if (certificateSignListControl.showCertificates) {\n        <div class=\"sln-chat-search\"></div>\n      }\n      @if (!certificateSignListControl.showCertificates) {\n        <div class=\"sln-common-cross-table\"></div>\n      }\n    </button>\n  </div>\n  <div body class=\"certificate-list\">\n    <core-certificate-sign-list (doubleClick)=\"sign($event)\" #certificateSignListControl></core-certificate-sign-list>\n  </div>\n  <div footer class=\"sln-sertificate-footer\">\n    @if (showButtonCertificates) {\n      <button type=\"button\" class=\"light-btn-primary\" (click)=\"sign()\" [disabled]=\"!certificateSignListControl._selection.hasValue()\">\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u0442\u044C</button>\n    }\n    @if (!showButtonCertificates) {\n      <div class=\"certificate-footer\" >\n        <div class=\"certicates-title\"><p>\u0412\u0441\u0451 \u0441\u0434\u0435\u043B\u0430\u043D\u043E \u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u043E, \u043D\u043E \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442? <br>\n        \u041E\u0442\u043F\u0440\u0430\u0432\u044C\u0442\u0435 \u0437\u0430\u044F\u0432\u043A\u0443, \u043C\u044B \u043F\u043E\u043C\u043E\u0436\u0435\u043C \u0443\u0434\u0430\u043B\u0435\u043D\u043E</p></div>\n        <button class=\"btn-primary\" (click)=\"sendContactSupport()\">\u0422\u0415\u0425\u041F\u041E\u0414\u0414\u0415\u0420\u0416\u041A\u0410</button>\n      </div>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-setificate-footer{display:flex;justify-content:flex-start;align-items:center}.sln-setificate-footer img{position:absolute;left:68.5%}.sln-setificate-footer__button{width:182px;height:44px;background:var(--WHITE);border:2px solid var(--PRIMARY);border-radius:5px;text-transform:uppercase;cursor:pointer}.sln-setificate-footer__button:active{border:2px solid var(--PRIMARY);outline:none!important}.sln-setificate-footer__button:focus{border:2px solid var(--PRIMARY);outline:none!important}.sln-search-button button{background:transparent;border:none;outline:none;line-height:0;cursor:pointer}.row{display:flex;align-items:center;justify-content:center}.sln-pencil{background:none;position:absolute;z-index:2;left:63%;top:90%}.common-btn{width:200px;color:var(--PRIMARY);border:2px solid var(--PRIMARY);font-size:15px;letter-spacing:.032em}.certificate-footer{display:flex;justify-content:space-between;width:100%;align-items:center}.certificate-footer .certicates-title{display:flex;justify-content:flex-start}.certificate-footer .certicates-title p{font-size:13px;text-transform:none;text-align:start}.sln-sertificate-footer{width:100%;display:flex;justify-content:flex-end}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: i0.ChangeDetectorRef }, { type: CryptoSignService }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }], propDecorators: { certificateSignListControl: [{
                type: ViewChild,
                args: ['certificateSignListControl']
            }] } });

class CoreFileSignaturesComponent extends CoreBaseDestroyComponent {
    constructor(_dialog, _ajaxM, _cryptoSignM, _popupM) {
        super();
        this._dialog = _dialog;
        this._ajaxM = _ajaxM;
        this._cryptoSignM = _cryptoSignM;
        this._popupM = _popupM;
        this.newCurrent = new EventEmitter();
    }
    ngOnInit() {
        this._cryptoSignM.loadFileSignatures(this.fileId)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popupM.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.signatures = entity;
                if (this.signatures.length > 0) {
                    this.current = this.signatures[0];
                    this.newCurrent.emit(this.current);
                    this.initAuthority();
                }
            }
        }));
    }
    download(url) {
        this._ajaxM.download({
            url: url
        });
    }
    viewSignature(selected) {
        this.current = selected;
        this.newCurrent.emit(this.current);
        this.initAuthority();
    }
    uploadAuthFile(e) {
        if (e.target.files) {
            const reader = new FileReader();
            reader.readAsDataURL(e.target.files[0]);
            reader.onload = () => {
                const result = reader.result.toString();
                const upload = {
                    isVersioned: false,
                    multiId: null,
                    typeId: null,
                    fileName: e.target.files[0].name,
                    isTemp: false,
                    hiddenLink: false,
                    content: result.substr(result.indexOf(',') + 1)
                };
                this._cryptoSignM.saveAuthFile(upload).subscribe((response) => {
                    if (response.isSuccess) {
                        this.current.authorityFileUrl = response.entity.fileUrl;
                        const msg = "Файл доверенности успешно добавлен";
                        this._cryptoSignM.addAuthFile(this.current.signId, response.entity.fileId).subscribe((res) => this._popupM.HandleIEntityResponse({
                            response: res,
                            msg: msg
                        }));
                        var authFile = document.getElementById('authFile_' + this.current.signId);
                        authFile.setAttribute('href', this.current.authorityFileUrl);
                    }
                    else {
                        this._dialog.open(CoreInfoDialogWindow, {
                            data: new InfoDiologConfig(InfoType.Danger, response.message)
                        });
                    }
                });
            };
        }
    }
    showCountryAlert(countryCode) {
        if (countryCode === "RU") {
            return false;
        }
        return true;
    }
    initAuthority() {
        switch (this.current.authority) {
            case AuthorityEnum.Ceo: {
                this.authority = "Единоличный исполнительный орган";
                break;
            }
            case AuthorityEnum.NotCeo: {
                this.authority = "Действует по доверенности";
                break;
            }
            case AuthorityEnum.Ip: {
                this.authority = "Индивидуальный предприниматель";
                break;
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignaturesComponent, deps: [{ token: i1$8.MatDialog }, { token: AjaxService }, { token: CryptoSignService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFileSignaturesComponent, isStandalone: false, selector: "core-file-signatures", inputs: { fileId: "fileId" }, outputs: { newCurrent: "newCurrent" }, usesInheritance: true, ngImport: i0, template: "@if (current) {\n  <div class=\"row\">\n    <input id=\"authFile_{{current.signId}}\" name=\"authFile_{{current.signId}}\" type=\"file\" style=\"display:none\" (change)=\"uploadAuthFile($event)\">\n    <div ticketsVersionsMenu class=\"left-menu\">\n      <div class=\"file-signatures-left\">\n        <div class=\"header\">\n          <h4>\u0410\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u043F\u043E\u0434\u043F\u0438\u0441\u0438</h4>\n        </div>\n        <ng-scrollbar style=\"height: 210px;\">\n          <ul class=\"nav nav-tabs\">\n            @for (signature of signatures; track signature; let i = $index) {\n              <li class=\"b-full-width {{ signature?.signId === current?.signId ? 'sln-selected-document-type' : ''}}\">\n                <a class=\"nav-link {{ signature?.signId === current?.signId ? 'b-current-document' : '' }}\" data-toggle=\"tab\" (click)=\"viewSignature(signature)\">\n                  <span>{{ signature?.userName }}</span><br />\n                  <small>{{ signature?.organization }}</small>\n                </a>\n              </li>\n            }\n          </ul>\n        </ng-scrollbar>\n      </div>\n    </div>\n    <div class=\"file-right-info\">\n      <table class=\"table table-hover\">\n        <tbody>\n          <div class=\"table-item\">\n            <div class=\"sln-certificate-owner sln-certificate-owner-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td width=\"230px\" class=\"name-item\"><span class=\"items-header\">\u0432\u043B\u0430\u0434\u0435\u043B\u044C\u0446 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span></td>\n              <td class=\"text-center\"><span class=\"items-text\">{{ current?.userName }}</span> </td>\n            </tr>\n            <tr class=\"s-items\">\n              <div class=\"s-items-l\">\n                <td width=\"230px\" class=\"name-item\"><span class=\"items-header\">\u041F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F:</span></td>\n                <td class=\"text-center\" width=\"230px\">\n                  @if (current.authorityFileUrl) {\n                    <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u044C\" matTooltipPosition=\"above\"  >\n                      <a id=\"authFile_{{current.signId}}\" (click)=\"download(current.authorityFileUrl)\" >{{ authority }}</a>\n                    </div>\n                  }\n                  @if (!current.authorityFileUrl) {\n                    <span>{{ authority }}</span>\n                  }\n                </td>\n              </div>\n              <div class=\"s-items-r\">\n                <td>\n                  <label for=\"authFile_{{current.signId}}\">\n                    <p>\u041F\u0440\u0438\u043B\u043E\u0436\u0438\u0442\u044C \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u044C</p>\n                    <div class=\"sln-attach-power-of-attorney sln-attach-power-of-attorney-position add\"></div>\n                  </label>\n                </td>\n              </div>\n            </tr>\n          </div>\n          <div class=\"table-item\">\n            <div class=\"sln-file-name-signature sln-file-name-signature-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td class=\"name-item\"><span class=\"items-header\">\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0444\u0430\u0439\u043B\u0430:</span> </td>\n              <td class=\"items-text\">\n                <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\" matTooltipPosition=\"above\"  >\n                  <a  (click)=\"download(current?.fileUrl)\">\n                    {{ current?.fileName }}\n                  </a>\n                </div>\n              </td>\n            </tr>\n            <tr class=\"s-items\">\n              <td class=\"name-item\"><span class=\"items-header-small\">\u0420\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430 - &nbsp;</span> </td>\n              <td class=\"items-header-small\">{{ current?.fileSize }}</td>\n            </tr>\n          </div>\n          <!-- <tr>\n          <td class=\"name-item\"><span>\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span> </td>\n          <td class=\"text-center\">{{ current?.validFrom | dateTimeRu }}</td>\n        </tr> -->\n        <div class=\"table-item\">\n          <div class=\"sln-certificate-number sln-certificate-number-position back-img\"></div>\n          <tr class=\"f-items\">\n            <td class=\"name-item\"><span class=\"items-header\">\u041D\u043E\u043C\u0435\u0440 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span> </td>\n            <td class=\"text-center\">\n              <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\" matTooltipPosition=\"above\"  >\n                <a class=\"save-sert\" target=\"_blank\" [href]=\"current?.certificateUrl\">\n                  {{ current?.serialNumber }}\n                </a>\n              </div>\n            </td>\n          </tr>\n          <tr class=\"s-items\">\n            <div class=\"s-items-l\">\n              <td class=\"name-item\"><span class=\"items-header\">\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D</span> </td>\n              <td class=\"date\">{{ current?.signingTime | dateTimeRu }}</td>\n            </div>\n            <div class=\"s-items-r-2\">\n              <td class=\"name-item\"><span class=\"items-header\">\u0421\u0440\u043E\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F</span> </td>\n              <td class=\"time\"> {{ current?.validFrom | dateTimeRu }} - {{ current?.validTo | dateTimeRu }}</td>\n            </div>\n          </tr>\n        </div>\n        <div class=\"table-item\">\n          <div class=\"sln-ip-address-signature sln-ip-address-signature-position back-img\"></div>\n          <tr>\n            <td class=\"name-item\"><span class=\"items-header\">IP-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442\u0430:</span> </td>\n            <td class=\"items-text\">{{ current?.signerIp ?? \"  -  \" }}</td>\n          </tr>\n          @if (showCountryAlert(current?.signerCountryCode)) {\n            <tr>\n              <td><p class=\"items-text-ip\">IP-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442\u0430 \u043D\u0435 \u043F\u0440\u0438\u043D\u0430\u0434\u043B\u0435\u0436\u0438\u0442 \u0442\u0435\u0440\u0440\u0438\u0442\u043E\u0440\u0438\u0438 \u0420\u0424.</p></td>\n            </tr>\n          }\n        </div>\n      </tbody>\n    </table>\n  </div>\n</div>\n}\n", dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "pipe", type: RuDateTimePipe, name: "dateTimeRu" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFileSignaturesComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-file-signatures', standalone: false, template: "@if (current) {\n  <div class=\"row\">\n    <input id=\"authFile_{{current.signId}}\" name=\"authFile_{{current.signId}}\" type=\"file\" style=\"display:none\" (change)=\"uploadAuthFile($event)\">\n    <div ticketsVersionsMenu class=\"left-menu\">\n      <div class=\"file-signatures-left\">\n        <div class=\"header\">\n          <h4>\u0410\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u043F\u043E\u0434\u043F\u0438\u0441\u0438</h4>\n        </div>\n        <ng-scrollbar style=\"height: 210px;\">\n          <ul class=\"nav nav-tabs\">\n            @for (signature of signatures; track signature; let i = $index) {\n              <li class=\"b-full-width {{ signature?.signId === current?.signId ? 'sln-selected-document-type' : ''}}\">\n                <a class=\"nav-link {{ signature?.signId === current?.signId ? 'b-current-document' : '' }}\" data-toggle=\"tab\" (click)=\"viewSignature(signature)\">\n                  <span>{{ signature?.userName }}</span><br />\n                  <small>{{ signature?.organization }}</small>\n                </a>\n              </li>\n            }\n          </ul>\n        </ng-scrollbar>\n      </div>\n    </div>\n    <div class=\"file-right-info\">\n      <table class=\"table table-hover\">\n        <tbody>\n          <div class=\"table-item\">\n            <div class=\"sln-certificate-owner sln-certificate-owner-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td width=\"230px\" class=\"name-item\"><span class=\"items-header\">\u0432\u043B\u0430\u0434\u0435\u043B\u044C\u0446 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span></td>\n              <td class=\"text-center\"><span class=\"items-text\">{{ current?.userName }}</span> </td>\n            </tr>\n            <tr class=\"s-items\">\n              <div class=\"s-items-l\">\n                <td width=\"230px\" class=\"name-item\"><span class=\"items-header\">\u041F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F:</span></td>\n                <td class=\"text-center\" width=\"230px\">\n                  @if (current.authorityFileUrl) {\n                    <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u044C\" matTooltipPosition=\"above\"  >\n                      <a id=\"authFile_{{current.signId}}\" (click)=\"download(current.authorityFileUrl)\" >{{ authority }}</a>\n                    </div>\n                  }\n                  @if (!current.authorityFileUrl) {\n                    <span>{{ authority }}</span>\n                  }\n                </td>\n              </div>\n              <div class=\"s-items-r\">\n                <td>\n                  <label for=\"authFile_{{current.signId}}\">\n                    <p>\u041F\u0440\u0438\u043B\u043E\u0436\u0438\u0442\u044C \u0434\u043E\u0432\u0435\u0440\u0435\u043D\u043D\u043E\u0441\u0442\u044C</p>\n                    <div class=\"sln-attach-power-of-attorney sln-attach-power-of-attorney-position add\"></div>\n                  </label>\n                </td>\n              </div>\n            </tr>\n          </div>\n          <div class=\"table-item\">\n            <div class=\"sln-file-name-signature sln-file-name-signature-position back-img\"></div>\n            <tr class=\"f-items\">\n              <td class=\"name-item\"><span class=\"items-header\">\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0444\u0430\u0439\u043B\u0430:</span> </td>\n              <td class=\"items-text\">\n                <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\" matTooltipPosition=\"above\"  >\n                  <a  (click)=\"download(current?.fileUrl)\">\n                    {{ current?.fileName }}\n                  </a>\n                </div>\n              </td>\n            </tr>\n            <tr class=\"s-items\">\n              <td class=\"name-item\"><span class=\"items-header-small\">\u0420\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430 - &nbsp;</span> </td>\n              <td class=\"items-header-small\">{{ current?.fileSize }}</td>\n            </tr>\n          </div>\n          <!-- <tr>\n          <td class=\"name-item\"><span>\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span> </td>\n          <td class=\"text-center\">{{ current?.validFrom | dateTimeRu }}</td>\n        </tr> -->\n        <div class=\"table-item\">\n          <div class=\"sln-certificate-number sln-certificate-number-position back-img\"></div>\n          <tr class=\"f-items\">\n            <td class=\"name-item\"><span class=\"items-header\">\u041D\u043E\u043C\u0435\u0440 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u0430:</span> </td>\n            <td class=\"text-center\">\n              <div matTooltip=\"\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442\" matTooltipPosition=\"above\"  >\n                <a class=\"save-sert\" target=\"_blank\" [href]=\"current?.certificateUrl\">\n                  {{ current?.serialNumber }}\n                </a>\n              </div>\n            </td>\n          </tr>\n          <tr class=\"s-items\">\n            <div class=\"s-items-l\">\n              <td class=\"name-item\"><span class=\"items-header\">\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D</span> </td>\n              <td class=\"date\">{{ current?.signingTime | dateTimeRu }}</td>\n            </div>\n            <div class=\"s-items-r-2\">\n              <td class=\"name-item\"><span class=\"items-header\">\u0421\u0440\u043E\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F</span> </td>\n              <td class=\"time\"> {{ current?.validFrom | dateTimeRu }} - {{ current?.validTo | dateTimeRu }}</td>\n            </div>\n          </tr>\n        </div>\n        <div class=\"table-item\">\n          <div class=\"sln-ip-address-signature sln-ip-address-signature-position back-img\"></div>\n          <tr>\n            <td class=\"name-item\"><span class=\"items-header\">IP-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442\u0430:</span> </td>\n            <td class=\"items-text\">{{ current?.signerIp ?? \"  -  \" }}</td>\n          </tr>\n          @if (showCountryAlert(current?.signerCountryCode)) {\n            <tr>\n              <td><p class=\"items-text-ip\">IP-\u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442\u0430 \u043D\u0435 \u043F\u0440\u0438\u043D\u0430\u0434\u043B\u0435\u0436\u0438\u0442 \u0442\u0435\u0440\u0440\u0438\u0442\u043E\u0440\u0438\u0438 \u0420\u0424.</p></td>\n            </tr>\n          }\n        </div>\n      </tbody>\n    </table>\n  </div>\n</div>\n}\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }, { type: AjaxService }, { type: CryptoSignService }, { type: PopupResults }], propDecorators: { fileId: [{
                type: Input
            }], newCurrent: [{
                type: Output
            }] } });

class CoreCryptoModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCryptoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreCryptoModule, declarations: [CertificateListComponent,
            CertificateListWindow,
            SupportDialogWindow,
            CoreFileSignaturesComponent,
            FilterCertPipe], imports: [CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreBaseModule,
            CoreAttorneyModule,
            CoreControlModule,
            CoreNotificationModule,
            CoreContactVerificationModule], exports: [CertificateListComponent,
            CertificateListWindow,
            SupportDialogWindow,
            CoreFileSignaturesComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCryptoModule, providers: [
            CryptoSignService
        ], imports: [CoreMatModule,
            CoreDialogModule,
            CorePipeModule,
            CoreBaseModule,
            CoreAttorneyModule,
            CoreControlModule,
            CoreNotificationModule,
            CoreContactVerificationModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCryptoModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CertificateListComponent,
                        CertificateListWindow,
                        SupportDialogWindow,
                        CoreFileSignaturesComponent,
                        FilterCertPipe
                    ],
                    imports: [
                        CoreMatModule,
                        CoreDialogModule,
                        CorePipeModule,
                        CoreBaseModule,
                        CoreAttorneyModule,
                        CoreControlModule,
                        CoreNotificationModule,
                        CoreContactVerificationModule
                    ],
                    providers: [
                        CryptoSignService
                    ],
                    exports: [
                        CertificateListComponent,
                        CertificateListWindow,
                        SupportDialogWindow,
                        CoreFileSignaturesComponent
                    ]
                }]
        }] });

var MessageStatus;
(function (MessageStatus) {
    MessageStatus[MessageStatus["Send"] = 1] = "Send";
    MessageStatus[MessageStatus["Read"] = 2] = "Read";
    MessageStatus[MessageStatus["NotSend"] = 3] = "NotSend";
})(MessageStatus || (MessageStatus = {}));
class Message {
}
class MessageHistory {
}

class DrawerNames {
    static { this.LIST = 'CHAT_ LIST'; }
    static { this.USER_LIST = 'USER_LIST'; }
    static { this.GROUP = 'GROUP'; }
    static { this.DIALOG = 'DIALOG'; }
    static { this.PROFILE = 'PROFILE'; }
    static { this.FORWARD = 'FORWARD'; }
}

class SellanChatMessageService {
    constructor(_startUpM, _signalRService, _chatUserService, _ajaxM, _notificationService, _eventBroker) {
        this._startUpM = _startUpM;
        this._signalRService = _signalRService;
        this._chatUserService = _chatUserService;
        this._ajaxM = _ajaxM;
        this._notificationService = _notificationService;
        this._eventBroker = _eventBroker;
        this.page = 0;
        this.pageSize = 30;
        this.messages = [];
        this.isLoading = false;
        this.messagesRanOut = false;
        this._notificationService.isNotify.subscribe(z => {
            if (this.roomId == z.roomId) {
                this.addMessage(z);
            }
            this._eventBroker.emit('drawer-closed-event', { name: DrawerNames.DIALOG, data: { needReload: true } });
        });
        this._signalRService.pendingMessages$.subscribe(msgs => {
            this.storageMessages = msgs;
        });
    }
    getMessages() {
        let storageMessages = this.storageMessages;
        if (storageMessages != null && !!storageMessages && storageMessages.length > 0) {
            storageMessages.forEach(item => {
                if (this.messages.filter(c => c.cacheMessageId == item.cacheMessageId
                    && c.roomId == item.roomId).length == 0) {
                    this.messages.push({
                        messageType: item.messageType ?? 0,
                        content: item.content,
                        cacheMessageId: item.cacheMessageId,
                        status: MessageStatus.NotSend,
                        roomId: item.roomId,
                        userId: item.userId,
                        parentMessageId: !!item.parentMessageId ? item.parentMessageId.toString() : null,
                        id: new Guid('00000000-0000-0000-0000-000000000000'),
                        from: "",
                        type: 'sent',
                        timestamp: null,
                        parentMessageType: item.parentMessageType,
                        history: { statusCode: MessageStatus.NotSend }
                    });
                }
            });
        }
        else {
            this.messages = this.messages.filter(z => !z.id.equals('00000000-0000-0000-0000-000000000000'));
        }
        return this.messages;
    }
    deleteMessageById(id) {
        this.messages = this.messages.filter(message => message.id !== id);
    }
    deleteMessageByCacheId(id) {
        this.messages = this.messages.filter(message => message.cacheMessageId !== id);
    }
    clearMessages() {
        this.messages = [];
    }
    updatePageMessages(roomId) {
        this.roomId = roomId;
        return this.getRoomHistory(roomId).pipe(map((z) => {
            z.entity.map(x => {
                x.type = x.userId === this._chatUserService.chatUser.id ? 'sent' : 'received';
                x.id = new Guid(x.id);
                return x;
            });
            if (z.entity.length == 0) {
                this.messagesRanOut = true;
            }
            this.isLoading = false;
            return this.messages = this.messages.concat(z.entity);
        }));
    }
    loadAllFoundMessages(searchMessagesIds) {
        const missingGuids = searchMessagesIds.filter(guid => !this.messages.some(msg => msg.id.equals(guid)));
        if (missingGuids.length === 0) {
            this.markMessageAsFound(searchMessagesIds, true);
            return;
        }
        this.nextPage();
        this.updatePageMessages(this.roomId).subscribe(z => {
            if (z.length == 0) {
                return;
            }
            this.loadAllFoundMessages(searchMessagesIds);
        });
    }
    markMessageAsFound(searchMessagesIds, foundFlag) {
        for (let msg of this.messages) {
            if (searchMessagesIds.includes(msg.id.toString())) {
                msg.found = foundFlag;
            }
        }
    }
    getRoomHistory(roomId) {
        this.roomId = roomId;
        this.isLoading = true;
        const url = this._startUpM.apiRoot('chat/history/' + roomId, 'core');
        const query = '?page=' + this.page + '&pageSize=' + this.pageSize;
        return this._ajaxM.get({ url: url + query });
    }
    markAttachmentBySign(fileId) {
        const url = this._startUpM.apiRoot('chat/mark-attachment-to-sign/' + fileId, 'core');
        return this._ajaxM.put({ url: url });
    }
    addMessage(msg) {
        this.messages.unshift({
            id: new Guid(msg.id),
            messageType: msg.messageType ?? 0,
            from: msg.userFullName,
            userId: msg.userId,
            roomId: msg.roomId,
            content: msg.content,
            parentMessageType: msg.parentMessageType,
            parentMessageId: msg.parentMessageId,
            parentMessageContent: msg.parentMessageContent,
            parentMessageUserName: msg.parentMessageUserName,
            type: msg.userId === this._chatUserService.chatUser.id ? 'sent' : 'received',
            status: MessageStatus.Send,
            timestamp: msg.timestamp,
            isAttachment: msg.isAttachment,
            attachmentId: msg.attachmentId,
            hasSignature: false,
            history: { statusCode: MessageStatus.Send }
        });
    }
    sendMessage(message, roomId) {
        if (message.content.trim() === '') {
            return;
        }
        this._signalRService.sendMessage(message, this._chatUserService.chatUser.id, roomId);
    }
    forwardMessage(message, roomId) {
        this._signalRService.sendMessage(message, this._chatUserService.chatUser.id, roomId);
    }
    sendAttachmentMessage(fileData, roomId) {
        this._signalRService.sendMessage({ content: '' }, this._chatUserService.chatUser.id, roomId, fileData);
    }
    nextPage() {
        this.page = ++this.page;
    }
    getPage() {
        return this.page;
    }
    getPageSize() {
        return this.pageSize;
    }
    resetPage() {
        this.page = 0;
        this.messagesRanOut = false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatMessageService, deps: [{ token: Startup }, { token: SignalRService }, { token: SellanChatUsersService }, { token: AjaxService }, { token: SellanChatNotificationService }, { token: EventBrokerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatMessageService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatMessageService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: Startup }, { type: SignalRService }, { type: SellanChatUsersService }, { type: AjaxService }, { type: SellanChatNotificationService }, { type: EventBrokerService }] });

class Chat {
}
class IChatConfig {
}

class CoreChatAbstractComponent extends CoreBaseDestroyComponent {
    constructor(_cryptoM, _popupM, _chatMessageService, _chatUserService) {
        super();
        this._cryptoM = _cryptoM;
        this._popupM = _popupM;
        this._chatMessageService = _chatMessageService;
        this._chatUserService = _chatUserService;
    }
    ngOnInit() {
        this.uploadConfig = new UploaderConfig();
        this.uploadConfig.isAchiveFile = false;
        this.uploadConfig.miniButton = true;
        this.uploadConfig.multiple = false;
        this.uploadConfig.hiddenLink = true;
        this.uploadConfig.typeId = FileTypeEnum.ChatAttachment;
        this.uploadConfig.callback = (z) => {
            this._chatMessageService.sendAttachmentMessage(z, this.chat.id);
        };
    }
    signFile(fileId) {
        this._cryptoM.signFiles([{ fileId: fileId }], false, (_) => {
            this._chatMessageService
                .markAttachmentBySign(fileId)
                .pipe(this.takeUntilDestroyed())
                .subscribe((response) => this._popupM.HandleIResponse({
                response: response,
                successCallback: () => {
                    this.updateRoomHistory(this.chat.id);
                }
            }));
        });
    }
    showSignFile(fileId) {
        CoreDialog.window(CoreFileSignaturesWindow, { fileId: fileId });
    }
    updateRoomHistory(roomId) {
        this._chatMessageService
            .getRoomHistory(roomId)
            .pipe(this.takeUntilDestroyed())
            .subscribe((z) => this._popupM.HandleIEntityResponse({
            response: z,
            successCallback: (entity) => {
                this._chatMessageService.isLoading = false;
                this._chatMessageService.messages = entity.map(x => {
                    x.type = x.userId === this._chatUserService.chatUser.id ? 'sent' : 'received';
                    x.id = new Guid(x.id);
                    return x;
                });
                this._chatUserService.getUserChats().pipe(this.takeUntilDestroyed()).subscribe();
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatAbstractComponent, deps: [{ token: CryptoSignService }, { token: PopupResults }, { token: SellanChatMessageService }, { token: SellanChatUsersService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreChatAbstractComponent, isStandalone: false, selector: "ng-component", inputs: { chat: "chat" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatAbstractComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: CryptoSignService }, { type: PopupResults }, { type: SellanChatMessageService }, { type: SellanChatUsersService }], propDecorators: { chat: [{
                type: Input
            }] } });

class SellanChatSearchMessagesService {
    constructor(_startUpM, _ajaxM, _messageService) {
        this._startUpM = _startUpM;
        this._ajaxM = _ajaxM;
        this._messageService = _messageService;
        this.searchMessagesId = [];
        this.messages = [];
    }
    getSearchMessagesResult(searchText, roomId) {
        const url = this._startUpM.apiRoot('chat/search/' + searchText, 'core');
        const query = '?roomId=' + roomId;
        return this._ajaxM.get({ url: url + query });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatSearchMessagesService, deps: [{ token: Startup }, { token: AjaxService }, { token: SellanChatMessageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatSearchMessagesService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatSearchMessagesService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }, { type: SellanChatMessageService }] });

class SellanChatSearchMessageComponent extends CoreAbstractComponent {
    constructor(_searchService, _messageService) {
        super();
        this._searchService = _searchService;
        this._messageService = _messageService;
        this.searchMessagesIds = [];
        this.messages = [];
        this.indexOfFound = 0;
        this.countOfFound = 0;
        this.searching = false;
        this.searchText = null;
        this.showSearchBar = false;
        this.lastScrolledMessageId = null;
        this.buttonText = '↩︎';
        this.disabled = false;
        this.focus = new EventEmitter();
        this.send = new EventEmitter();
        this.dismiss = new EventEmitter();
        this.searchGoTo = new EventEmitter();
    }
    ngOnInit() {
        this.focus.subscribe(() => this.focusMessage());
    }
    focusMessage() {
        this.message.nativeElement.focus();
    }
    getSearchText() {
        return this.message.nativeElement.value;
    }
    resetSearch() {
        this.indexOfFound = 0;
        this.countOfFound = 0;
        this.searchText = null;
        this._messageService.markMessageAsFound(this.searchMessagesIds, false);
    }
    clearMessage() {
        this.resetSearch();
        this.searching = false;
        this.message.nativeElement.value = '';
    }
    searchMessage() {
        this.resetSearch();
        this.searching = true;
        const text = this.getSearchText().trim();
        if (!text)
            return;
        this.searchText = text;
        this._searchService.getSearchMessagesResult(this.searchText, this.roomId).subscribe(z => {
            const uniqueIds = z.entity;
            this._messageService.loadAllFoundMessages(uniqueIds);
            this.expandAndCount(uniqueIds);
        });
    }
    expandAndCount(uniqueIds) {
        const re = new RegExp(this.escapeRegex(this.searchText), 'igm');
        const expanded = [];
        for (const msgId of uniqueIds) {
            const msg = this._messageService.getMessages().find(m => m.id.toString() === msgId);
            if (!msg)
                continue;
            const matches = msg.content.match(re) || [];
            // добавляем msgId столько раз, сколько совпадений
            for (let i = 0; i < matches.length; i++) {
                expanded.push(msgId);
            }
        }
        this.searchMessagesIds = expanded;
        this.countOfFound = expanded.length;
        if (this.countOfFound > 0) {
            this.indexOfFound = 1;
            this.scrollToMessage();
            // отмечаем все сообщения, где есть хоть одно совпадение
            this._messageService.markMessageAsFound(uniqueIds, true);
        }
    }
    escapeRegex(s) {
        return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
    }
    findNext() {
        this.indexOfFound = this.indexOfFound < this.searchMessagesIds.length ? ++this.indexOfFound : this.indexOfFound;
        this.scrollToMessage();
    }
    findPrevious() {
        this.indexOfFound = this.indexOfFound > 1 ? --this.indexOfFound : this.indexOfFound;
        this.scrollToMessage();
    }
    scrollToMessage() {
        const rawId = this.searchMessagesIds[this.indexOfFound - 1];
        const targetId = rawId?.toString();
        if (!targetId || targetId === this.lastScrolledMessageId)
            return;
        const el = document.querySelector("#" + CSS.escape(targetId));
        if (!el)
            return;
        const yCoordinate = el.getBoundingClientRect().y;
        this.searchGoTo.emit(yCoordinate);
        this.lastScrolledMessageId = targetId;
    }
    getShowingStyle() {
        if (!this.showSearchBar) {
            return { 'display': 'none' };
        }
        return "";
    }
    setShowSearchBar(event) {
        this.showSearchBar = event;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatSearchMessageComponent, deps: [{ token: SellanChatSearchMessagesService }, { token: SellanChatMessageService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: SellanChatSearchMessageComponent, isStandalone: false, selector: "core-search-message", inputs: { roomId: "roomId", buttonText: "buttonText", disabled: "disabled", focus: "focus" }, outputs: { send: "send", dismiss: "dismiss", searchGoTo: "searchGoTo" }, providers: [SellanChatSearchMessagesService], viewQueries: [{ propertyName: "message", first: true, predicate: ["message"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"search\" [ngStyle]=\"getShowingStyle()\">\n  @if (searching) {\n    <label><span class=\"index-\u043Ef\">{{indexOfFound}} \u0438\u0437 {{countOfFound}}</span></label>\n  }\n  <input type=\"text\" class=\"sellan-chat-input-text\" placeholder=\"\u041F\u043E\u0438\u0441\u043A...\" #message (keydown.enter)=\"searchMessage()\" (keyup.escape)=\"dismiss.emit()\" cdkTextareaAutosize>\n  <div class=\"btn-primary-search-group\">\n    <button [disabled]=\"disabled || !message.value\" type=\"submit\" class=\"chat-input-submit find-messadge\" (click)=\"searchMessage()\">\n      <div class=\"sln-chat-white-search\"></div>\n    </button>\n    @if (searching) {\n      <button (click)=\"clearMessage()\" class=\"close-search\"><span>X</span></button>\n    }\n    @if (searching) {\n      <button [disabled]=\"countOfFound === 0\" (click)=\"findPrevious()\" class=\"down-search\"><span>\u2193</span></button>\n    }\n    @if (searching) {\n      <button [disabled]=\"countOfFound === 0\" (click)=\"findNext()\" class=\"up-search\"><span>\u2191</span>\n    </button>\n  }\n</div>\n</div>\n", styles: ["@charset \"UTF-8\";.sellan-chat-input-text{margin:0;padding:15px;width:87%;outline:none;border:none;background:transparent;min-height:50px;max-height:90px}.sellan-chat-input-text::-webkit-input-placeholder{color:inherit}.sellan-chat-input-text::-moz-placeholder{color:inherit}.sellan-chat-input-text::-ms-input-placeholder{color:inherit}.sellan-chat-input-submit{margin:14px 12px;float:right;background-color:inherit;color:inherit;font-size:24px;border:0;outline:none}.chat-input-submit{width:40px;height:40px}.chat-input-submit span{font-size:24px;line-height:15px}.sellan-chat-input{display:flex;justify-content:space-evenly}.search{display:flex;background:#f8f9fb;border-radius:24px;align-items:center;padding:0 10px 0 0;justify-content:space-between;height:50px}.search .btn-primary-search-group{display:flex;align-items:center}.search button{color:var(--WHITE);font-size:20px;border:none;outline:none;border-radius:50%;width:30px;height:30px;background:var(--PRIMARY);display:flex;align-items:center;justify-content:center;margin-left:5px}.search button .sellan-chat-input-text{display:flex;align-items:center;color:var(--DARK-GREY);font-family:var(--font-medium);max-height:140px;overflow:auto}.search label{width:auto;padding:0 0 0 15px;text-align:center;flex:none;color:var(--PRIMARY);font-size:14px}.search label .index-\\43e f{font-family:var(--font-medium)}.btn-search-group{display:flex;justify-content:space-between;align-items:center;margin-right:10px}.btn-search-group button{margin-right:5px!important;width:30px!important;height:30px!important}::-webkit-scrollbar{width:5px;height:5px;background-color:transparent}::-webkit-scrollbar-thumb{background-color:var(--LIGHT-GRAY);border-radius:10px;cursor:auto}::-webkit-scrollbar-button:vertical:start:decrement{display:none}::-webkit-scrollbar-button:vertical:end:increment{display:none}.find-messadge,.close-search,.down-search,.up-search{cursor:pointer}.find-messadge span,.close-search span,.down-search span,.up-search span{height:auto;font-family:var(--font-bold);font-size:13px}.find-messadge .send-search-message,.close-search .send-search-message,.down-search .send-search-message,.up-search .send-search-message{line-height:0;height:13px;background-size:12px;width:12px}.down-search span{padding-bottom:1px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatSearchMessageComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-search-message', encapsulation: ViewEncapsulation.None, providers: [SellanChatSearchMessagesService], standalone: false, template: "<div class=\"search\" [ngStyle]=\"getShowingStyle()\">\n  @if (searching) {\n    <label><span class=\"index-\u043Ef\">{{indexOfFound}} \u0438\u0437 {{countOfFound}}</span></label>\n  }\n  <input type=\"text\" class=\"sellan-chat-input-text\" placeholder=\"\u041F\u043E\u0438\u0441\u043A...\" #message (keydown.enter)=\"searchMessage()\" (keyup.escape)=\"dismiss.emit()\" cdkTextareaAutosize>\n  <div class=\"btn-primary-search-group\">\n    <button [disabled]=\"disabled || !message.value\" type=\"submit\" class=\"chat-input-submit find-messadge\" (click)=\"searchMessage()\">\n      <div class=\"sln-chat-white-search\"></div>\n    </button>\n    @if (searching) {\n      <button (click)=\"clearMessage()\" class=\"close-search\"><span>X</span></button>\n    }\n    @if (searching) {\n      <button [disabled]=\"countOfFound === 0\" (click)=\"findPrevious()\" class=\"down-search\"><span>\u2193</span></button>\n    }\n    @if (searching) {\n      <button [disabled]=\"countOfFound === 0\" (click)=\"findNext()\" class=\"up-search\"><span>\u2191</span>\n    </button>\n  }\n</div>\n</div>\n", styles: ["@charset \"UTF-8\";.sellan-chat-input-text{margin:0;padding:15px;width:87%;outline:none;border:none;background:transparent;min-height:50px;max-height:90px}.sellan-chat-input-text::-webkit-input-placeholder{color:inherit}.sellan-chat-input-text::-moz-placeholder{color:inherit}.sellan-chat-input-text::-ms-input-placeholder{color:inherit}.sellan-chat-input-submit{margin:14px 12px;float:right;background-color:inherit;color:inherit;font-size:24px;border:0;outline:none}.chat-input-submit{width:40px;height:40px}.chat-input-submit span{font-size:24px;line-height:15px}.sellan-chat-input{display:flex;justify-content:space-evenly}.search{display:flex;background:#f8f9fb;border-radius:24px;align-items:center;padding:0 10px 0 0;justify-content:space-between;height:50px}.search .btn-primary-search-group{display:flex;align-items:center}.search button{color:var(--WHITE);font-size:20px;border:none;outline:none;border-radius:50%;width:30px;height:30px;background:var(--PRIMARY);display:flex;align-items:center;justify-content:center;margin-left:5px}.search button .sellan-chat-input-text{display:flex;align-items:center;color:var(--DARK-GREY);font-family:var(--font-medium);max-height:140px;overflow:auto}.search label{width:auto;padding:0 0 0 15px;text-align:center;flex:none;color:var(--PRIMARY);font-size:14px}.search label .index-\\43e f{font-family:var(--font-medium)}.btn-search-group{display:flex;justify-content:space-between;align-items:center;margin-right:10px}.btn-search-group button{margin-right:5px!important;width:30px!important;height:30px!important}::-webkit-scrollbar{width:5px;height:5px;background-color:transparent}::-webkit-scrollbar-thumb{background-color:var(--LIGHT-GRAY);border-radius:10px;cursor:auto}::-webkit-scrollbar-button:vertical:start:decrement{display:none}::-webkit-scrollbar-button:vertical:end:increment{display:none}.find-messadge,.close-search,.down-search,.up-search{cursor:pointer}.find-messadge span,.close-search span,.down-search span,.up-search span{height:auto;font-family:var(--font-bold);font-size:13px}.find-messadge .send-search-message,.close-search .send-search-message,.down-search .send-search-message,.up-search .send-search-message{line-height:0;height:13px;background-size:12px;width:12px}.down-search span{padding-bottom:1px}\n"] }]
        }], ctorParameters: () => [{ type: SellanChatSearchMessagesService }, { type: SellanChatMessageService }], propDecorators: { roomId: [{
                type: Input
            }], message: [{
                type: ViewChild,
                args: ['message', { static: false }]
            }], buttonText: [{
                type: Input
            }], disabled: [{
                type: Input
            }], focus: [{
                type: Input
            }], send: [{
                type: Output
            }], dismiss: [{
                type: Output
            }], searchGoTo: [{
                type: Output
            }] } });

var ParentMessageType;
(function (ParentMessageType) {
    ParentMessageType[ParentMessageType["Answer"] = 0] = "Answer";
    ParentMessageType[ParentMessageType["Forward"] = 1] = "Forward";
})(ParentMessageType || (ParentMessageType = {}));

class SellanChatMsgManagerService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    deleteMessage(dto) {
        const url = this._startUp.apiRoot('chat/message', 'core');
        return this._ajaxM.put({ url: url, data: dto });
    }
    answerMessage(dto) {
        const url = this._startUp.apiRoot('chat/message', 'core');
        return this._ajaxM.post({ url: url, data: dto });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatMsgManagerService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatMsgManagerService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatMsgManagerService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class CoreChatService {
    constructor(_ajaxM, _startUpM) {
        this._ajaxM = _ajaxM;
        this._startUpM = _startUpM;
    }
    getRooms(filter) {
        const url = this._startUpM.apiRoot('chat/combobox/rooms?filter=' + filter, 'core');
        return this._ajaxM.get({ url: url });
    }
    getMyRooms(pageIndex, filter) {
        let query = '';
        if (pageIndex && pageIndex > 0) {
            query += 'pageIndex=' + pageIndex;
        }
        if (!Utility.isEmpty(filter)) {
            if (!Utility.isEmpty(query)) {
                query += '&';
            }
            query += 'searchPatern=' + filter;
        }
        const url = this._startUpM.apiRoot('chat/user-rooms?' + query, 'core');
        return this._ajaxM.get({ url: url });
    }
    getUsers(filter) {
        let query = '';
        if (!Utility.isEmpty(filter)) {
            query += 'filter=' + filter;
        }
        const url = this._startUpM.apiRoot('chat/users/all?' + query, 'core');
        return this._ajaxM.get({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatService, deps: [{ token: AjaxService }, { token: Startup }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: AjaxService }, { type: Startup }] });

var NewMsgMode;
(function (NewMsgMode) {
    NewMsgMode["None"] = "None";
    NewMsgMode["Circle"] = "Circle";
    NewMsgMode["Border"] = "Border";
})(NewMsgMode || (NewMsgMode = {}));
class CoreChatAvatarComponent extends CoreAbstractComponent {
    constructor() {
        super(...arguments);
        this.useInChat = false;
        this.newMsg = false;
        this.newMsgMode = NewMsgMode.None;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatAvatarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatAvatarComponent, isStandalone: false, selector: "core-chat-avatar", inputs: { useInChat: "useInChat", url: "url", backColor: "backColor", fullName: "fullName", newMsg: "newMsg", newMsgMode: "newMsgMode" }, usesInheritance: true, ngImport: i0, template: "@if (newMsg && newMsgMode === 'Circle') {\n  <div class=\"notification\" style=\"right: 0;\"></div>\n}\n<div class=\"{{ newMsg && newMsgMode === 'Border' ? 'sln-notification-border' : '' }}\">\n  <core-user-icon class=\"sln-chat-avatar\" [useInChat]=\"useInChat\" [fullName]=\"fullName\" [url]=\"url\" [backColor]=\"backColor\">\n  </core-user-icon>\n</div>", styles: [".sln-chat-avatar{height:40px;width:40px;border-radius:50%;cursor:pointer;margin-bottom:3px}.sln-notification-border{border:solid 3px var(--PRIMARY);border-radius:50%;position:relative}\n"], dependencies: [{ kind: "component", type: CoreUserIconComponent, selector: "core-user-icon", inputs: ["useInChat", "sizeSuffix", "url", "backColor", "fullName"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatAvatarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-chat-avatar', standalone: false, template: "@if (newMsg && newMsgMode === 'Circle') {\n  <div class=\"notification\" style=\"right: 0;\"></div>\n}\n<div class=\"{{ newMsg && newMsgMode === 'Border' ? 'sln-notification-border' : '' }}\">\n  <core-user-icon class=\"sln-chat-avatar\" [useInChat]=\"useInChat\" [fullName]=\"fullName\" [url]=\"url\" [backColor]=\"backColor\">\n  </core-user-icon>\n</div>", styles: [".sln-chat-avatar{height:40px;width:40px;border-radius:50%;cursor:pointer;margin-bottom:3px}.sln-notification-border{border:solid 3px var(--PRIMARY);border-radius:50%;position:relative}\n"] }]
        }], propDecorators: { useInChat: [{
                type: Input
            }], url: [{
                type: Input
            }], backColor: [{
                type: Input
            }], fullName: [{
                type: Input
            }], newMsg: [{
                type: Input
            }], newMsgMode: [{
                type: Input
            }] } });

class CoreChatRoomComponent extends CoreAbstractComponent {
    constructor(overlay, viewContainerRef) {
        super();
        this.overlay = overlay;
        this.viewContainerRef = viewContainerRef;
    }
    getChatFullName(name) {
        const splitName = name.split(' ');
        if (splitName.length > 1) {
            return name;
        }
        return name[0] + name[1];
    }
    getFirstStrongContent(text) {
        if (!text)
            return text;
        const match = text.match(/<strong>(.*?)<\/strong>/);
        return match ? `<strong>${match[1]}</strong>` : text;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatRoomComponent, deps: [{ token: i1$4.Overlay }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreChatRoomComponent, isStandalone: false, selector: "core-chat-item", inputs: { chat: "chat" }, viewQueries: [{ propertyName: "chatElement", first: true, predicate: ["chatElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #chatElement class=\"item item__divider\">\n    <div class=\"{{ chat.newMessage === true ? 'sln-new-msg-back' : 'sln-msg-back'}}\">\n      <core-chat-avatar [useInChat]=\"true\" [url]=\"chat.avatarLink\" [backColor]=\"chat.avatarColor\" [fullName]=\"getChatFullName(chat.name)\" [newMsg]=\"chat.newMessage\" [newMsgMode]=\"'Border'\"></core-chat-avatar>\n        <div class=\"flex-user-info\">\n            <div style=\"width: 81%;\">\n              <p class=\"sln-room-title\">{{chat.name}}</p>\n              <small class=\"sln-chat-last-message\" [innerHTML]=\"getFirstStrongContent(chat.lastMessage)\"></small>\n            </div>\n            <div>\n              <p class=\"date\">\n                {{chat.lastMessageDate | date: \"dd.MM.yyyy\"}} <br/>\n                {{chat.lastMessageDate | date: \"HH:mm\"}}\n              </p>\n            </div>\n        </div>\n    </div>\n</div>\n\n\n\n", styles: [".item{color:#5d6275;padding:0}.item .date{text-align:right;margin-left:5px;font-size:12.5px;color:var(--MIDLE-GRAY)}.item:hover{cursor:pointer}.item:hover:after{border-left:1px solid}.item__divider:hover .sln-settings-links,.item__divider:hover .sln-room-title{color:var(--DARK-GREY)}.flex-user-info{display:flex;flex-direction:row;width:100%;align-items:center;padding:0 10px 0 0;justify-content:space-between}.item__divider .item__hr-line{width:90%;flex-shrink:1;margin:25px}.in-message{color:var(--ADD-COLOR-1);margin:0 0 0 20px}.sln-settings-links,.sln-settings-links:hover{color:var(--MIDLE-GRAY)}.item__button{float:right;padding:7px 15px;background:#fff;border:2px solid #444;color:#fafafa;cursor:pointer;transition:all .2s;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.item__button:hover{background:#f1f1f1;color:#444}.user-menu{background-color:#fafafa;font-size:10pt;z-index:1000;box-shadow:0 0 12pt #00000040;border-radius:4pt;padding:.5em 0;animation:fadeIn .1s ease-out;opacity:1;display:block}.user-menu hr{border:none;border-bottom:1px solid #eee}.user-menu div{cursor:pointer;display:block;text-decoration:none;color:#333;padding:.5em 2em .5em .75em;max-width:18em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-menu div:before{content:\"\";margin-right:.75em;width:.5em;height:1em;display:inline-block}.sln-room-title{color:var(--MIDLE-GRAY);font-size:14px;margin-left:5px}.mat-tab-body-content{height:58vh!important}.mat-icon{width:auto}.sln-settings-img{height:20px;cursor:pointer}.sln-new-msg-back{background-color:#e9f4ff;display:flex;justify-content:center;align-items:center;padding:10px 8px;margin:5px 0}.sln-msg-back{display:flex;justify-content:center;align-items:center;padding:10px}.sln-chat-last-message{margin-left:5px}:host ::ng-deep .sln-chat-message-with-forward{padding-left:20px;background:url('data:image/svg+xml,<svg width=\"21\" height=\"13\" viewBox=\"0 0 21 13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">%0A<g id=\"Group 2927\">%0A<path id=\"Rectangle 305\" d=\"M17 11.0908H4.5C2.567 11.0908 1 9.52382 1 7.59082V7.59082C1 5.65782 2.567 4.09082 4.5 4.09082H19.5M19.5 4.09082L16.5 1.09082M19.5 4.09082L16.5 7.09082\" stroke=\"%23ABB1C2\" stroke-width=\"2\"/>%0A</g>%0A</svg>%0A') no-repeat}:host ::ng-deep .sln-chat-message-with-attachment{padding-left:20px;background:url('data:image/svg+xml,<svg width=\"19\" height=\"17\" viewBox=\"0 0 19 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">%0A<g id=\"Group 2879\">%0A<g id=\"6\">%0A<g id=\"Group 2545\">%0A<path id=\"Rectangle 307\" d=\"M12.9363 2.0542L12.9375 1.0542L2.9375 1.0542C2.38522 1.0542 1.9375 1.50191 1.9375 2.0542L1.9375 15.0542L11.9375 15.0542C12.4898 15.0542 12.9375 14.6065 12.9375 14.0542V14.0542\" stroke=\"%23868EA6\" stroke-width=\"2\"/>%0A<path id=\"Rectangle 308\" d=\"M3.43555 5.0542L7.18359 5.0542\" stroke=\"%23868EA6\" stroke-width=\"2\" stroke-linecap=\"square\"/>%0A<path id=\"Rectangle 309\" d=\"M5.43359 8.0542L7.18359 8.0542\" stroke=\"%23868EA6\" stroke-width=\"2\" stroke-linecap=\"square\"/>%0A<path id=\"Rectangle 310\" d=\"M5.43359 11.0542L7.18359 11.0542\" stroke=\"%23868EA6\" stroke-width=\"2\" stroke-linecap=\"square\"/>%0A</g>%0A</g>%0A<path id=\"Rectangle 315\" d=\"M17.8496 6.2002L13.3496 10.7002L10.3008 7.65137\" stroke=\"%23868EA6\" stroke-width=\"2\"/>%0A</g>%0A</svg>%0A') no-repeat}:host ::ng-deep .sln-chat-message-with-answer{padding-left:5px;border-left:3px solid var(--LIGHT-GRAY)}\n"], dependencies: [{ kind: "component", type: CoreChatAvatarComponent, selector: "core-chat-avatar", inputs: ["useInChat", "url", "backColor", "fullName", "newMsg", "newMsgMode"] }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatRoomComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-chat-item', standalone: false, template: "<div #chatElement class=\"item item__divider\">\n    <div class=\"{{ chat.newMessage === true ? 'sln-new-msg-back' : 'sln-msg-back'}}\">\n      <core-chat-avatar [useInChat]=\"true\" [url]=\"chat.avatarLink\" [backColor]=\"chat.avatarColor\" [fullName]=\"getChatFullName(chat.name)\" [newMsg]=\"chat.newMessage\" [newMsgMode]=\"'Border'\"></core-chat-avatar>\n        <div class=\"flex-user-info\">\n            <div style=\"width: 81%;\">\n              <p class=\"sln-room-title\">{{chat.name}}</p>\n              <small class=\"sln-chat-last-message\" [innerHTML]=\"getFirstStrongContent(chat.lastMessage)\"></small>\n            </div>\n            <div>\n              <p class=\"date\">\n                {{chat.lastMessageDate | date: \"dd.MM.yyyy\"}} <br/>\n                {{chat.lastMessageDate | date: \"HH:mm\"}}\n              </p>\n            </div>\n        </div>\n    </div>\n</div>\n\n\n\n", styles: [".item{color:#5d6275;padding:0}.item .date{text-align:right;margin-left:5px;font-size:12.5px;color:var(--MIDLE-GRAY)}.item:hover{cursor:pointer}.item:hover:after{border-left:1px solid}.item__divider:hover .sln-settings-links,.item__divider:hover .sln-room-title{color:var(--DARK-GREY)}.flex-user-info{display:flex;flex-direction:row;width:100%;align-items:center;padding:0 10px 0 0;justify-content:space-between}.item__divider .item__hr-line{width:90%;flex-shrink:1;margin:25px}.in-message{color:var(--ADD-COLOR-1);margin:0 0 0 20px}.sln-settings-links,.sln-settings-links:hover{color:var(--MIDLE-GRAY)}.item__button{float:right;padding:7px 15px;background:#fff;border:2px solid #444;color:#fafafa;cursor:pointer;transition:all .2s;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.item__button:hover{background:#f1f1f1;color:#444}.user-menu{background-color:#fafafa;font-size:10pt;z-index:1000;box-shadow:0 0 12pt #00000040;border-radius:4pt;padding:.5em 0;animation:fadeIn .1s ease-out;opacity:1;display:block}.user-menu hr{border:none;border-bottom:1px solid #eee}.user-menu div{cursor:pointer;display:block;text-decoration:none;color:#333;padding:.5em 2em .5em .75em;max-width:18em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-menu div:before{content:\"\";margin-right:.75em;width:.5em;height:1em;display:inline-block}.sln-room-title{color:var(--MIDLE-GRAY);font-size:14px;margin-left:5px}.mat-tab-body-content{height:58vh!important}.mat-icon{width:auto}.sln-settings-img{height:20px;cursor:pointer}.sln-new-msg-back{background-color:#e9f4ff;display:flex;justify-content:center;align-items:center;padding:10px 8px;margin:5px 0}.sln-msg-back{display:flex;justify-content:center;align-items:center;padding:10px}.sln-chat-last-message{margin-left:5px}:host ::ng-deep .sln-chat-message-with-forward{padding-left:20px;background:url('data:image/svg+xml,<svg width=\"21\" height=\"13\" viewBox=\"0 0 21 13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">%0A<g id=\"Group 2927\">%0A<path id=\"Rectangle 305\" d=\"M17 11.0908H4.5C2.567 11.0908 1 9.52382 1 7.59082V7.59082C1 5.65782 2.567 4.09082 4.5 4.09082H19.5M19.5 4.09082L16.5 1.09082M19.5 4.09082L16.5 7.09082\" stroke=\"%23ABB1C2\" stroke-width=\"2\"/>%0A</g>%0A</svg>%0A') no-repeat}:host ::ng-deep .sln-chat-message-with-attachment{padding-left:20px;background:url('data:image/svg+xml,<svg width=\"19\" height=\"17\" viewBox=\"0 0 19 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">%0A<g id=\"Group 2879\">%0A<g id=\"6\">%0A<g id=\"Group 2545\">%0A<path id=\"Rectangle 307\" d=\"M12.9363 2.0542L12.9375 1.0542L2.9375 1.0542C2.38522 1.0542 1.9375 1.50191 1.9375 2.0542L1.9375 15.0542L11.9375 15.0542C12.4898 15.0542 12.9375 14.6065 12.9375 14.0542V14.0542\" stroke=\"%23868EA6\" stroke-width=\"2\"/>%0A<path id=\"Rectangle 308\" d=\"M3.43555 5.0542L7.18359 5.0542\" stroke=\"%23868EA6\" stroke-width=\"2\" stroke-linecap=\"square\"/>%0A<path id=\"Rectangle 309\" d=\"M5.43359 8.0542L7.18359 8.0542\" stroke=\"%23868EA6\" stroke-width=\"2\" stroke-linecap=\"square\"/>%0A<path id=\"Rectangle 310\" d=\"M5.43359 11.0542L7.18359 11.0542\" stroke=\"%23868EA6\" stroke-width=\"2\" stroke-linecap=\"square\"/>%0A</g>%0A</g>%0A<path id=\"Rectangle 315\" d=\"M17.8496 6.2002L13.3496 10.7002L10.3008 7.65137\" stroke=\"%23868EA6\" stroke-width=\"2\"/>%0A</g>%0A</svg>%0A') no-repeat}:host ::ng-deep .sln-chat-message-with-answer{padding-left:5px;border-left:3px solid var(--LIGHT-GRAY)}\n"] }]
        }], ctorParameters: () => [{ type: i1$4.Overlay }, { type: i0.ViewContainerRef }], propDecorators: { chat: [{
                type: Input
            }], chatElement: [{
                type: ViewChild,
                args: ['chatElement']
            }] } });

class CoreChatForwardDrawerComponent extends CoreBaseDestroyComponent {
    get showEmptySearch() {
        return !Utility.isEmpty(this.roomSearch) && this.rooms.length === 0;
    }
    constructor(_eventBroker, config, _drawer, _service, _popup, _chatMessageService) {
        super();
        this._eventBroker = _eventBroker;
        this.config = config;
        this._drawer = _drawer;
        this._service = _service;
        this._popup = _popup;
        this._chatMessageService = _chatMessageService;
        this.name = DrawerNames.FORWARD;
        this.blockLoading = false;
        this.roomSearch = null;
        this.roomsPage = 0;
    }
    ngOnInit() {
        this._reloadChat(true);
    }
    onSearchChange($event) {
        if ($event?.length >= 3) {
            this._reloadChat(true, $event);
        }
        else if ($event?.length == 0) {
            this._reloadChat(true);
        }
    }
    onScroll($event) {
        if ($event.position === 'BOTTOM') {
            if (this.blockLoading === false) {
                this.blockLoading = true;
                this._reloadChat();
            }
        }
    }
    userSelected(chat) {
        this.rooms.filter(z => z.id == chat.id)[0].newMessage = false;
        this.selectedRoom = this.rooms.filter(z => z.id == chat.id)[0];
        this._chatMessageService.forwardMessage({ content: '', parentMessageId: this.config.data.id, parentMessageType: ParentMessageType.Forward }, this.selectedRoom.id);
        this._eventBroker.emit("chat-drawer-call-forward", this.selectedRoom.id);
        this.close();
    }
    close() {
        this._drawer.close(DrawerNames.FORWARD);
    }
    _reloadChat(force, filter) {
        if (force !== true) {
            this.roomsPage++;
        }
        this._service
            .getMyRooms(force === true ? undefined : this.roomsPage, filter)
            .pipe(this.takeUntilDestroyed())
            .subscribe(response => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                if (force === true) {
                    this.rooms = entity;
                    this.roomsPage = 0;
                }
                else {
                    this.rooms = this.rooms.concat(entity);
                }
                this.blockLoading = false;
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatForwardDrawerComponent, deps: [{ token: EventBrokerService }, { token: CORE_DRAWER_DATA_TOKEN_KEY }, { token: DrawerService }, { token: CoreChatService }, { token: PopupResults }, { token: SellanChatMessageService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatForwardDrawerComponent, isStandalone: false, selector: "ng-component", providers: [SellanChatMessageService], usesInheritance: true, ngImport: i0, template: "<core-drawer [name]=\"name\" width=\"420\" hasFooter=\"false\" (reachedBottomRun)=\"onScroll($event)\">\n  <div title class=\"sln-drawer-header\">\n    <button (click)=\"close()\" class=\"sln-drawer-close\">\n      x\n    </button>\n    <form #roomSearchForm=\"ngForm\" novalidate>\n      <core-field-string [(ngModel)]=\"roomSearch\" name=\"roomSearch\" fieldName=\"roomSearch\"\n        placeholder=\"\u041F\u043E\u0438\u0441\u043A\" (valueChange)=\"onSearchChange($event)\"\n      [settings]=\"{ rightHintHide: true}\" class=\"sln-input-s\"></core-field-string>\n    </form>\n  </div>\n  <div body class=\"sln-drawer-body-wrap\">\n    @for (room of rooms; track room) {\n      <core-chat-item (click)=\"userSelected(room)\" [chat]=\"room\"></core-chat-item>\n    }\n    @if (showEmptySearch) {\n      <div class=\"sln-showEmptySearch\">\n        <span>\n          \u041F\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u0443 \"{{ roomSearch }}\" \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E.\n        </span>\n      </div>\n    }\n  </div>\n</core-drawer>", styles: [".container{width:100%;display:flex}.container .chat-list{border:1px solid var(--PRIMARY);border-radius:4px 0 0 4px;width:35%;max-height:85vh;background:#fff;padding:10px 20px}.container .chat-list .chat-title{display:flex;justify-content:space-between}.container .chat-list .chat-title .chat-name{font-weight:500}.container .chat-list .chat-title .chat-date{font-size:.7rem;color:#000000b3}.container .chat-list .search-input{margin:24px}.sln-drawer-body-wrap{padding-bottom:10px}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}.sln-new-chat-btn{height:45px;display:flex;align-items:center;justify-content:center}.sln-drawer-header{width:100%;display:flex;align-items:center;padding:0 15px;border-bottom:2px solid var(--PRIMARY)}.sln-drawer-header form{width:100%}.sln-drawer-header .sln-new-chat-btn{width:110px}.sln-drawer-header core-field-string{width:100%}.sln-showEmptySearch{padding:10px 18px;text-align:center}.sln-showEmptySearch span{color:var(--DARK-GREY);font-family:var(--font-medium);margin-bottom:10px;display:block;font-size:17px}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreDrawerComponent, selector: "core-drawer", inputs: ["name", "titleHeight", "footerHeight", "dialogTitle", "width", "minWidth", "hasTitle", "hasFooter", "goto"], outputs: ["reachedTopRun", "reachedBottomRun"] }, { kind: "component", type: CoreChatRoomComponent, selector: "core-chat-item", inputs: ["chat"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatForwardDrawerComponent, decorators: [{
            type: Component,
            args: [{ providers: [SellanChatMessageService], standalone: false, template: "<core-drawer [name]=\"name\" width=\"420\" hasFooter=\"false\" (reachedBottomRun)=\"onScroll($event)\">\n  <div title class=\"sln-drawer-header\">\n    <button (click)=\"close()\" class=\"sln-drawer-close\">\n      x\n    </button>\n    <form #roomSearchForm=\"ngForm\" novalidate>\n      <core-field-string [(ngModel)]=\"roomSearch\" name=\"roomSearch\" fieldName=\"roomSearch\"\n        placeholder=\"\u041F\u043E\u0438\u0441\u043A\" (valueChange)=\"onSearchChange($event)\"\n      [settings]=\"{ rightHintHide: true}\" class=\"sln-input-s\"></core-field-string>\n    </form>\n  </div>\n  <div body class=\"sln-drawer-body-wrap\">\n    @for (room of rooms; track room) {\n      <core-chat-item (click)=\"userSelected(room)\" [chat]=\"room\"></core-chat-item>\n    }\n    @if (showEmptySearch) {\n      <div class=\"sln-showEmptySearch\">\n        <span>\n          \u041F\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u0443 \"{{ roomSearch }}\" \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E.\n        </span>\n      </div>\n    }\n  </div>\n</core-drawer>", styles: [".container{width:100%;display:flex}.container .chat-list{border:1px solid var(--PRIMARY);border-radius:4px 0 0 4px;width:35%;max-height:85vh;background:#fff;padding:10px 20px}.container .chat-list .chat-title{display:flex;justify-content:space-between}.container .chat-list .chat-title .chat-name{font-weight:500}.container .chat-list .chat-title .chat-date{font-size:.7rem;color:#000000b3}.container .chat-list .search-input{margin:24px}.sln-drawer-body-wrap{padding-bottom:10px}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}.sln-new-chat-btn{height:45px;display:flex;align-items:center;justify-content:center}.sln-drawer-header{width:100%;display:flex;align-items:center;padding:0 15px;border-bottom:2px solid var(--PRIMARY)}.sln-drawer-header form{width:100%}.sln-drawer-header .sln-new-chat-btn{width:110px}.sln-drawer-header core-field-string{width:100%}.sln-showEmptySearch{padding:10px 18px;text-align:center}.sln-showEmptySearch span{color:var(--DARK-GREY);font-family:var(--font-medium);margin-bottom:10px;display:block;font-size:17px}\n"] }]
        }], ctorParameters: () => [{ type: EventBrokerService }, { type: DrawerConfig, decorators: [{
                    type: Inject,
                    args: [CORE_DRAWER_DATA_TOKEN_KEY]
                }] }, { type: DrawerService }, { type: CoreChatService }, { type: PopupResults }, { type: SellanChatMessageService }] });

class CoreChatMessageMenuComponent extends CoreBaseDestroyComponent {
    constructor(_eventBroker, _msgSrv, _usersSrv, _drawer, _signalRService) {
        super();
        this._msgSrv = _msgSrv;
        this._usersSrv = _usersSrv;
        this._drawer = _drawer;
        this._signalRService = _signalRService;
        this.messageAnswerEvent = new EventEmitter();
        this.messageDeleteEvent = new EventEmitter();
        this.messageStorageDeleteEvent = new EventEmitter();
        this.answerPersonallyEvent = new EventEmitter();
        this.messageForwardEvent = new EventEmitter();
        this._eventListener = _eventBroker.listen("chat-drawer-call-forward", (value) => {
            this.messageForwardEvent.emit();
        });
    }
    ngOnDestroy() {
        this._eventListener.ignore();
        super.ngOnDestroy();
    }
    deleteMessage(deleteForAll) {
        if (this.message.status === MessageStatus.NotSend) {
            this._signalRService.confirmMessageSent(this.message);
        }
        if (deleteForAll) {
            this._msgSrv.deleteMessage({ messageId: this.message.id.toString(), roomId: this.chat.id, deleteFlag: 2 }).pipe(this.takeUntilDestroyed()).subscribe(() => { this.messageDeleteEvent.emit(this.message.id); });
        }
        else {
            this._msgSrv.deleteMessage({ messageId: this.message.id.toString(), roomId: this.chat.id, deleteFlag: 1 }).pipe(this.takeUntilDestroyed()).subscribe(() => { this.messageDeleteEvent.emit(this.message.id); });
        }
    }
    isPrivateRoom() {
        return this.chat.isPrivate;
    }
    isSentMessage() {
        return this.message.type == "sent";
    }
    answer() {
        this.messageAnswerEvent.emit({ answerMessageId: this.message.id, answerMessageContent: this.message.parentMessageType == ParentMessageType.Forward ? this.message.parentMessageContent : this.message.content });
    }
    answerPersonally() {
        this._usersSrv
            .getUserChats()
            .pipe(this.takeUntilDestroyed()).subscribe(z => {
            const index = z.entity.findIndex(x => x.isPrivate && x.usersId.length == 1 && x.usersId[0] === this.message.userId);
            if (index > 0) {
                this.answerPersonallyEvent.emit(z.entity[index]);
                return;
            }
            this._usersSrv.createUserRoom({ name: this.message.from, userIds: [this.message.userId] })
                .subscribe(z => {
                this.answerPersonallyEvent.emit(z.entity);
            });
        });
    }
    forwardMessage() {
        this._drawer.show(CoreChatForwardDrawerComponent, { name: DrawerNames.FORWARD, data: this.message });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatMessageMenuComponent, deps: [{ token: EventBrokerService }, { token: SellanChatMsgManagerService }, { token: SellanChatUsersService }, { token: DrawerService }, { token: SignalRService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatMessageMenuComponent, isStandalone: false, selector: "core-chat-message-menu", inputs: { chat: "chat", message: "message" }, outputs: { messageAnswerEvent: "messageAnswerEvent", messageDeleteEvent: "messageDeleteEvent", messageStorageDeleteEvent: "messageStorageDeleteEvent", answerPersonallyEvent: "answerPersonallyEvent", messageForwardEvent: "messageForwardEvent" }, viewQueries: [{ propertyName: "userMenu", first: true, predicate: ["userMenu"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<section class=\"sln-user-menu\">\n  <div (click)=\"answer()\" class=\"sln-user-menu-item\">\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C</div>\n  @if (!isSentMessage() && !isPrivateRoom()) {\n    <div (click)=\"answerPersonally()\" class=\"sln-user-menu-item\">\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C \u043B\u0438\u0447\u043D\u043E</div>\n  }\n  <div (click)=\"forwardMessage()\" class=\"sln-user-menu-item\">\u041F\u0435\u0440\u0435\u0441\u043B\u0430\u0442\u044C</div>\n  @if (isSentMessage()) {\n    <div (click)=\"deleteMessage(false)\" class=\"sln-user-menu-item\">\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0443 \u0441\u0435\u0431\u044F</div>\n  }\n  @if (isSentMessage()) {\n    <div (click)=\"deleteMessage(true)\" class=\"sln-user-menu-item\">\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0434\u043B\u044F \u0432\u0441\u0435\u0445</div>\n  }\n</section>\n", styles: [".sln-user-menu{position:fixed;right:0;background-color:#fafafa;font-size:10pt;z-index:1000;box-shadow:0 0 12pt #00000040;border-radius:4pt;padding:.5em 0;animation:fadeIn .1s ease-out;opacity:1;display:block}.sln-user-menu hr{border:none;border-bottom:1px solid #eee}.sln-user-menu div{cursor:pointer;display:block;text-decoration:none;color:#333;padding:.5em 2em .5em .75em;max-width:18em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sln-user-menu div:before{content:\"\";float:left;margin-right:.75em;width:.5em;height:1em}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatMessageMenuComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-chat-message-menu', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<section class=\"sln-user-menu\">\n  <div (click)=\"answer()\" class=\"sln-user-menu-item\">\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C</div>\n  @if (!isSentMessage() && !isPrivateRoom()) {\n    <div (click)=\"answerPersonally()\" class=\"sln-user-menu-item\">\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C \u043B\u0438\u0447\u043D\u043E</div>\n  }\n  <div (click)=\"forwardMessage()\" class=\"sln-user-menu-item\">\u041F\u0435\u0440\u0435\u0441\u043B\u0430\u0442\u044C</div>\n  @if (isSentMessage()) {\n    <div (click)=\"deleteMessage(false)\" class=\"sln-user-menu-item\">\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0443 \u0441\u0435\u0431\u044F</div>\n  }\n  @if (isSentMessage()) {\n    <div (click)=\"deleteMessage(true)\" class=\"sln-user-menu-item\">\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0434\u043B\u044F \u0432\u0441\u0435\u0445</div>\n  }\n</section>\n", styles: [".sln-user-menu{position:fixed;right:0;background-color:#fafafa;font-size:10pt;z-index:1000;box-shadow:0 0 12pt #00000040;border-radius:4pt;padding:.5em 0;animation:fadeIn .1s ease-out;opacity:1;display:block}.sln-user-menu hr{border:none;border-bottom:1px solid #eee}.sln-user-menu div{cursor:pointer;display:block;text-decoration:none;color:#333;padding:.5em 2em .5em .75em;max-width:18em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sln-user-menu div:before{content:\"\";float:left;margin-right:.75em;width:.5em;height:1em}\n"] }]
        }], ctorParameters: () => [{ type: EventBrokerService }, { type: SellanChatMsgManagerService }, { type: SellanChatUsersService }, { type: DrawerService }, { type: SignalRService }], propDecorators: { chat: [{
                type: Input
            }], message: [{
                type: Input
            }], userMenu: [{
                type: ViewChild,
                args: ['userMenu']
            }], messageAnswerEvent: [{
                type: Output
            }], messageDeleteEvent: [{
                type: Output
            }], messageStorageDeleteEvent: [{
                type: Output
            }], answerPersonallyEvent: [{
                type: Output
            }], messageForwardEvent: [{
                type: Output
            }] } });

class CoreChatDialodReadingMessageTooltipComponent extends CoreAbstractComponent {
    ngOnInit() {
        this.parseData(this.data);
    }
    parseData({ users }) {
        this.users = users;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatDialodReadingMessageTooltipComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatDialodReadingMessageTooltipComponent, isStandalone: false, selector: "ng-component", inputs: { data: "data" }, usesInheritance: true, ngImport: i0, template: "@for (user of users; track user) {\n  <p>\n    <core-chat-avatar [fullName]=\"user.fullName\"\n      [url]=\"user.avatarLink\"\n      [backColor]=\"user.avatarColor\"\n    class=\"sellan-chat-message-from-avatar\"></core-chat-avatar>\n  </p>\n}", dependencies: [{ kind: "component", type: CoreChatAvatarComponent, selector: "core-chat-avatar", inputs: ["useInChat", "url", "backColor", "fullName", "newMsg", "newMsgMode"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatDialodReadingMessageTooltipComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "@for (user of users; track user) {\n  <p>\n    <core-chat-avatar [fullName]=\"user.fullName\"\n      [url]=\"user.avatarLink\"\n      [backColor]=\"user.avatarColor\"\n    class=\"sellan-chat-message-from-avatar\"></core-chat-avatar>\n  </p>\n}" }]
        }], propDecorators: { data: [{
                type: Input
            }] } });

class SellanChatHighlighterPipe {
    transform(value, args, type, currentIndex = -1) {
        if (!args)
            return value;
        let _args = args.trim().replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
        const re = type === 'full' ? new RegExp("\\b(" + _args + "\\b)", 'igm') : new RegExp(_args, 'igm');
        let i = 0;
        return value.replace(re, (match) => {
            i++;
            // если currentIndex <= 0, ни одно не считается "current"
            if (currentIndex <= 0) {
                return `<span class="highlighted-text">${match}</span>`;
            }
            return i === currentIndex ? `<span class="highlighted-text-current">${match}</span>` : `<span class="highlighted-text">${match}</span>`;
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatHighlighterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: SellanChatHighlighterPipe, isStandalone: false, name: "highlighter" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatHighlighterPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'highlighter',
                    standalone: false
                }]
        }] });

class SellanChatSendMessageMenuComponent extends CoreBaseDestroyComponent {
    constructor() {
        super();
        this.messageConfrirmSentEvent = new EventEmitter();
    }
    sendOrganizationMessage() {
        this.messageConfrirmSentEvent.emit(true);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatSendMessageMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: SellanChatSendMessageMenuComponent, isStandalone: false, selector: "core-chat-send-message-menu", inputs: { chat: "chat", message: "message" }, outputs: { messageConfrirmSentEvent: "messageConfrirmSentEvent" }, viewQueries: [{ propertyName: "userMenu", first: true, predicate: ["userMenu"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<section class=\"user-menu\">\n  <div (click)=\"sendOrganizationMessage()\">\u0422\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438</div>\n</section>\n", styles: [".item{color:#5d6275;display:flex;border-radius:5px;padding:15px 20px}.item .date{margin-bottom:40px;margin-right:35px;font-size:14px}.item:hover{background:var(--WHITE);cursor:pointer}.item__divider *{flex-shrink:0}.item__divider .item__hr-line{width:90%;flex-shrink:1;margin:25px}.item__button{float:right;padding:7px 15px;background:#fff;border:2px solid #444;color:#fafafa;cursor:pointer;transition:all .2s;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.item__button:hover{background:#f1f1f1;color:#444}.user-menu{background-color:#fafafa;font-size:10pt;z-index:1000;box-shadow:0 0 12pt #00000040;border-radius:4pt;padding:.5em 0;animation:fadeIn .1s ease-out;opacity:1;display:block}.user-menu hr{border:none;border-bottom:1px solid #eee}.user-menu div{cursor:pointer;display:block;text-decoration:none;color:#333;padding:.5em 2em .5em .75em;max-width:18em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-menu div:before{content:\"\";float:left;margin-right:.75em;width:.5em;height:1em;display:inline-block}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatSendMessageMenuComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-chat-send-message-menu', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<section class=\"user-menu\">\n  <div (click)=\"sendOrganizationMessage()\">\u0422\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438</div>\n</section>\n", styles: [".item{color:#5d6275;display:flex;border-radius:5px;padding:15px 20px}.item .date{margin-bottom:40px;margin-right:35px;font-size:14px}.item:hover{background:var(--WHITE);cursor:pointer}.item__divider *{flex-shrink:0}.item__divider .item__hr-line{width:90%;flex-shrink:1;margin:25px}.item__button{float:right;padding:7px 15px;background:#fff;border:2px solid #444;color:#fafafa;cursor:pointer;transition:all .2s;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.item__button:hover{background:#f1f1f1;color:#444}.user-menu{background-color:#fafafa;font-size:10pt;z-index:1000;box-shadow:0 0 12pt #00000040;border-radius:4pt;padding:.5em 0;animation:fadeIn .1s ease-out;opacity:1;display:block}.user-menu hr{border:none;border-bottom:1px solid #eee}.user-menu div{cursor:pointer;display:block;text-decoration:none;color:#333;padding:.5em 2em .5em .75em;max-width:18em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-menu div:before{content:\"\";float:left;margin-right:.75em;width:.5em;height:1em;display:inline-block}\n"] }]
        }], ctorParameters: () => [], propDecorators: { chat: [{
                type: Input
            }], message: [{
                type: Input
            }], userMenu: [{
                type: ViewChild,
                args: ['userMenu']
            }], messageConfrirmSentEvent: [{
                type: Output
            }] } });

class SellanChatInputComponent extends CoreAbstractComponent {
    constructor(overlay, viewContainerRef, _appRef, _injector) {
        super();
        this.overlay = overlay;
        this.viewContainerRef = viewContainerRef;
        this._appRef = _appRef;
        this._injector = _injector;
        this.buttonText = '↩︎';
        this.disabled = false;
        this.focus = new EventEmitter();
        this.send = new EventEmitter();
        this.dismiss = new EventEmitter();
    }
    ngOnInit() {
        this.focus.subscribe(() => this.focusMessage());
    }
    focusMessage() {
        this.message.nativeElement.focus();
    }
    getMessage() {
        return this.message.nativeElement.value;
    }
    clearMessage() {
        this.message.nativeElement.value = '';
    }
    open({ x, y }, btn) {
        this.close();
        const positionStrategy = this.overlay
            .position()
            .flexibleConnectedTo(btn)
            .withPositions([
            new ConnectionPositionPair({ originX: 'end', originY: 'top' }, { overlayX: 'start', overlayY: 'top' }),
            new ConnectionPositionPair({ originX: 'start', originY: 'top' }, { overlayX: 'start', overlayY: 'bottom' }),
        ]);
        this.overlayRef = this.overlay.create({
            positionStrategy,
            hasBackdrop: true,
            backdropClass: 'mat-overlay-transparent-backdrop',
            scrollStrategy: this.overlay.scrollStrategies.close(),
        });
        // Важно: уходим от overlayRef.attach(ComponentPortal(...)), чтобы избежать
        // ошибки "Attempting to attach an unknown Portal type".
        this._menuHostElement = this.overlayRef.overlayElement.ownerDocument.createElement('div');
        this.overlayRef.overlayElement.appendChild(this._menuHostElement);
        this._menuComponentRef = createComponent(SellanChatSendMessageMenuComponent, {
            environmentInjector: this._appRef.injector,
            hostElement: this._menuHostElement,
            elementInjector: this._injector,
        });
        this._appRef.attachView(this._menuComponentRef.hostView);
        this._menuComponentRef.changeDetectorRef.detectChanges();
        const componentRef = this._menuComponentRef;
        componentRef.instance.messageConfrirmSentEvent.subscribe(event => {
            this.onSubmit(true);
            this.close();
        });
        this.overlayRef.backdropClick().subscribe(() => {
            this.close();
        });
    }
    close() {
        if (this.overlayRef) {
            if (this._menuComponentRef) {
                this._appRef.detachView(this._menuComponentRef.hostView);
                const hostEl = this._menuComponentRef.location.nativeElement;
                this._menuComponentRef.destroy();
                hostEl?.remove();
                this._menuComponentRef = undefined;
                this._menuHostElement = undefined;
            }
            this.overlayRef.dispose();
        }
    }
    onSubmit(onlyOrganizations) {
        const message = this.getMessage();
        if (message.trim() === '') {
            return;
        }
        this.send.emit({ message, onlyOrganizations });
        this.clearMessage();
        this.focusMessage();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatInputComponent, deps: [{ token: i1$4.Overlay }, { token: i0.ViewContainerRef }, { token: i0.ApplicationRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: SellanChatInputComponent, isStandalone: false, selector: "core-chat-input", inputs: { buttonText: "buttonText", disabled: "disabled", focus: "focus" }, outputs: { send: "send", dismiss: "dismiss" }, viewQueries: [{ propertyName: "message", first: true, predicate: ["message"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-foot-sent-message\">\n    <textarea type=\"text\" class=\"sellan-chat-input-text\" placeholder=\"C\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435...\" #message (keydown.enter)=\"onSubmit()\" (keyup.enter)=\"message.value = ''\" (keyup.escape)=\"dismiss.emit()\" cdkTextareaAutosize></textarea>\n    <button #btn [disabled]=\"disabled\" type=\"submit\" class=\"chat-input-submit\" (click)=\"onSubmit()\" (contextmenu)=\"open($event, btn); $event.preventDefault();\"> \n        <div class=\"sln-chat-send-message sln-chat-send-message-position send-message\"></div>\n    </button>\n</div>\n", styles: ["@charset \"UTF-8\";.sln-foot-sent-message{display:flex;align-items:center}.sln-foot-sent-message .chat-input-submit{color:var(--WHITE);font-size:20px;border:none;outline:none;border-radius:50%;width:40px;height:38px;background:var(--PRIMARY);display:flex;align-items:center;justify-content:center;cursor:pointer}.sln-foot-sent-message .sellan-chat-input-text{background:var(--WHITE);min-height:50px;border-radius:15px;margin:0 auto;max-height:70px;border:1px solid var(--LIGHT-GRAY);font-family:var(--font)}.sellan-chat-input-text::-webkit-input-placeholder{color:inherit}.sellan-chat-input-text::-moz-placeholder{color:inherit}.sellan-chat-input-text::-ms-input-placeholder{color:inherit}.sellan-chat-input-submit{margin:14px 12px;float:right;background-color:inherit;color:inherit;font-size:24px;border:0;outline:none}.sellan-chat-input{display:flex;justify-content:space-evenly}::-webkit-scrollbar{width:5px;height:5px;background-color:transparent}::-webkit-scrollbar-thumb{background-color:var(--LIGHT-GRAY);border-radius:10px;cursor:auto}::-webkit-scrollbar-button:vertical:start:decrement{display:none}::-webkit-scrollbar-button:vertical:end:increment{display:none}\n"], dependencies: [{ kind: "directive", type: i2$6.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatInputComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-chat-input', encapsulation: ViewEncapsulation.None, standalone: false, template: "<div class=\"sln-foot-sent-message\">\n    <textarea type=\"text\" class=\"sellan-chat-input-text\" placeholder=\"C\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435...\" #message (keydown.enter)=\"onSubmit()\" (keyup.enter)=\"message.value = ''\" (keyup.escape)=\"dismiss.emit()\" cdkTextareaAutosize></textarea>\n    <button #btn [disabled]=\"disabled\" type=\"submit\" class=\"chat-input-submit\" (click)=\"onSubmit()\" (contextmenu)=\"open($event, btn); $event.preventDefault();\"> \n        <div class=\"sln-chat-send-message sln-chat-send-message-position send-message\"></div>\n    </button>\n</div>\n", styles: ["@charset \"UTF-8\";.sln-foot-sent-message{display:flex;align-items:center}.sln-foot-sent-message .chat-input-submit{color:var(--WHITE);font-size:20px;border:none;outline:none;border-radius:50%;width:40px;height:38px;background:var(--PRIMARY);display:flex;align-items:center;justify-content:center;cursor:pointer}.sln-foot-sent-message .sellan-chat-input-text{background:var(--WHITE);min-height:50px;border-radius:15px;margin:0 auto;max-height:70px;border:1px solid var(--LIGHT-GRAY);font-family:var(--font)}.sellan-chat-input-text::-webkit-input-placeholder{color:inherit}.sellan-chat-input-text::-moz-placeholder{color:inherit}.sellan-chat-input-text::-ms-input-placeholder{color:inherit}.sellan-chat-input-submit{margin:14px 12px;float:right;background-color:inherit;color:inherit;font-size:24px;border:0;outline:none}.sellan-chat-input{display:flex;justify-content:space-evenly}::-webkit-scrollbar{width:5px;height:5px;background-color:transparent}::-webkit-scrollbar-thumb{background-color:var(--LIGHT-GRAY);border-radius:10px;cursor:auto}::-webkit-scrollbar-button:vertical:start:decrement{display:none}::-webkit-scrollbar-button:vertical:end:increment{display:none}\n"] }]
        }], ctorParameters: () => [{ type: i1$4.Overlay }, { type: i0.ViewContainerRef }, { type: i0.ApplicationRef }, { type: i0.Injector }], propDecorators: { buttonText: [{
                type: Input
            }], disabled: [{
                type: Input
            }], focus: [{
                type: Input
            }], send: [{
                type: Output
            }], dismiss: [{
                type: Output
            }], message: [{
                type: ViewChild,
                args: ['message']
            }] } });

class CoreTooltipContainerComponent extends CoreAbstractComponent {
    constructor(_containerConfig) {
        super();
        this._containerConfig = _containerConfig;
        this.style = {};
        this.tooltipContainerClass = {};
        this.position = 'top';
        this.offset = 15;
    }
    ngAfterViewInit() {
        this._hostRect = this._containerConfig.host.getBoundingClientRect();
        this._containerRect = this.coreTooltipContainerElementRef.nativeElement.getBoundingClientRect();
        this.calculatePosition();
        this.tooltipContainerClass.visible = false;
        setTimeout(() => this.tooltipContainerClass.visible = true, 100);
    }
    ngAfterViewChecked() {
        this._containerRect = this.coreTooltipContainerElementRef.nativeElement.getBoundingClientRect();
        this.calculatePosition();
    }
    calculatePosition() {
        if (this.position === 'top') {
            this.style.top = `${this._hostRect.top - this._containerRect.height - this.offset}px`;
            this.style.left = `${this._hostRect.left + (this._hostRect.width - this._containerRect.width) / 2}px`;
        }
        if (this.position === 'bottom') {
            this.style.top = `${this._hostRect.bottom + this.offset}px`;
            this.style.left = `${this._hostRect.left + (this._hostRect.width - this._containerRect.width) / 2}px`;
        }
        if (this.position === 'left') {
            this.style.top = `${this._hostRect.top + (this._hostRect.height - this._containerRect.height) / 2}px`;
            this.style.left = `${this._hostRect.left - this._containerRect.width - this.offset}px`;
        }
        if (this.position === 'right') {
            this.style.top = `${this._hostRect.top + (this._hostRect.height - this._containerRect.height) / 2}px`;
            this.style.left = `${this._hostRect.right + this.offset}px`;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTooltipContainerComponent, deps: [{ token: 'coreContainerConfig' }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreTooltipContainerComponent, isStandalone: false, selector: "core-tooltip-container", inputs: { position: "position", offset: "offset" }, viewQueries: [{ propertyName: "coreTooltipContainerElementRef", first: true, predicate: ["coreTooltipContainer"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-tooltip-container sln-tooltip-position-{{position}} \" [ngClass]=\"tooltipContainerClass\" #coreTooltipContainer [ngStyle]=\"style\">\n  <ng-content></ng-content>\n</div>\n", styles: [".sln-tooltip-container{box-sizing:border-box;position:fixed;top:0;left:0;z-index:99;display:block;background-color:var(--WHITE);background:var(--WHITE);border:1px solid var(--LIGHT-GRAY);box-shadow:0 2px 10px #0000000a,0 6px 36px #00000005;-webkit-user-select:none;user-select:none;padding:5px;border-radius:4px;opacity:0;pointer-events:none;visibility:hidden;transition:opacity .2s;transition-timing-function:cubic-bezier(.53,-.07,0,1.34)}.sln-tooltip-container:after{box-sizing:border-box;content:\"\";position:absolute;top:99%;left:50%;margin-left:-5px;border-width:4px;border-style:solid;border-color:var(--WHITE) transparent transparent transparent;opacity:0;transition:opacity .2s;transition-timing-function:cubic-bezier(.53,-.07,0,1.34)}.sln-tooltip-container.visible{opacity:1;visibility:visible;pointer-events:auto}.sln-tooltip-container.visible:after{opacity:1}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTooltipContainerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-tooltip-container', standalone: false, template: "<div class=\"sln-tooltip-container sln-tooltip-position-{{position}} \" [ngClass]=\"tooltipContainerClass\" #coreTooltipContainer [ngStyle]=\"style\">\n  <ng-content></ng-content>\n</div>\n", styles: [".sln-tooltip-container{box-sizing:border-box;position:fixed;top:0;left:0;z-index:99;display:block;background-color:var(--WHITE);background:var(--WHITE);border:1px solid var(--LIGHT-GRAY);box-shadow:0 2px 10px #0000000a,0 6px 36px #00000005;-webkit-user-select:none;user-select:none;padding:5px;border-radius:4px;opacity:0;pointer-events:none;visibility:hidden;transition:opacity .2s;transition-timing-function:cubic-bezier(.53,-.07,0,1.34)}.sln-tooltip-container:after{box-sizing:border-box;content:\"\";position:absolute;top:99%;left:50%;margin-left:-5px;border-width:4px;border-style:solid;border-color:var(--WHITE) transparent transparent transparent;opacity:0;transition:opacity .2s;transition-timing-function:cubic-bezier(.53,-.07,0,1.34)}.sln-tooltip-container.visible{opacity:1;visibility:visible;pointer-events:auto}.sln-tooltip-container.visible:after{opacity:1}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: ['coreContainerConfig']
                }] }], propDecorators: { position: [{
                type: Input
            }], offset: [{
                type: Input
            }], coreTooltipContainerElementRef: [{
                type: ViewChild,
                args: ['coreTooltipContainer', { read: ElementRef }]
            }] } });

class CoreTooltipDirective {
    constructor(_hostElement, _injector, _viewContainerRef, _applicationRef) {
        this._hostElement = _hostElement;
        this._injector = _injector;
        this._viewContainerRef = _viewContainerRef;
        this._applicationRef = _applicationRef;
        this.hidden = false;
    }
    ngOnDestroy() {
        this.destroy();
    }
    mouseenter() {
        if (this.hidden === true) {
            return;
        }
        if (this._coreTooltipContainerComponentRef) {
            return;
        }
        const location = this.getRootViewContainerNode();
        const injector = Injector.create({
            providers: [{
                    provide: 'coreContainerConfig', useValue: { host: this._hostElement.nativeElement, data: this.contentData }
                }]
        });
        this._coreTooltipContainerComponentRef = this._viewContainerRef.createComponent(CoreTooltipContainerComponent, {
            injector: injector,
            projectableNodes: this.generateNgContent()
        });
        if (this._coreTooltipContainerComponentRef) {
            if (this.position) {
                this._coreTooltipContainerComponentRef.instance.position = this.position;
            }
            if (this.offset) {
                this._coreTooltipContainerComponentRef.instance.offset = this.offset;
            }
            this._coreTooltipContainerComponentRef.onDestroy(() => {
                this._applicationRef.detachView(this._coreTooltipContainerComponentRef.hostView);
            });
            location.appendChild(this.getComponentRootNode(this._coreTooltipContainerComponentRef));
        }
    }
    mouseout() {
        this.destroy();
    }
    generateNgContent() {
        const tooltipComponentRef = this._viewContainerRef.createComponent(this.contentType, { injector: this._injector });
        tooltipComponentRef.instance.data = this.contentData;
        tooltipComponentRef.changeDetectorRef.detectChanges();
        return [[tooltipComponentRef.location.nativeElement]];
    }
    /**Gets the root view container to inject the component to */
    getRootViewContainer() {
        if (this._rootComponent) {
            return this._rootComponent;
        }
        const rootComponents = this._applicationRef.components;
        if (rootComponents.length) {
            this._rootComponent = rootComponents[0];
            return rootComponents[0];
        }
        throw new Error('View Container not found! ngUpgrade needs to manually set this via setRootViewContainer.');
    }
    /**Gets the html element for a component ref. */
    getComponentRootNode(componentRef) {
        return componentRef.hostView.rootNodes[0];
    }
    /**Gets the root component container html element. */
    getRootViewContainerNode() {
        return this.getComponentRootNode(this.getRootViewContainer());
    }
    destroy() {
        if (this._coreTooltipContainerComponentRef) {
            this._coreTooltipContainerComponentRef.destroy();
            this._coreTooltipContainerComponentRef = null;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTooltipDirective, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i0.ViewContainerRef }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.18", type: CoreTooltipDirective, isStandalone: false, selector: "[core-tooltip]", inputs: { contentType: ["core-tooltip", "contentType"], contentData: "contentData", position: "position", offset: "offset", hidden: "hidden" }, host: { listeners: { "mouseenter": "mouseenter()", "mouseleave": "mouseout()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTooltipDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[core-tooltip]',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i0.ViewContainerRef }, { type: i0.ApplicationRef }], propDecorators: { contentType: [{
                type: Input,
                args: ['core-tooltip']
            }], contentData: [{
                type: Input
            }], position: [{
                type: Input
            }], offset: [{
                type: Input
            }], hidden: [{
                type: Input
            }], mouseenter: [{
                type: HostListener,
                args: ['mouseenter']
            }], mouseout: [{
                type: HostListener,
                args: ['mouseleave']
            }] } });

class CoreChatUserComponent extends CoreAbstractComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatUserComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreChatUserComponent, isStandalone: false, selector: "core-chat-user", inputs: { user: "user" }, usesInheritance: true, ngImport: i0, template: "<div class=\"sln-chat-user-item\">\n    <div>\n        <core-chat-avatar [useInChat]=\"false\" [fullName]=\"user?.fullName\" [url]=\"user?.avatarLink\" [backColor]=\"user?.avatarColor\"></core-chat-avatar>\n    </div>\n    <div class=\"sln-chat-user\">\n        <span>{{user?.fullName}}</span><br/>\n        <!--<small>\u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0438\u043B\u0438 \u0434\u043E\u0436\u043D\u043E\u0441\u0442\u044C</small>-->\n    </div>\n</div>\n\n", styles: [".sln-chat-user-item{display:flex;margin:0 0 10px;padding:10px;border-radius:5px;align-items:center}.sln-chat-user-item .sln-chat-user{padding-left:6px}.sln-chat-user-item .sln-chat-user span{color:var(--DARK-GREY)}.sln-chat-user-item .sln-chat-user small{color:var(--MIDLE-GRAY)}\n"], dependencies: [{ kind: "component", type: CoreChatAvatarComponent, selector: "core-chat-avatar", inputs: ["useInChat", "url", "backColor", "fullName", "newMsg", "newMsgMode"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatUserComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-chat-user', standalone: false, template: "<div class=\"sln-chat-user-item\">\n    <div>\n        <core-chat-avatar [useInChat]=\"false\" [fullName]=\"user?.fullName\" [url]=\"user?.avatarLink\" [backColor]=\"user?.avatarColor\"></core-chat-avatar>\n    </div>\n    <div class=\"sln-chat-user\">\n        <span>{{user?.fullName}}</span><br/>\n        <!--<small>\u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0438\u043B\u0438 \u0434\u043E\u0436\u043D\u043E\u0441\u0442\u044C</small>-->\n    </div>\n</div>\n\n", styles: [".sln-chat-user-item{display:flex;margin:0 0 10px;padding:10px;border-radius:5px;align-items:center}.sln-chat-user-item .sln-chat-user{padding-left:6px}.sln-chat-user-item .sln-chat-user span{color:var(--DARK-GREY)}.sln-chat-user-item .sln-chat-user small{color:var(--MIDLE-GRAY)}\n"] }]
        }], propDecorators: { user: [{
                type: Input
            }] } });

class SelectedChatUserFilterPipe {
    transform(items, filters) {
        if (!items || !filters) {
            return items;
        }
        return items.filter(item => !Utility.containsByKey(filters, { key: 'userId', value: item.userId }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SelectedChatUserFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: SelectedChatUserFilterPipe, isStandalone: false, name: "selectedUsers", pure: false }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SelectedChatUserFilterPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'selectedUsers',
                    pure: false,
                    standalone: false
                }]
        }] });

class CoreChatNewDrawerComponent extends CoreBaseDestroyComponent {
    get selectedUsers() {
        return this.excluded.concat(this.added);
    }
    constructor(config, _service, _popup, _eventBroker, _drawer, _chatUserService) {
        super();
        this.config = config;
        this._service = _service;
        this._popup = _popup;
        this._eventBroker = _eventBroker;
        this._drawer = _drawer;
        this._chatUserService = _chatUserService;
        this.name = DrawerNames.USER_LIST;
        this.added = [];
        this.excluded = [];
        if (config.data.isNew === false) {
            this.excluded = config.data.users;
        }
    }
    ngOnInit() {
        this._reloadUsers();
    }
    onSelect($event, user) {
        if ($event === true) {
            if (!Utility.containsByKey(this.added, { key: 'userId', value: user.userId })) {
                this.added.push(user);
            }
        }
        else {
            if (Utility.containsByKey(this.added, { key: 'userId', value: user.userId })) {
                this.added = this.added.filter(x => x !== user);
            }
        }
    }
    onSearchChange($event) {
        if ($event?.length >= 3) {
            this._reloadUsers($event);
        }
        else if ($event?.length == 0) {
            this._reloadUsers();
        }
    }
    close() {
        this._drawer.close(DrawerNames.USER_LIST);
    }
    next() {
        if (this.added.length === 1 && this.config.data.isNew) {
            //приватный чат
            const room = { name: 'Приватный чат', userIds: this.added.map(z => z.id) };
            this._chatUserService
                .createUserRoom(room)
                .pipe(this.takeUntilDestroyed())
                .subscribe(response => {
                this._popup.HandleIEntityResponse({
                    response: response,
                    successCallback: (entity) => {
                        this._eventBroker.emit("chat-drawer-call-dialog", entity);
                        this._drawer.close(DrawerNames.USER_LIST, { needReload: true });
                    }
                });
            });
        }
        else {
            // групповой чат 
            this.added.forEach(user => user.isNewRecord = true);
            this._drawer.show(CoreChatNewGroupDrawerComponent, { name: DrawerNames.GROUP, data: this.config.data });
            this._drawer.close(DrawerNames.USER_LIST, {
                users: this.excluded.concat(this.added).sort((a, b) => (a.fullName ?? '').localeCompare(b.fullName ?? ''))
            });
        }
    }
    _reloadUsers(userSearch) {
        this._service
            .getUsers(userSearch)
            .pipe(this.takeUntilDestroyed())
            .subscribe(response => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.users = entity;
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatNewDrawerComponent, deps: [{ token: CORE_DRAWER_DATA_TOKEN_KEY }, { token: CoreChatService }, { token: PopupResults }, { token: EventBrokerService }, { token: DrawerService }, { token: SellanChatUsersService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatNewDrawerComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-drawer [name]=\"name\" width=\"420\" [titleHeight]=\"90\" [footerHeight]=\"70\">\n  <div title class=\"sln-new-group-header\">\n    <div class=\"sln-new-group-new-chat\">\n      <button (click)=\"close()\" class=\"sln-drawer-close\">\n        x\n      </button>\n      <h3 class=\"sln-drawer-new-chat\">{{ config.data.isNew ? '\u041D\u043E\u0432\u044B\u0439 \u0447\u0430\u0442' : '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u0432'}}</h3>\n    </div>\n    <form #userSearchForm=\"ngForm\" novalidate style=\"width: 300px;\">\n      <core-field-string [(ngModel)]=\"userSearch\" name=\"userSearch\" fieldName=\"userSearch\" placeholder=\"\u041F\u043E\u0438\u0441\u043A\" (valueChange)=\"onSearchChange($event)\"\n      [settings]=\"{ rightHintHide: true }\" class=\"sln-input-s\"></core-field-string>\n    </form>\n  </div>\n  <div body>\n    <form #bodyForm=\"ngForm\" novalidate  class=\"sln-new-chat-form\">\n      @for (user of added; track user; let i = $index) {\n        <div class=\"row\">\n          <div class=\"col-md-10\">\n            <core-chat-user [user]=\"user\"></core-chat-user>\n          </div>\n          <div class=\"col-md-2\">\n            <core-field-bool fieldName=\"added_selected_{{i}}\" placeholder=\"\"\n            [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onSelect($event, user)\" value=\"true\"></core-field-bool>\n          </div>\n        </div>\n      }\n      @for (user of users | selectedUsers:selectedUsers; track user; let i = $index) {\n        <div class=\"row\">\n          <div class=\"col-md-10\">\n            <core-chat-user [user]=\"user\"></core-chat-user>\n          </div>\n          <div class=\"col-md-2\">\n            <core-field-bool fieldName=\"users_selected_{{i}}\" placeholder=\"\"\n            [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onSelect($event, user)\"></core-field-bool>\n          </div>\n        </div>\n      }\n    </form>\n  </div>\n  <div footer class=\"sln-new-group-footer\">\n    <button class=\"btn-default sln-btn-full-s close\" (click)=\"close()\">\n      \u041E\u0442\u043C\u0435\u043D\u0430\n    </button>\n    <button class=\"btn-primary sln-btn-full-s next\" (click)=\"next()\" [disabled]=\"added?.length === 0\">\n      \u0414\u0430\u043B\u0435\u0435\n    </button>\n  </div>\n</core-drawer>", styles: [".sln-new-group-header{padding:0 14px;display:flex;align-items:baseline;width:100%;justify-content:space-between;border-bottom:2px solid var(--PRIMARY)}.sln-new-group-header .sln-drawer-new-chat{color:var(--DARK-GREY);font-size:20px;font-weight:500;padding-bottom:10px}.sln-new-group-footer{display:flex;justify-content:flex-end;padding:5px 15px}.sln-new-group-footer .btn-primary{margin-left:10px;min-width:100px}.sln-new-chat-form{width:100%}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}.sln-new-group-new-chat{display:flex;align-items:baseline}.next{margin-left:10px}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreChatUserComponent, selector: "core-chat-user", inputs: ["user"] }, { kind: "component", type: CoreDrawerComponent, selector: "core-drawer", inputs: ["name", "titleHeight", "footerHeight", "dialogTitle", "width", "minWidth", "hasTitle", "hasFooter", "goto"], outputs: ["reachedTopRun", "reachedBottomRun"] }, { kind: "pipe", type: SelectedChatUserFilterPipe, name: "selectedUsers" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatNewDrawerComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-drawer [name]=\"name\" width=\"420\" [titleHeight]=\"90\" [footerHeight]=\"70\">\n  <div title class=\"sln-new-group-header\">\n    <div class=\"sln-new-group-new-chat\">\n      <button (click)=\"close()\" class=\"sln-drawer-close\">\n        x\n      </button>\n      <h3 class=\"sln-drawer-new-chat\">{{ config.data.isNew ? '\u041D\u043E\u0432\u044B\u0439 \u0447\u0430\u0442' : '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u0432'}}</h3>\n    </div>\n    <form #userSearchForm=\"ngForm\" novalidate style=\"width: 300px;\">\n      <core-field-string [(ngModel)]=\"userSearch\" name=\"userSearch\" fieldName=\"userSearch\" placeholder=\"\u041F\u043E\u0438\u0441\u043A\" (valueChange)=\"onSearchChange($event)\"\n      [settings]=\"{ rightHintHide: true }\" class=\"sln-input-s\"></core-field-string>\n    </form>\n  </div>\n  <div body>\n    <form #bodyForm=\"ngForm\" novalidate  class=\"sln-new-chat-form\">\n      @for (user of added; track user; let i = $index) {\n        <div class=\"row\">\n          <div class=\"col-md-10\">\n            <core-chat-user [user]=\"user\"></core-chat-user>\n          </div>\n          <div class=\"col-md-2\">\n            <core-field-bool fieldName=\"added_selected_{{i}}\" placeholder=\"\"\n            [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onSelect($event, user)\" value=\"true\"></core-field-bool>\n          </div>\n        </div>\n      }\n      @for (user of users | selectedUsers:selectedUsers; track user; let i = $index) {\n        <div class=\"row\">\n          <div class=\"col-md-10\">\n            <core-chat-user [user]=\"user\"></core-chat-user>\n          </div>\n          <div class=\"col-md-2\">\n            <core-field-bool fieldName=\"users_selected_{{i}}\" placeholder=\"\"\n            [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onSelect($event, user)\"></core-field-bool>\n          </div>\n        </div>\n      }\n    </form>\n  </div>\n  <div footer class=\"sln-new-group-footer\">\n    <button class=\"btn-default sln-btn-full-s close\" (click)=\"close()\">\n      \u041E\u0442\u043C\u0435\u043D\u0430\n    </button>\n    <button class=\"btn-primary sln-btn-full-s next\" (click)=\"next()\" [disabled]=\"added?.length === 0\">\n      \u0414\u0430\u043B\u0435\u0435\n    </button>\n  </div>\n</core-drawer>", styles: [".sln-new-group-header{padding:0 14px;display:flex;align-items:baseline;width:100%;justify-content:space-between;border-bottom:2px solid var(--PRIMARY)}.sln-new-group-header .sln-drawer-new-chat{color:var(--DARK-GREY);font-size:20px;font-weight:500;padding-bottom:10px}.sln-new-group-footer{display:flex;justify-content:flex-end;padding:5px 15px}.sln-new-group-footer .btn-primary{margin-left:10px;min-width:100px}.sln-new-chat-form{width:100%}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}.sln-new-group-new-chat{display:flex;align-items:baseline}.next{margin-left:10px}\n"] }]
        }], ctorParameters: () => [{ type: DrawerConfig, decorators: [{
                    type: Inject,
                    args: [CORE_DRAWER_DATA_TOKEN_KEY]
                }] }, { type: CoreChatService }, { type: PopupResults }, { type: EventBrokerService }, { type: DrawerService }, { type: SellanChatUsersService }] });

class CoreChatNewGroupDrawerComponent extends CoreBaseDestroyComponent {
    get currentUser() {
        return this._chatUserService.chatUser;
    }
    constructor(config, _popup, _drawer, _chatUserService, _eventBroker, _avatarService, _cropper) {
        super();
        this.config = config;
        this._popup = _popup;
        this._drawer = _drawer;
        this._chatUserService = _chatUserService;
        this._eventBroker = _eventBroker;
        this._avatarService = _avatarService;
        this._cropper = _cropper;
        this.name = DrawerNames.GROUP;
        this.users = config.data.users;
        this._chatNewEvents = _eventBroker.listen('drawer-closed-event', (value) => {
            if (value.name === DrawerNames.USER_LIST) {
                if (Array.isArray(value.data?.users)) {
                    this.users = value.data.users;
                }
            }
        });
    }
    add() {
        this._drawer.show(CoreChatNewDrawerComponent, { name: DrawerNames.USER_LIST, data: this.config.data });
    }
    close() {
        this._drawer.close(DrawerNames.GROUP, { needReload: true });
    }
    next() {
        if (this.config.data.isNew) {
            // создаем новую группу
            const room = { name: this.roomName, userIds: this.users.map(z => z.id) };
            this._chatUserService
                .createUserRoom(room)
                .pipe(this.takeUntilDestroyed())
                .subscribe(response => {
                this._popup.HandleIEntityResponse({
                    response: response,
                    successCallback: (entity) => {
                        this._eventBroker.emit("chat-drawer-call-dialog", entity);
                        this._drawer.close(DrawerNames.GROUP, { needReload: true });
                    }
                });
            });
        }
        else {
            // добавляем в группу новых пользователей
            this._chatUserService
                .addUserIntoGroup({ roomId: this.config.data.roomId, usersIds: this.users.filter(z => z.isNewRecord).map(z => z.id) })
                .pipe(this.takeUntilDestroyed())
                .subscribe(response => {
                this._popup.HandleIEntityResponse({
                    response: response,
                    successCallback: () => {
                        this._drawer.close(DrawerNames.GROUP, { needReload: true, users: this.users });
                    }
                });
            });
        }
    }
    uploadIcon() {
        this._cropper.uploadAvatar((upload) => {
            this._avatarService
                .avatarUpload(AvatarEntity.Chat, this.config.data.roomId, upload)
                .pipe(this.takeUntilDestroyed())
                .subscribe(response => this._popup.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this.config.data.avatarLink = entity;
                }
            }));
        });
    }
    removeIcon() {
        this._avatarService
            .avatarRemove(AvatarEntity.Chat, this.config.data.roomId)
            .pipe(this.takeUntilDestroyed())
            .subscribe(response => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.config.data.avatarLink = undefined;
            }
        }));
    }
    setColor() {
        this._avatarService
            .avatarBackground(AvatarEntity.Chat, this.config.data.roomId)
            .pipe(this.takeUntilDestroyed())
            .subscribe(response => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.config.data.avatarColor = entity;
            }
        }));
    }
    removeUser(user) {
        this.users = this.users.filter(z => z.id !== user.id);
        this._chatUserService
            .removeUserFromGroup({ roomId: this.config.data.roomId, usersIds: [user.id] })
            .pipe(this.takeUntilDestroyed())
            .subscribe(response => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: () => {
                this.users = this.users.filter(z => z.id !== user.id);
            }
        }));
    }
    ngOnDestroy() {
        this._chatNewEvents.ignore();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatNewGroupDrawerComponent, deps: [{ token: CORE_DRAWER_DATA_TOKEN_KEY }, { token: PopupResults }, { token: DrawerService }, { token: SellanChatUsersService }, { token: EventBrokerService }, { token: CoreAvatarService }, { token: CoreCropperService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatNewGroupDrawerComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-drawer [name]=\"name\" width=\"420\" [footerHeight]=\"60\">\n  <div title class=\"sln-new-group-header\">\n    <h3>{{ config.data.isNew ? '\u041D\u043E\u0432\u044B\u0439 \u0447\u0430\u0442': config.data.chatName }}</h3>\n  </div>\n  <div body class=\"sln-new-group-wrap\">\n    <form #bodyForm=\"ngForm\" novalidate>\n      @if (config.data.isNew) {\n        <div class=\"row\">\n          <div class=\"col-md-12\">\n            <core-field-string [(ngModel)]=\"roomName\" name=\"roomName\" fieldName=\"roomName\" placeholder=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0433\u0440\u0443\u043F\u043F\u044B\"\n            [settings]=\"{ isRequired: true, rightHintHide: true }\" class=\"sln-input-s\"></core-field-string>\n          </div>\n        </div>\n      }\n      @if (!config.data.isNew) {\n        <div class=\"row sln-block-user-icon\">\n          <div class=\"sln-editable-icon-block\">\n            <div class=\"core-user-icon\">\n              <core-user-icon sizeSuffix=\"preview\"\n                [fullName]=\"config.data.chatName\"\n                [url]=\"config.data.avatarLink\"\n                [backColor]=\"config.data.avatarColor\">\n              </core-user-icon>\n              <div  class=\"sln-editable-icon sln-editable-icon-avatar\" (click)=\"uploadIcon()\">\n                <div class=\"sln-chat-add-photo sln-chat-add-photo-position\"></div>\n              </div>\n              <div class=\"sln-editable-icon sln-editable-icon-color\" (click)=\"setColor()\">\n                <div class=\"sln-chat-change-color-photo sln-chat-change-color-photo-position\"></div>\n              </div>\n              @if (config.data.avatarLink) {\n                <div class=\"sln-editable-icon sln-editable-icon-remove\" (click)=\"removeIcon()\">\n                  <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n                </div>\n              }\n            </div>\n          </div>\n        </div>\n      }\n\n      <div class=\"col-md-12\">\n        <div class=\"sln-new-group-users\">      \n          <span>\u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0438 \u0433\u0440\u0443\u043F\u043F\u044B</span>\n          @if (!config.data.isNew) {\n            <button (click)=\"add()\" class=\"light-btn-primary sln-btn-light-s\">\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C</button>\n          }\n        </div>       \n      </div>\n      <div class=\"col-md-12\">\n        @for (user of users; track user; let i = $index) {\n          <div class=\"sln-new-group-users-list\">       \n              <core-chat-user [user]=\"user\"></core-chat-user>   \n              @if(user.id !== currentUser.id){   \n                <button class=\"sln-bg-none\" (click)=\"removeUser(user)\" tid=\"remove-user\"  matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\">\n                  <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n                </button>       \n              }\n          </div>\n        }\n      </div>\n     \n    </form>\n  </div>\n  <div footer class=\"sln-new-group-footer\">\n    <button class=\"btn-default sln-btn-full-s close\" (click)=\"close()\">\n      \u041E\u0442\u043C\u0435\u043D\u0430\n    </button>\n    <button class=\"btn-primary sln-btn-full-s next\" (click)=\"next()\" [disabled]=\"bodyForm.invalid\">\n      \u0414\u0430\u043B\u0435\u0435\n    </button>\n  </div>\n</core-drawer>", styles: [".sln-new-group-header{padding:0 15px;margin-bottom:7px}.sln-new-group-header h3{color:var(--DARK-GREY);font-size:20px;font-weight:500}.sln-new-group-users{display:flex;justify-content:space-between;align-items:center;padding:0 15px 10px;border-bottom:2px solid var(--PRIMARY)}.sln-new-group-users span{color:var(--DARK-GREY);font-size:14px}.sln-new-group-users-list{display:flex;align-items:center;justify-content:space-between}.sln-new-group-users-list button{margin-right:10px;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s ease-in-out}.sln-new-group-users-list:hover button,.sln-new-group-users-list:focus-within button{opacity:1;visibility:visible;pointer-events:auto}.sln-new-group-users-list .col-md-12{padding:0 7px}.sln-new-group-footer{display:flex;justify-content:flex-end;padding:0 15px}.sln-new-group-footer .btn-primary{margin-left:10px;min-width:100px}.sln-editable-icon-block{width:100%;justify-content:center}.next{margin-left:10px}::ng-deep .sln-chat-user-item{background:none}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreUserIconComponent, selector: "core-user-icon", inputs: ["useInChat", "sizeSuffix", "url", "backColor", "fullName"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreChatUserComponent, selector: "core-chat-user", inputs: ["user"] }, { kind: "component", type: CoreDrawerComponent, selector: "core-drawer", inputs: ["name", "titleHeight", "footerHeight", "dialogTitle", "width", "minWidth", "hasTitle", "hasFooter", "goto"], outputs: ["reachedTopRun", "reachedBottomRun"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatNewGroupDrawerComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-drawer [name]=\"name\" width=\"420\" [footerHeight]=\"60\">\n  <div title class=\"sln-new-group-header\">\n    <h3>{{ config.data.isNew ? '\u041D\u043E\u0432\u044B\u0439 \u0447\u0430\u0442': config.data.chatName }}</h3>\n  </div>\n  <div body class=\"sln-new-group-wrap\">\n    <form #bodyForm=\"ngForm\" novalidate>\n      @if (config.data.isNew) {\n        <div class=\"row\">\n          <div class=\"col-md-12\">\n            <core-field-string [(ngModel)]=\"roomName\" name=\"roomName\" fieldName=\"roomName\" placeholder=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0433\u0440\u0443\u043F\u043F\u044B\"\n            [settings]=\"{ isRequired: true, rightHintHide: true }\" class=\"sln-input-s\"></core-field-string>\n          </div>\n        </div>\n      }\n      @if (!config.data.isNew) {\n        <div class=\"row sln-block-user-icon\">\n          <div class=\"sln-editable-icon-block\">\n            <div class=\"core-user-icon\">\n              <core-user-icon sizeSuffix=\"preview\"\n                [fullName]=\"config.data.chatName\"\n                [url]=\"config.data.avatarLink\"\n                [backColor]=\"config.data.avatarColor\">\n              </core-user-icon>\n              <div  class=\"sln-editable-icon sln-editable-icon-avatar\" (click)=\"uploadIcon()\">\n                <div class=\"sln-chat-add-photo sln-chat-add-photo-position\"></div>\n              </div>\n              <div class=\"sln-editable-icon sln-editable-icon-color\" (click)=\"setColor()\">\n                <div class=\"sln-chat-change-color-photo sln-chat-change-color-photo-position\"></div>\n              </div>\n              @if (config.data.avatarLink) {\n                <div class=\"sln-editable-icon sln-editable-icon-remove\" (click)=\"removeIcon()\">\n                  <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n                </div>\n              }\n            </div>\n          </div>\n        </div>\n      }\n\n      <div class=\"col-md-12\">\n        <div class=\"sln-new-group-users\">      \n          <span>\u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0438 \u0433\u0440\u0443\u043F\u043F\u044B</span>\n          @if (!config.data.isNew) {\n            <button (click)=\"add()\" class=\"light-btn-primary sln-btn-light-s\">\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C</button>\n          }\n        </div>       \n      </div>\n      <div class=\"col-md-12\">\n        @for (user of users; track user; let i = $index) {\n          <div class=\"sln-new-group-users-list\">       \n              <core-chat-user [user]=\"user\"></core-chat-user>   \n              @if(user.id !== currentUser.id){   \n                <button class=\"sln-bg-none\" (click)=\"removeUser(user)\" tid=\"remove-user\"  matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\">\n                  <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n                </button>       \n              }\n          </div>\n        }\n      </div>\n     \n    </form>\n  </div>\n  <div footer class=\"sln-new-group-footer\">\n    <button class=\"btn-default sln-btn-full-s close\" (click)=\"close()\">\n      \u041E\u0442\u043C\u0435\u043D\u0430\n    </button>\n    <button class=\"btn-primary sln-btn-full-s next\" (click)=\"next()\" [disabled]=\"bodyForm.invalid\">\n      \u0414\u0430\u043B\u0435\u0435\n    </button>\n  </div>\n</core-drawer>", styles: [".sln-new-group-header{padding:0 15px;margin-bottom:7px}.sln-new-group-header h3{color:var(--DARK-GREY);font-size:20px;font-weight:500}.sln-new-group-users{display:flex;justify-content:space-between;align-items:center;padding:0 15px 10px;border-bottom:2px solid var(--PRIMARY)}.sln-new-group-users span{color:var(--DARK-GREY);font-size:14px}.sln-new-group-users-list{display:flex;align-items:center;justify-content:space-between}.sln-new-group-users-list button{margin-right:10px;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s ease-in-out}.sln-new-group-users-list:hover button,.sln-new-group-users-list:focus-within button{opacity:1;visibility:visible;pointer-events:auto}.sln-new-group-users-list .col-md-12{padding:0 7px}.sln-new-group-footer{display:flex;justify-content:flex-end;padding:0 15px}.sln-new-group-footer .btn-primary{margin-left:10px;min-width:100px}.sln-editable-icon-block{width:100%;justify-content:center}.next{margin-left:10px}::ng-deep .sln-chat-user-item{background:none}\n"] }]
        }], ctorParameters: () => [{ type: DrawerConfig, decorators: [{
                    type: Inject,
                    args: [CORE_DRAWER_DATA_TOKEN_KEY]
                }] }, { type: PopupResults }, { type: DrawerService }, { type: SellanChatUsersService }, { type: EventBrokerService }, { type: CoreAvatarService }, { type: CoreCropperService }] });

class CoreChatDialogMenuComponent extends CoreBaseDestroyComponent {
    constructor(_drawer, _chatUserService, _popup, _chatMessageService) {
        super();
        this._drawer = _drawer;
        this._chatUserService = _chatUserService;
        this._popup = _popup;
        this._chatMessageService = _chatMessageService;
        this.chatChanged = new EventEmitter();
        this.showSearch = new EventEmitter();
        this.searchState = false;
    }
    search() {
        this.showSearch.emit(this.searchState = !this.searchState);
    }
    users() {
        const roomData = {
            isNew: false,
            roomId: this.chat.id,
            chatName: this.chat.name,
            users: this.chat.chatUsers,
            avatarLink: this.chat.avatarLink,
            avatarColor: this.chat.avatarColor
        };
        this._drawer.show(CoreChatNewGroupDrawerComponent, { name: DrawerNames.GROUP, data: roomData });
    }
    close() {
        this._drawer.close(DrawerNames.LIST);
    }
    exit() {
        this._chatUserService
            .removeUserFromGroup({ roomId: this.chat.id, usersIds: [this._chatUserService.chatUser.id] })
            .pipe(this.takeUntilDestroyed())
            .subscribe(response => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: () => {
                this._chatMessageService.resetPage();
                this._chatMessageService.clearMessages();
                this.chat = null;
                this._drawer.close(DrawerNames.DIALOG, { needReload: true });
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatDialogMenuComponent, deps: [{ token: DrawerService }, { token: SellanChatUsersService }, { token: PopupResults }, { token: SellanChatMessageService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatDialogMenuComponent, isStandalone: false, selector: "core-chat-dialog-menu", inputs: { chat: "chat" }, outputs: { chatChanged: "chatChanged", showSearch: "showSearch" }, usesInheritance: true, ngImport: i0, template: "<button class=\"btn-chat\" [matMenuTriggerFor]=\"actionMenu\">\n  <div matTooltip=\"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\" matTooltipPosition=\"below\">\n    <div class=\"sln-grid-vertical-dots\" aria-hidden=\"true\"></div>\n  </div>\n</button>\n<mat-menu #actionMenu=\"matMenu\">\n  <button mat-menu-item (click)=\"search()\">\n    <div class=\"sln-chat-search sln-chat-search-position\"></div>\n    <span class=\"b-margin-icon\">\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0447\u0430\u0442\u0443</span>\n  </button>\n  @if (!chat.isPrivate) {\n    <button mat-menu-item (click)=\"users()\" class=\"sln-chat-dialog-menu-users\">\n      <div class=\"sln-person-data \"></div>\n      <span class=\"b-margin-icon\">\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0438</span>\n    </button>\n  }\n  @if (!chat.isPrivate && !chat.isProvider) {\n    <button mat-menu-item (click)=\"exit()\">\n      <div class=\"sln-chat-logout sln-chat-logout-position\" alt=\"\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u0433\u0440\u0443\u043F\u043F\u044B\"></div>\n      <span class=\"b-margin-icon\" style=\"color: var(--DANGER);\">\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u0433\u0440\u0443\u043F\u043F\u044B</span>\n    </button>\n  }\n</mat-menu>", styles: [".btn-chat{background:transparent;border:none;margin-left:0;cursor:pointer;line-height:0;height:100%;width:20px;padding-top:2px}.btn-chat img{height:18px}.sln-chat-dialog-menu-users img{width:20px}\n"], dependencies: [{ kind: "component", type: i4$6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatDialogMenuComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-chat-dialog-menu', standalone: false, template: "<button class=\"btn-chat\" [matMenuTriggerFor]=\"actionMenu\">\n  <div matTooltip=\"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\" matTooltipPosition=\"below\">\n    <div class=\"sln-grid-vertical-dots\" aria-hidden=\"true\"></div>\n  </div>\n</button>\n<mat-menu #actionMenu=\"matMenu\">\n  <button mat-menu-item (click)=\"search()\">\n    <div class=\"sln-chat-search sln-chat-search-position\"></div>\n    <span class=\"b-margin-icon\">\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0447\u0430\u0442\u0443</span>\n  </button>\n  @if (!chat.isPrivate) {\n    <button mat-menu-item (click)=\"users()\" class=\"sln-chat-dialog-menu-users\">\n      <div class=\"sln-person-data \"></div>\n      <span class=\"b-margin-icon\">\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0438</span>\n    </button>\n  }\n  @if (!chat.isPrivate && !chat.isProvider) {\n    <button mat-menu-item (click)=\"exit()\">\n      <div class=\"sln-chat-logout sln-chat-logout-position\" alt=\"\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u0433\u0440\u0443\u043F\u043F\u044B\"></div>\n      <span class=\"b-margin-icon\" style=\"color: var(--DANGER);\">\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u0433\u0440\u0443\u043F\u043F\u044B</span>\n    </button>\n  }\n</mat-menu>", styles: [".btn-chat{background:transparent;border:none;margin-left:0;cursor:pointer;line-height:0;height:100%;width:20px;padding-top:2px}.btn-chat img{height:18px}.sln-chat-dialog-menu-users img{width:20px}\n"] }]
        }], ctorParameters: () => [{ type: DrawerService }, { type: SellanChatUsersService }, { type: PopupResults }, { type: SellanChatMessageService }], propDecorators: { chat: [{
                type: Input
            }], chatChanged: [{
                type: Output
            }], showSearch: [{
                type: Output
            }] } });

class CoreChatDialogDrawerComponent extends CoreChatAbstractComponent {
    get footerHeight() {
        if (this.answerMsg !== null) {
            return 120;
        }
        return 60;
    }
    constructor(config, _drawer, _dialog, _cryptoM, _popupM, _chatMessageService, _chatUserService, signalRService, _notificationService, overlay, viewContainerRef, highlighterPipe, _appRef, _injector) {
        super(_cryptoM, _popupM, _chatMessageService, _chatUserService);
        this.config = config;
        this._drawer = _drawer;
        this.signalRService = signalRService;
        this._notificationService = _notificationService;
        this.overlay = overlay;
        this.viewContainerRef = viewContainerRef;
        this.highlighterPipe = highlighterPipe;
        this._appRef = _appRef;
        this._injector = _injector;
        this.name = DrawerNames.DIALOG;
        this.search = false;
        this.avatar = '';
        this.userAvatar = '';
        this.startingMessage = '';
        this.focus = new Subject();
        this.messages = [];
        this.tooltipWhoReadComponentType = CoreChatDialodReadingMessageTooltipComponent;
        this.setChat(config.data);
        this._chatGroupEvents = _injector.get(EventBrokerService).listen('drawer-closed-event', (value) => {
            if (value.name === DrawerNames.GROUP) {
                if (Array.isArray(value.data?.users)) {
                    this.chat.chatUsers = value.data.users;
                }
            }
        });
    }
    handleKeyboardEvent(event) {
        if (event.key === '/') {
            this.focusMessage();
        }
        if (event.key === '?') {
        }
    }
    handleDocumentMouseDown(event) {
        if (event.button !== 0 || !this._menuComponentRef) {
            return;
        }
        const menuElement = this._menuHostElement?.querySelector('.sln-user-menu');
        const target = event.target;
        if (menuElement && target && !menuElement.contains(target)) {
            this.close();
        }
    }
    onSearchShow($event) {
        this.search = $event;
        this.searchMessage.setShowSearchBar($event);
    }
    ngOnInit() {
        super.ngOnInit();
        this.focusMessage();
        this._notificationService.isNotify
            .pipe(this.takeUntilDestroyed()).subscribe(z => {
            this.focusMessage();
        });
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this._chatGroupEvents.ignore();
        this.close();
    }
    ngDoCheck() {
        this._refreshMessages();
    }
    _refreshMessages() {
        if (this.roomId != null) {
            if (this._chatMessageService.getMessages().filter(z => this.messages.length > 0 && z.status == MessageStatus.NotSend && z.roomId == this.roomId).length > 0) {
                this.messages = [];
                this.messages = this.messages.concat(this._chatMessageService.getMessages().filter(z => z.status == MessageStatus.NotSend && z.roomId == this.roomId));
                this.messages = this.messages.concat(this._chatMessageService.getMessages().filter(z => z.status != MessageStatus.NotSend));
                return;
            }
            this.messages = this._chatMessageService.getMessages().filter(z => z.status != MessageStatus.NotSend);
        }
    }
    sendMessage(event) {
        const newMsg = {
            onlyOrganizations: event.onlyOrganizations,
            content: event.message,
            parentMessageId: this.answerMsg,
            parentMessageType: this.answerMsg == null ? null : ParentMessageType.Answer
        };
        this._chatMessageService
            .sendMessage(newMsg, this.chat.id);
        this.answerMsg = null;
        this.answerMsgContent = null;
        this.focusMessage();
    }
    dateEquals(date1, date2) {
        if (date1 == null || date2 == null) {
            return;
        }
        const res = (date1.slice(0, 10) === date2.slice(0, 10));
        return res;
    }
    clearAnswerMessage() {
        this.answerMsg = null;
        this.answerMsgContent = null;
    }
    closeDrawChat() {
        this._drawer.close(DrawerNames.DIALOG, { needReload: true });
    }
    open({ x, y }, message, chatMessage) {
        this.close();
        this.overlayRef = this.overlay.create({
            hasBackdrop: true,
            backdropClass: 'mat-overlay-transparent-backdrop',
            scrollStrategy: this.overlay.scrollStrategies.close(),
        });
        this._menuHostElement = this.overlayRef.overlayElement.ownerDocument.createElement('div');
        this.overlayRef.overlayElement.appendChild(this._menuHostElement);
        this._menuComponentRef = createComponent(CoreChatMessageMenuComponent, {
            environmentInjector: this._appRef.injector,
            hostElement: this._menuHostElement,
            elementInjector: this._injector,
        });
        this._menuComponentRef.instance.chat = this.chat;
        this._menuComponentRef.instance.message = message;
        this._appRef.attachView(this._menuComponentRef.hostView);
        this._menuComponentRef.changeDetectorRef.detectChanges();
        const menuElement = this._menuHostElement?.querySelector('.sln-user-menu');
        if (menuElement) {
            const ownerDocument = this._menuHostElement?.ownerDocument ?? document;
            const viewportWidth = ownerDocument.defaultView?.innerWidth ?? ownerDocument.documentElement.clientWidth;
            const right = Math.max(0, viewportWidth - x);
            menuElement.style.right = `${right}px`;
            menuElement.style.top = `${y}px`;
        }
        this._menuComponentRef.instance.messageAnswerEvent.subscribe(event => {
            this.answerMsg = event.answerMessageId;
            this.answerMsgContent = event.answerMessageContent;
            this.close();
        });
        this._menuComponentRef.instance.answerPersonallyEvent.subscribe(event => {
            this.setChat(event);
            this.close();
        });
        this._menuComponentRef.instance.messageDeleteEvent.subscribe(event => {
            this.close();
            this._chatMessageService.deleteMessageById(event);
        });
        this._menuComponentRef.instance.messageStorageDeleteEvent.subscribe(event => {
            this.close();
            this._chatMessageService.deleteMessageByCacheId(event);
        });
        this._menuComponentRef.instance.messageForwardEvent.subscribe(event => {
            this.close();
        });
        this.overlayRef.backdropClick()
            .pipe(this.takeUntilDestroyed()).subscribe(() => {
            this.close();
        });
    }
    close() {
        if (this.overlayRef) {
            if (this._menuComponentRef) {
                this._appRef.detachView(this._menuComponentRef.hostView);
                const hostEl = this._menuComponentRef.location.nativeElement;
                this._menuComponentRef.destroy();
                hostEl?.remove();
                this._menuComponentRef = undefined;
                this._menuHostElement = undefined;
            }
            this.overlayRef.dispose();
            this.overlayRef = null;
        }
    }
    closeChat(event) {
        if (!!event) {
            this._chatMessageService.resetPage();
            this._chatMessageService.clearMessages();
            this.chat = null;
            this.close();
        }
    }
    scrollToBottom() {
        if (this.bottom !== undefined) {
            this.bottom.nativeElement.scrollIntoView();
        }
    }
    focusMessage() {
        setTimeout(() => {
            this.focus.next(true);
            this.scrollToBottom();
        }, 500);
    }
    onScroll($event) {
        if ($event.position !== 'TOP' || this._chatMessageService.messagesRanOut) {
            return;
        }
        // Чтобы не запускать параллельные подгрузки при частых событиях скролла.
        if (this._chatMessageService.isLoading) {
            return;
        }
        const viewport = this.drawer?.perfectScroll?.viewport;
        if (!viewport) {
            return;
        }
        // Сохраняем текущую позицию скролла до подгрузки.
        const scrollTopBefore = viewport.scrollTop;
        const contentHeightBefore = viewport.contentHeight;
        this._chatMessageService.nextPage();
        this._chatMessageService.updatePageMessages(this.roomId)
            .pipe(take(1))
            .subscribe(() => {
            // Ждём, пока Angular отрендерит добавленные сообщения.
            setTimeout(() => {
                this.drawer?.perfectScroll?.update();
                const contentHeightAfter = viewport.contentHeight;
                const delta = contentHeightAfter - contentHeightBefore;
                const targetScrollTop = scrollTopBefore + delta;
                // Клэмпим, чтобы не улететь за максимально допустимое значение.
                const maxScrollTop = viewport.scrollTop + viewport.scrollMaxY;
                viewport.scrollYTo(Math.max(0, Math.min(targetScrollTop, maxScrollTop)));
            }, 0);
        });
    }
    onGoto($event) {
        this.goto = $event;
    }
    setChat(event) {
        this._chatMessageService.resetPage();
        this.chat = event;
        this._chatMessageService.clearMessages();
        if (!!this.searchMessage) {
            this.searchMessage.clearMessage();
        }
        this.updateRoomHistory(event.id);
        this.messages = [];
        this.answerMsg = null;
        this.answerMsgContent = null;
        this.roomId = event.id;
    }
    goToChatList() {
        this._drawer.close(this.name);
    }
    getHighlightedMessageContent(message) {
        if (!this.searchMessage?.searching)
            return message.content;
        return this.highlighterPipe.transform(message.content, this.searchMessage.searchText, 'partial', this.getMatchIndex(message.id.toString()));
    }
    getMatchIndex(messageId) {
        const foundIds = this.searchMessage?.searchMessagesIds;
        const currentIndex = this.searchMessage?.indexOfFound;
        if (!foundIds || currentIndex == null)
            return -1;
        const targetId = foundIds[currentIndex - 1];
        if (messageId !== targetId)
            return -1;
        // считаем сколько раз messageId встретился до текущего индекса
        let localIndex = 0;
        for (let i = 0; i < currentIndex; i++) {
            if (foundIds[i] === messageId) {
                localIndex++;
            }
        }
        return localIndex === 0 ? -1 : localIndex;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatDialogDrawerComponent, deps: [{ token: CORE_DRAWER_DATA_TOKEN_KEY }, { token: DrawerService }, { token: i1$8.MatDialog }, { token: CryptoSignService }, { token: PopupResults }, { token: SellanChatMessageService }, { token: SellanChatUsersService }, { token: SignalRService }, { token: SellanChatNotificationService }, { token: i1$4.Overlay }, { token: i0.ViewContainerRef }, { token: SellanChatHighlighterPipe }, { token: i0.ApplicationRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatDialogDrawerComponent, isStandalone: false, selector: "ng-component", inputs: { avatar: "avatar", userAvatar: "userAvatar", startingMessage: "startingMessage" }, host: { listeners: { "document:keypress": "handleKeyboardEvent($event)", "document:mousedown": "handleDocumentMouseDown($event)" } }, providers: [SellanChatMessageService, SellanChatHighlighterPipe], viewQueries: [{ propertyName: "searchMessage", first: true, predicate: ["searchMessage"], descendants: true }, { propertyName: "messageBox", first: true, predicate: ["messageBox"], descendants: true }, { propertyName: "bottom", first: true, predicate: ["bottom"], descendants: true }, { propertyName: "drawer", first: true, predicate: ["drawer"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<core-drawer #drawer [name]=\"name\" width=\"420\" [titleHeight]=\"80\" [footerHeight]=\"footerHeight\" (reachedTopRun)=\"onScroll($event)\" [goto]=\"goto\">\n  <div title class=\"sln-dialog-header\">\n    <button (click)=\"closeDrawChat()\" class=\"sln-drawer-close\">\n      x\n    </button>\n    @if (!search) {\n      <div class=\"sln-chat-title\">\n        <h4>{{ chat.name }}</h4>\n        <span> {{ chat?.statusRow }}</span>\n      </div>\n    }\n    <div [hidden]=\"!search\" class=\"sln-chat-search-message\">\n      <core-search-message #searchMessage [roomId]=\"roomId\" (searchGoTo)=\"onGoto($event)\"></core-search-message>\n    </div>\n    <core-chat-dialog-menu [chat]=\"chat\" (chatChanged)=\"setChat($event)\" (showSearch)=\"onSearchShow($event)\" (isChatClosedEvent)=\"closeChat($event)\"></core-chat-dialog-menu>\n  </div>\n  <div body>\n    @if (_chatMessageService.isLoading) {\n      <div>\n        <!--\u0441\u044E\u0434\u0430 \u043C\u043E\u0436\u043D\u043E \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C \u0441\u043F\u0438\u043D\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438?-->\n      </div>\n    }\n    <div #messageBox class=\"sellan-chat-box-main\">\n\n      <div class=\"sellan-chat-message-bottom\" #bottom></div>\n      @for (message of messages; track message; let i = $index) {  \n        <div class=\"sellan-chat-message sln-chat-fade-in\" \n          [class.sellan-chat-message-received]=\"message.type === 'received' && message.messageType !== 1\"\n          [class.sellan-chat-message-sent]=\"message.type === 'sent' && message.messageType !== 1\"\n          [class.sellan-chat-message-system]=\"message.messageType === 1\">\n\n          @switch (message.messageType) {\n            @case (1) {\n              <div class=\"sln-message-content\">\n                <div class=\"incoming-messages\">                         \n                    <div class=\"sellan-chat-incoming-message-system\">\n                      {{message.content}}\n                    </div>\n                </div>\n              </div>\n            }\n            @default {\n              <div class=\"sln-message-content\">\n               \n                <div class=\"incoming-messages\">\n                  @if (message.type === 'received') {\n                    <core-chat-avatar [fullName]=\"message.from\" [url]=\"chat.avatarLink\" [backColor]=\"chat.avatarColor\"\n                    class=\"sellan-chat-message-from-avatar\"></core-chat-avatar>\n                  }\n                  <div #chatMessage class=\"sellan-chat-message-text\" id=\"{{message.id.toString()}}\"\n                    [class.sellan-chat-message-text-search-found]=\"message.found\"\n                    [class.sellan-chat-message-text-received]=\"message.type === 'received'\"\n                    [class.sellan-chat-message-text-sent]=\"message.type === 'sent'\"\n                    (contextmenu)=\"open($event, message, chatMessage); $event.preventDefault();\">\n                    @if (message.type === 'received') {\n                      <span class=\"full-name\">{{message.from}}</span>\n                    }\n                    @if (message.parentMessageType === 0) {\n                      <div class=\"sellan-chat-answered-message\">\n                        <p class=\"sln-parentMessageUserName\">{{message.parentMessageUserName}}</p>\n                        <p [innerHTML]=\"message.parentMessageContent\"></p></div>\n                      }\n                      @if (message.parentMessageType === 1) {\n                        <div class=\"sellan-chat-answered-message\">\n                          <div style=\"display: flex;\">\n                            <div class=\"sln-chat-forward-message sln-chat-forward-message-position\">\n                              {{message.parentMessageUserName}}\n                            </div>\n                          </div>\n                          <p [innerHTML]=\"message.parentMessageContent\"></p>\n                        </div>\n                      }\n                      <div class=\"sellan-chat-incoming-message\"\n                        [innerHTML]=\"getHighlightedMessageContent(message)\">\n                      </div>\n                      @if (message.isAttachment) {\n                        <div class=\"sln-file-icon\">\n                          @if (!message.hasSignature && message.type === 'sent') {\n                            <span\n                              (click)=\"signFile(message.attachmentId)\">\n                              <div matTooltip=\"\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n                                <div class=\"sln-chat-document-sign-{{message.type === 'sent'? 'white':'blue'}} sln-chat-document-is-sign-position img-chat-sign\" ></div>\n                              </div>\n                            </span>\n                          }\n                          @if (message.hasSignature) {\n                            <span (click)=\"showSignFile(message.attachmentId)\">\n                              <div matTooltip=\"\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u043E\" matTooltipPosition=\"above\"  >\n                                <div class=\"sln-chat-document-is-signed-{{message.type === 'sent'? 'white':'blue'}} sln-chat-document-is-sign-position img-chat-sign\"></div>\n                              </div>\n                            </span>\n                          }\n                        </div>\n                      }\n                      <div class=\"sln-time\"><span>{{ message.timestamp | date: \"HH:mm\" }}</span></div>\n                      @if (message.type === 'sent') {\n                        <div>\n                          @if (message.history?.statusCode === 1) {\n                            <div class=\"sln-msg-status\">\n                              <div class=\"sln-chat-send sln-chat-status-position img-chat-send\"></div>\n                            </div>\n                          }\n                          @if (message.history?.statusCode === 2) {\n                            <div class=\"sln-msg-status\">\n                              @if (message.history?.users) {\n                                <div [core-tooltip]=\"tooltipWhoReadComponentType\" [contentData]=\"{ users: message.history?.users }\" [position]=\"'left'\" style=\"cursor: pointer;\"\n                                alt=\"is-read\" class=\"sln-chat-is-read sln-chat-status-position img-chat-is-read\"></div>\n                              }\n                              @if (!message.history?.users) {\n                                <div class=\"sln-chat-is-read sln-chat-status-position img-chat-is-read\"></div>\n                              }\n                            </div>\n                          }\n                          @if (message.history?.statusCode === 3) {\n                            <div class=\"sln-msg-status\">\n                              <div class=\"sln-chat-not-send sln-chat-status-position img-chat-not-send\"></div>\n                            </div>\n                          }\n                        </div>\n                      }\n                    </div>\n                  </div>\n              </div>\n            }\n          }\n        </div>\n        @if ((i === messages.length-1) || ((i < messages.length) && !dateEquals(messages[i+1].timestamp, message.timestamp))) {\n          <div class=\"sellan-chat-message-date\">\n            <span>{{ message.timestamp | date: \"dd.MM.yyyy\" }}</span>\n          </div>\n        }\n      }\n      </div>\n    </div>\n    <div footer>\n      <div class=\"sellan-chat-box-footer\">\n        <div class=\"sellan-chat-box-footer-input\">\n          @if (answerMsg !== null) {\n            <div class=\"sellan-chat-box-footer-answer-message-box\">\n              <div style=\"width: 99%; padding-right: 10px;\">\n                <core-label [text]=\"answerMsgContent\" [length]=\"30\" [hasButton]=\"false\"></core-label>\n              </div>\n              <button (click)=\"clearAnswerMessage()\" type=\"button\" class=\"sln-forwarded-message-close\"><span class=\"sln-forwarded-message-close__span\">X</span></button>\n            </div>\n          }\n          <div class=\"sln-input-message\">\n            <core-file-uploader [config]=\"uploadConfig\" class=\"chat-file-uploader\"></core-file-uploader>\n            <core-chat-input (send)=\"sendMessage($event)\" (focus)=\"(focus)\"></core-chat-input>\n          </div>\n        </div>\n      </div>\n    </div>\n  </core-drawer>", styles: [".sln-dialog-header{display:flex;align-items:center;border-bottom:2px solid var(--PRIMARY);justify-content:space-between;width:100%;padding:0 15px;min-height:60px}.sln-dialog-header .sln-chat-title{width:100%;font-size:20px;color:var(--DARK-GREY);display:flex;align-items:flex-start;justify-content:space-between;flex-direction:column}.sln-dialog-header .sln-chat-title span{font-size:14px;color:var(--WARNING);font-family:var(--font-medium);width:100%;max-height:27px;overflow:auto;margin-top:-3px}.sln-chat-search-message{width:100%}core-chat-input{width:93%}.incoming-messages{display:flex}.img-chat-sign{cursor:pointer}.img-chat-not-send{position:absolute;right:12px;bottom:6px;width:14px;height:14px}.img-chat-is-read,.img-chat-not-send,.img-chat-waiting,.img-chat-send{position:absolute;right:8px;bottom:6px}.sellan-wrapper{position:absolute;top:0;bottom:0;height:auto;width:100vw}.sellan-chat-button{z-index:1;width:60px;height:60px;position:absolute;bottom:35px;right:10px;box-shadow:0 5px 40px #00000029;background:#fff;border-radius:50%;border:none;outline:none;color:#fff;font-size:32px}.sellan-chat-button-header{z-index:1;font-weight:700;color:#fff;border:1px solid #fff;background-color:inherit;padding:5px 9px;margin-left:5px}.sellan-chat-button:focus{border:2px solid white}.sellan-chat-box{z-index:2;position:absolute;left:0;height:100vh;width:100vw;margin:0;display:flex;flex-direction:column;box-shadow:0 5px 40px #00000029;background:#fff}.sellan-chat{z-index:2;left:0;height:calc(100vh - 100px);margin:0;display:flex;flex-direction:column;background:#fff;height:85vh;border-top:1px solid var(--DEFAULT);border-right:1px solid var(--DEFAULT);border-bottom:1px solid var(--DEFAULT);border-radius:0 4px 4px 0}.sellan-chat-box-hidden{display:none}.sellan-chat-box-header{padding:10px 20px;color:#5d6275}.sellan-chat-box-header .box-header__name{background:var(--ADD-COLOR-2);padding:15px;border-radius:10px}.sellan-chat-box-main{display:flex;flex-direction:column-reverse}.sellan-chat-box-footer-input{display:flex;color:#5d6275;border-radius:4px;width:100%;margin:0 auto;box-sizing:border-box;justify-content:space-between;align-items:center;flex-direction:column}.sln-forwarded-message-close{outline:none;border:none;cursor:pointer;font-weight:600;font-size:18px;color:var(--DARK-GREY);background:none}.sln-forwarded-message-close:hover .sln-forwarded-message-close__span{color:var(--DARK-GREY)}.sellan-chat-input-text{margin:0;min-height:25px;max-height:90px;outline:none;border:none;background:var(--WHITE);padding:3px 15px}.sellan-operator-name h3{margin:0;padding:1px 0;color:var(--DARK-GREY);font-family:var(--font-bold)}.sellan-operator-name p{margin:0}.sellan-operator-status{float:right;padding:4px}.sellan-operator-status span{margin-left:4px}.sellan-operator-status-online{color:var(--SUCCESS)}.sellan-operator-status-offline{color:VAR(--DANGER)}.sellan-operator-avatar{height:30px;width:30px;border-radius:50%;float:left;margin-right:10px}.sellan-chat-message{display:block;width:auto;margin:0 30px 5px 5px;flex-direction:row;min-width:15%;max-width:75%;word-wrap:break-word;color:var(--DARK-GREY)}.sellan-chat-message-system{align-self:center;min-width:auto;max-width:90%;margin:2px auto}.sellan-chat-incoming-message-system{display:inline-flex;align-items:center;justify-content:center;width:fit-content;max-width:100%;margin:0 auto 8px;padding:0 12px;border-radius:14px;background:#5d62751f;color:var(--DARK-GREY);font-size:12px;line-height:1.35;text-align:center;word-break:break-word;box-shadow:0 1px 2px #00000014;backdrop-filter:blur(1px)}.sln-message-content{margin-left:8px}.sellan-chat-message-date{margin:0 30px;font-size:11px;color:var(--GRAY-SOFT);padding:5px;overflow:hidden;text-align:center}.sellan-chat-message-date span{display:inline-block;vertical-align:middle}.sln-operator{display:flex;justify-content:space-between;width:99%}.sln-operator button{border:none;background:transparent;font-family:var(--font-bold);color:var(--DARK-GREY);font-size:17px;cursor:pointer}.sellan-chat-message-date:after,.sellan-chat-message-date:before{content:\"\";display:inline-block;vertical-align:middle;width:100%;height:1px;background-color:var(--DARK-GREY);position:relative;opacity:.1}.sellan-chat-message-date:before{margin-left:-100%;left:-10px}.sellan-chat-message-date:after{margin-right:-100%;right:-10px}.sellan-chat-message-from-avatar{height:35px;width:35px;border-radius:50%;margin-right:20px;margin-top:5px}.sellan-chat-message-text{font-size:14px;text-align:left;word-break:break-word;padding:5px 10px 20px;border-radius:10px;position:relative;width:100%}.sellan-chat-message-text.sellan-chat-message-text-received{background-color:var(--WHITE);color:var(--DARK-GREY);width:100%}.sellan-chat-message-text.sellan-chat-message-text-received .sln-time{color:#868ea6;opacity:.5;font-size:11px;text-align:right;position:absolute;right:10px}.sellan-chat-message-text.sellan-chat-message-text-received .full-name{font-size:14px;width:90%;display:block}.sellan-chat-message-text.sellan-chat-message-text-received .sln-file-icon{position:absolute;top:8px;right:8px}.sellan-chat-message-text.sellan-chat-message-text-sent{width:100%}.sellan-chat-message-text.sellan-chat-message-text-sent .sln-file-icon{position:absolute}.sellan-chat-message-text.sellan-chat-message-text-sent .sln-time{opacity:.5;font-size:11px;text-align:right;position:absolute;bottom:6px}.sellan-chat-message-text.sellan-chat-message-text-system{width:auto;max-width:100%;margin:0 auto;text-align:center!important;padding:8px 12px;border-radius:12px;background:#5d62752e;color:var(--DARK-GREY)}.sellan-chat-message-text.sellan-chat-message-text-system .sln-time{position:static;margin-top:4px;text-align:center;opacity:.65;font-size:11px}::ng-deep .highlighted-text{background-color:#ff0;color:var(--DARK-GREY)}::ng-deep .highlighted-text-current{background-color:var(--WARNING)}.sellan-chat-message-received .chat-message-text{background:#b9d6f2;margin-left:50px;border-bottom-left-radius:0}.sellan-chat-message-received .chat-message-text:before{position:absolute;content:\" \";left:-10px;bottom:0;border-right:solid 10px #b9d6f2;border-top:solid 10px transparent;z-index:0}.sellan-chat-message-received .chat-message-date{margin-left:50px}.sellan-chat-message-received .chat-message-from-avatar{position:absolute;left:0;bottom:-15px}.sellan-chat-message-sent{align-self:flex-end;color:#1976d2}.sellan-chat-message-sent .chat-message-from{float:right}.sellan-chat-message-sent .chat-message-text{background:#84dccf;margin-right:50px;border-bottom-right-radius:0}.sellan-chat-message-sent .chat-message-text:after{position:absolute;content:\" \";right:-10px;bottom:0;border-left:solid 10px #84dccf;border-top:solid 10px transparent;z-index:0}.sellan-chat-message-sent .chat-message-date{text-align:right;padding-right:50px}.sellan-chat-message-sent .chat-message-from-avatar{position:absolute;right:0;bottom:-15px}.blue .sellan-chat-button,.blue .sellan-chat-box{background:#1976d2}.grey .sellan-chat-button,.grey .sellan-chat-box{background:#454549}.red .sellan-chat-button,.red .sellan-chat-box{background:#dd0031}::ng-deep .sellan-chat-message .sellan-avatar{height:30px!important;width:30px!important;cursor:auto}@media(min-width:576px){.sellan-wrapper{top:auto;right:0;width:350px}.sellan-chat-button{display:block}.sellan-chat-button-header{display:none}.sellan-chat-box{inset:auto 40px 100px auto;height:60vh;width:23vw}}@media(max-width:576px){.sellan-chat-box{height:75vh;width:76vw;margin:0;bottom:20%}}.sln-input-message{display:flex;color:#5d6275;margin:5px auto 10px;box-sizing:border-box;justify-content:space-between;align-items:center;width:100%;padding:0 15px}.sellan-chat-box-footer-answer-message-box{display:flex;justify-content:space-between;align-items:center;width:94%;margin-top:5px;padding:0;height:100%;color:var(--MIDLE-GRAY)}.sellan-chat-box-footer-answer-message-box:hover:before{background:var(--GRAY-SOFT)}.sellan-chat-answered-message{font-size:13px;padding-left:10px;margin-top:5px}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}\n"], dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreLabelComponent, selector: "core-label", inputs: ["text", "length", "hasButton"] }, { kind: "component", type: CoreFileUploaderComponent, selector: "core-file-uploader", inputs: ["config", "needUpload", "elementId", "anonymAccessItemId"], outputs: ["valueChange", "autogenerateClick", "filesLoaded"] }, { kind: "component", type: CoreChatAvatarComponent, selector: "core-chat-avatar", inputs: ["useInChat", "url", "backColor", "fullName", "newMsg", "newMsgMode"] }, { kind: "component", type: SellanChatInputComponent, selector: "core-chat-input", inputs: ["buttonText", "disabled", "focus"], outputs: ["send", "dismiss"] }, { kind: "component", type: SellanChatSearchMessageComponent, selector: "core-search-message", inputs: ["roomId", "buttonText", "disabled", "focus"], outputs: ["send", "dismiss", "searchGoTo"] }, { kind: "component", type: CoreDrawerComponent, selector: "core-drawer", inputs: ["name", "titleHeight", "footerHeight", "dialogTitle", "width", "minWidth", "hasTitle", "hasFooter", "goto"], outputs: ["reachedTopRun", "reachedBottomRun"] }, { kind: "directive", type: CoreTooltipDirective, selector: "[core-tooltip]", inputs: ["core-tooltip", "contentData", "position", "offset", "hidden"] }, { kind: "component", type: CoreChatDialogMenuComponent, selector: "core-chat-dialog-menu", inputs: ["chat"], outputs: ["chatChanged", "showSearch"] }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatDialogDrawerComponent, decorators: [{
            type: Component,
            args: [{ providers: [SellanChatMessageService, SellanChatHighlighterPipe], standalone: false, template: "<core-drawer #drawer [name]=\"name\" width=\"420\" [titleHeight]=\"80\" [footerHeight]=\"footerHeight\" (reachedTopRun)=\"onScroll($event)\" [goto]=\"goto\">\n  <div title class=\"sln-dialog-header\">\n    <button (click)=\"closeDrawChat()\" class=\"sln-drawer-close\">\n      x\n    </button>\n    @if (!search) {\n      <div class=\"sln-chat-title\">\n        <h4>{{ chat.name }}</h4>\n        <span> {{ chat?.statusRow }}</span>\n      </div>\n    }\n    <div [hidden]=\"!search\" class=\"sln-chat-search-message\">\n      <core-search-message #searchMessage [roomId]=\"roomId\" (searchGoTo)=\"onGoto($event)\"></core-search-message>\n    </div>\n    <core-chat-dialog-menu [chat]=\"chat\" (chatChanged)=\"setChat($event)\" (showSearch)=\"onSearchShow($event)\" (isChatClosedEvent)=\"closeChat($event)\"></core-chat-dialog-menu>\n  </div>\n  <div body>\n    @if (_chatMessageService.isLoading) {\n      <div>\n        <!--\u0441\u044E\u0434\u0430 \u043C\u043E\u0436\u043D\u043E \u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C \u0441\u043F\u0438\u043D\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438?-->\n      </div>\n    }\n    <div #messageBox class=\"sellan-chat-box-main\">\n\n      <div class=\"sellan-chat-message-bottom\" #bottom></div>\n      @for (message of messages; track message; let i = $index) {  \n        <div class=\"sellan-chat-message sln-chat-fade-in\" \n          [class.sellan-chat-message-received]=\"message.type === 'received' && message.messageType !== 1\"\n          [class.sellan-chat-message-sent]=\"message.type === 'sent' && message.messageType !== 1\"\n          [class.sellan-chat-message-system]=\"message.messageType === 1\">\n\n          @switch (message.messageType) {\n            @case (1) {\n              <div class=\"sln-message-content\">\n                <div class=\"incoming-messages\">                         \n                    <div class=\"sellan-chat-incoming-message-system\">\n                      {{message.content}}\n                    </div>\n                </div>\n              </div>\n            }\n            @default {\n              <div class=\"sln-message-content\">\n               \n                <div class=\"incoming-messages\">\n                  @if (message.type === 'received') {\n                    <core-chat-avatar [fullName]=\"message.from\" [url]=\"chat.avatarLink\" [backColor]=\"chat.avatarColor\"\n                    class=\"sellan-chat-message-from-avatar\"></core-chat-avatar>\n                  }\n                  <div #chatMessage class=\"sellan-chat-message-text\" id=\"{{message.id.toString()}}\"\n                    [class.sellan-chat-message-text-search-found]=\"message.found\"\n                    [class.sellan-chat-message-text-received]=\"message.type === 'received'\"\n                    [class.sellan-chat-message-text-sent]=\"message.type === 'sent'\"\n                    (contextmenu)=\"open($event, message, chatMessage); $event.preventDefault();\">\n                    @if (message.type === 'received') {\n                      <span class=\"full-name\">{{message.from}}</span>\n                    }\n                    @if (message.parentMessageType === 0) {\n                      <div class=\"sellan-chat-answered-message\">\n                        <p class=\"sln-parentMessageUserName\">{{message.parentMessageUserName}}</p>\n                        <p [innerHTML]=\"message.parentMessageContent\"></p></div>\n                      }\n                      @if (message.parentMessageType === 1) {\n                        <div class=\"sellan-chat-answered-message\">\n                          <div style=\"display: flex;\">\n                            <div class=\"sln-chat-forward-message sln-chat-forward-message-position\">\n                              {{message.parentMessageUserName}}\n                            </div>\n                          </div>\n                          <p [innerHTML]=\"message.parentMessageContent\"></p>\n                        </div>\n                      }\n                      <div class=\"sellan-chat-incoming-message\"\n                        [innerHTML]=\"getHighlightedMessageContent(message)\">\n                      </div>\n                      @if (message.isAttachment) {\n                        <div class=\"sln-file-icon\">\n                          @if (!message.hasSignature && message.type === 'sent') {\n                            <span\n                              (click)=\"signFile(message.attachmentId)\">\n                              <div matTooltip=\"\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n                                <div class=\"sln-chat-document-sign-{{message.type === 'sent'? 'white':'blue'}} sln-chat-document-is-sign-position img-chat-sign\" ></div>\n                              </div>\n                            </span>\n                          }\n                          @if (message.hasSignature) {\n                            <span (click)=\"showSignFile(message.attachmentId)\">\n                              <div matTooltip=\"\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u043E\" matTooltipPosition=\"above\"  >\n                                <div class=\"sln-chat-document-is-signed-{{message.type === 'sent'? 'white':'blue'}} sln-chat-document-is-sign-position img-chat-sign\"></div>\n                              </div>\n                            </span>\n                          }\n                        </div>\n                      }\n                      <div class=\"sln-time\"><span>{{ message.timestamp | date: \"HH:mm\" }}</span></div>\n                      @if (message.type === 'sent') {\n                        <div>\n                          @if (message.history?.statusCode === 1) {\n                            <div class=\"sln-msg-status\">\n                              <div class=\"sln-chat-send sln-chat-status-position img-chat-send\"></div>\n                            </div>\n                          }\n                          @if (message.history?.statusCode === 2) {\n                            <div class=\"sln-msg-status\">\n                              @if (message.history?.users) {\n                                <div [core-tooltip]=\"tooltipWhoReadComponentType\" [contentData]=\"{ users: message.history?.users }\" [position]=\"'left'\" style=\"cursor: pointer;\"\n                                alt=\"is-read\" class=\"sln-chat-is-read sln-chat-status-position img-chat-is-read\"></div>\n                              }\n                              @if (!message.history?.users) {\n                                <div class=\"sln-chat-is-read sln-chat-status-position img-chat-is-read\"></div>\n                              }\n                            </div>\n                          }\n                          @if (message.history?.statusCode === 3) {\n                            <div class=\"sln-msg-status\">\n                              <div class=\"sln-chat-not-send sln-chat-status-position img-chat-not-send\"></div>\n                            </div>\n                          }\n                        </div>\n                      }\n                    </div>\n                  </div>\n              </div>\n            }\n          }\n        </div>\n        @if ((i === messages.length-1) || ((i < messages.length) && !dateEquals(messages[i+1].timestamp, message.timestamp))) {\n          <div class=\"sellan-chat-message-date\">\n            <span>{{ message.timestamp | date: \"dd.MM.yyyy\" }}</span>\n          </div>\n        }\n      }\n      </div>\n    </div>\n    <div footer>\n      <div class=\"sellan-chat-box-footer\">\n        <div class=\"sellan-chat-box-footer-input\">\n          @if (answerMsg !== null) {\n            <div class=\"sellan-chat-box-footer-answer-message-box\">\n              <div style=\"width: 99%; padding-right: 10px;\">\n                <core-label [text]=\"answerMsgContent\" [length]=\"30\" [hasButton]=\"false\"></core-label>\n              </div>\n              <button (click)=\"clearAnswerMessage()\" type=\"button\" class=\"sln-forwarded-message-close\"><span class=\"sln-forwarded-message-close__span\">X</span></button>\n            </div>\n          }\n          <div class=\"sln-input-message\">\n            <core-file-uploader [config]=\"uploadConfig\" class=\"chat-file-uploader\"></core-file-uploader>\n            <core-chat-input (send)=\"sendMessage($event)\" (focus)=\"(focus)\"></core-chat-input>\n          </div>\n        </div>\n      </div>\n    </div>\n  </core-drawer>", styles: [".sln-dialog-header{display:flex;align-items:center;border-bottom:2px solid var(--PRIMARY);justify-content:space-between;width:100%;padding:0 15px;min-height:60px}.sln-dialog-header .sln-chat-title{width:100%;font-size:20px;color:var(--DARK-GREY);display:flex;align-items:flex-start;justify-content:space-between;flex-direction:column}.sln-dialog-header .sln-chat-title span{font-size:14px;color:var(--WARNING);font-family:var(--font-medium);width:100%;max-height:27px;overflow:auto;margin-top:-3px}.sln-chat-search-message{width:100%}core-chat-input{width:93%}.incoming-messages{display:flex}.img-chat-sign{cursor:pointer}.img-chat-not-send{position:absolute;right:12px;bottom:6px;width:14px;height:14px}.img-chat-is-read,.img-chat-not-send,.img-chat-waiting,.img-chat-send{position:absolute;right:8px;bottom:6px}.sellan-wrapper{position:absolute;top:0;bottom:0;height:auto;width:100vw}.sellan-chat-button{z-index:1;width:60px;height:60px;position:absolute;bottom:35px;right:10px;box-shadow:0 5px 40px #00000029;background:#fff;border-radius:50%;border:none;outline:none;color:#fff;font-size:32px}.sellan-chat-button-header{z-index:1;font-weight:700;color:#fff;border:1px solid #fff;background-color:inherit;padding:5px 9px;margin-left:5px}.sellan-chat-button:focus{border:2px solid white}.sellan-chat-box{z-index:2;position:absolute;left:0;height:100vh;width:100vw;margin:0;display:flex;flex-direction:column;box-shadow:0 5px 40px #00000029;background:#fff}.sellan-chat{z-index:2;left:0;height:calc(100vh - 100px);margin:0;display:flex;flex-direction:column;background:#fff;height:85vh;border-top:1px solid var(--DEFAULT);border-right:1px solid var(--DEFAULT);border-bottom:1px solid var(--DEFAULT);border-radius:0 4px 4px 0}.sellan-chat-box-hidden{display:none}.sellan-chat-box-header{padding:10px 20px;color:#5d6275}.sellan-chat-box-header .box-header__name{background:var(--ADD-COLOR-2);padding:15px;border-radius:10px}.sellan-chat-box-main{display:flex;flex-direction:column-reverse}.sellan-chat-box-footer-input{display:flex;color:#5d6275;border-radius:4px;width:100%;margin:0 auto;box-sizing:border-box;justify-content:space-between;align-items:center;flex-direction:column}.sln-forwarded-message-close{outline:none;border:none;cursor:pointer;font-weight:600;font-size:18px;color:var(--DARK-GREY);background:none}.sln-forwarded-message-close:hover .sln-forwarded-message-close__span{color:var(--DARK-GREY)}.sellan-chat-input-text{margin:0;min-height:25px;max-height:90px;outline:none;border:none;background:var(--WHITE);padding:3px 15px}.sellan-operator-name h3{margin:0;padding:1px 0;color:var(--DARK-GREY);font-family:var(--font-bold)}.sellan-operator-name p{margin:0}.sellan-operator-status{float:right;padding:4px}.sellan-operator-status span{margin-left:4px}.sellan-operator-status-online{color:var(--SUCCESS)}.sellan-operator-status-offline{color:VAR(--DANGER)}.sellan-operator-avatar{height:30px;width:30px;border-radius:50%;float:left;margin-right:10px}.sellan-chat-message{display:block;width:auto;margin:0 30px 5px 5px;flex-direction:row;min-width:15%;max-width:75%;word-wrap:break-word;color:var(--DARK-GREY)}.sellan-chat-message-system{align-self:center;min-width:auto;max-width:90%;margin:2px auto}.sellan-chat-incoming-message-system{display:inline-flex;align-items:center;justify-content:center;width:fit-content;max-width:100%;margin:0 auto 8px;padding:0 12px;border-radius:14px;background:#5d62751f;color:var(--DARK-GREY);font-size:12px;line-height:1.35;text-align:center;word-break:break-word;box-shadow:0 1px 2px #00000014;backdrop-filter:blur(1px)}.sln-message-content{margin-left:8px}.sellan-chat-message-date{margin:0 30px;font-size:11px;color:var(--GRAY-SOFT);padding:5px;overflow:hidden;text-align:center}.sellan-chat-message-date span{display:inline-block;vertical-align:middle}.sln-operator{display:flex;justify-content:space-between;width:99%}.sln-operator button{border:none;background:transparent;font-family:var(--font-bold);color:var(--DARK-GREY);font-size:17px;cursor:pointer}.sellan-chat-message-date:after,.sellan-chat-message-date:before{content:\"\";display:inline-block;vertical-align:middle;width:100%;height:1px;background-color:var(--DARK-GREY);position:relative;opacity:.1}.sellan-chat-message-date:before{margin-left:-100%;left:-10px}.sellan-chat-message-date:after{margin-right:-100%;right:-10px}.sellan-chat-message-from-avatar{height:35px;width:35px;border-radius:50%;margin-right:20px;margin-top:5px}.sellan-chat-message-text{font-size:14px;text-align:left;word-break:break-word;padding:5px 10px 20px;border-radius:10px;position:relative;width:100%}.sellan-chat-message-text.sellan-chat-message-text-received{background-color:var(--WHITE);color:var(--DARK-GREY);width:100%}.sellan-chat-message-text.sellan-chat-message-text-received .sln-time{color:#868ea6;opacity:.5;font-size:11px;text-align:right;position:absolute;right:10px}.sellan-chat-message-text.sellan-chat-message-text-received .full-name{font-size:14px;width:90%;display:block}.sellan-chat-message-text.sellan-chat-message-text-received .sln-file-icon{position:absolute;top:8px;right:8px}.sellan-chat-message-text.sellan-chat-message-text-sent{width:100%}.sellan-chat-message-text.sellan-chat-message-text-sent .sln-file-icon{position:absolute}.sellan-chat-message-text.sellan-chat-message-text-sent .sln-time{opacity:.5;font-size:11px;text-align:right;position:absolute;bottom:6px}.sellan-chat-message-text.sellan-chat-message-text-system{width:auto;max-width:100%;margin:0 auto;text-align:center!important;padding:8px 12px;border-radius:12px;background:#5d62752e;color:var(--DARK-GREY)}.sellan-chat-message-text.sellan-chat-message-text-system .sln-time{position:static;margin-top:4px;text-align:center;opacity:.65;font-size:11px}::ng-deep .highlighted-text{background-color:#ff0;color:var(--DARK-GREY)}::ng-deep .highlighted-text-current{background-color:var(--WARNING)}.sellan-chat-message-received .chat-message-text{background:#b9d6f2;margin-left:50px;border-bottom-left-radius:0}.sellan-chat-message-received .chat-message-text:before{position:absolute;content:\" \";left:-10px;bottom:0;border-right:solid 10px #b9d6f2;border-top:solid 10px transparent;z-index:0}.sellan-chat-message-received .chat-message-date{margin-left:50px}.sellan-chat-message-received .chat-message-from-avatar{position:absolute;left:0;bottom:-15px}.sellan-chat-message-sent{align-self:flex-end;color:#1976d2}.sellan-chat-message-sent .chat-message-from{float:right}.sellan-chat-message-sent .chat-message-text{background:#84dccf;margin-right:50px;border-bottom-right-radius:0}.sellan-chat-message-sent .chat-message-text:after{position:absolute;content:\" \";right:-10px;bottom:0;border-left:solid 10px #84dccf;border-top:solid 10px transparent;z-index:0}.sellan-chat-message-sent .chat-message-date{text-align:right;padding-right:50px}.sellan-chat-message-sent .chat-message-from-avatar{position:absolute;right:0;bottom:-15px}.blue .sellan-chat-button,.blue .sellan-chat-box{background:#1976d2}.grey .sellan-chat-button,.grey .sellan-chat-box{background:#454549}.red .sellan-chat-button,.red .sellan-chat-box{background:#dd0031}::ng-deep .sellan-chat-message .sellan-avatar{height:30px!important;width:30px!important;cursor:auto}@media(min-width:576px){.sellan-wrapper{top:auto;right:0;width:350px}.sellan-chat-button{display:block}.sellan-chat-button-header{display:none}.sellan-chat-box{inset:auto 40px 100px auto;height:60vh;width:23vw}}@media(max-width:576px){.sellan-chat-box{height:75vh;width:76vw;margin:0;bottom:20%}}.sln-input-message{display:flex;color:#5d6275;margin:5px auto 10px;box-sizing:border-box;justify-content:space-between;align-items:center;width:100%;padding:0 15px}.sellan-chat-box-footer-answer-message-box{display:flex;justify-content:space-between;align-items:center;width:94%;margin-top:5px;padding:0;height:100%;color:var(--MIDLE-GRAY)}.sellan-chat-box-footer-answer-message-box:hover:before{background:var(--GRAY-SOFT)}.sellan-chat-answered-message{font-size:13px;padding-left:10px;margin-top:5px}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}\n"] }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [CORE_DRAWER_DATA_TOKEN_KEY]
                }] }, { type: DrawerService }, { type: i1$8.MatDialog }, { type: CryptoSignService }, { type: PopupResults }, { type: SellanChatMessageService }, { type: SellanChatUsersService }, { type: SignalRService }, { type: SellanChatNotificationService }, { type: i1$4.Overlay }, { type: i0.ViewContainerRef }, { type: SellanChatHighlighterPipe }, { type: i0.ApplicationRef }, { type: i0.Injector }], propDecorators: { searchMessage: [{
                type: ViewChild,
                args: ['searchMessage']
            }], messageBox: [{
                type: ViewChild,
                args: ['messageBox']
            }], bottom: [{
                type: ViewChild,
                args: ['bottom']
            }], drawer: [{
                type: ViewChild,
                args: ['drawer']
            }], avatar: [{
                type: Input
            }], userAvatar: [{
                type: Input
            }], startingMessage: [{
                type: Input
            }], handleKeyboardEvent: [{
                type: HostListener,
                args: ['document:keypress', ['$event']]
            }], handleDocumentMouseDown: [{
                type: HostListener,
                args: ['document:mousedown', ['$event']]
            }] } });

class CoreUserSettingsService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    removeUserSettings(key, subKey) {
        const query = subKey ? '?subKey=' + subKey : '';
        const url = this._startUp.apiRoot('users/usersettings/' + key + query);
        return this._ajaxM.delete({ url: url });
    }
    setUserSettings(userSettings) {
        const url = this._startUp.apiRoot('users/usersettings/');
        return this._ajaxM.post({ url: url, data: userSettings });
    }
    getUserSettings(userId, organizationId, key) {
        let url = this._startUp.apiRoot('users/usersettings/' + userId + '/' + key + (Utility.isEmpty(organizationId) ? '' : ('?organizationId=' + organizationId)), 'core');
        return this._ajaxM.get({ url: url });
    }
    setAdditionalUserSettings(userSettings) {
        return this.getUserSettings(userSettings.userId, userSettings.organizationId, userSettings.key).pipe(map(z => {
            if (!!z.entity) {
                let checkEntity = JSON.parse(z.entity.value);
                Object.keys(userSettings.value).forEach(key => checkEntity = this.removePropFromObject(checkEntity, key));
                userSettings.value = { ...checkEntity, ...userSettings.value };
                return this.setUserSettings(userSettings).subscribe();
            }
            return this.setUserSettings(userSettings).subscribe();
        }));
    }
    setWidgetUserSettings(userSettings, addIfNotExists) {
        return this.getUserSettings(userSettings.userId, userSettings.organizationId, userSettings.key).pipe(map(z => {
            if (!!z.entity) {
                let checkEntity = JSON.parse(z.entity.value);
                if (checkEntity.filter(z => z.componentKey == userSettings.value.componentKey).length === 0 && addIfNotExists) {
                    checkEntity.push({
                        isEnabled: userSettings.value.isEnabled,
                        componentKey: userSettings.value.componentKey
                    });
                }
                checkEntity.filter(z => z.componentKey == userSettings.value.componentKey)[0].isEnabled = userSettings.value.isEnabled;
                userSettings.value = checkEntity;
                return this.setUserSettings(userSettings).subscribe();
            }
            userSettings.value = [userSettings.value];
            return this.setUserSettings(userSettings).subscribe();
        }));
    }
    removePropFromObject(obj, prop) {
        const { [prop]: _, ...rest } = obj;
        return { ...rest };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUserSettingsService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUserSettingsService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreUserSettingsService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class UserAdditionalSettingsDto {
    static { this.MENU_SETTINGS_KEY = 'MENU_SETTINGS'; }
    static { this.USER_WIDGET_SETTINGS_KEY = 'USER_WIDGET_SETTINGS'; }
    constructor(userId, organizationId, value, key) {
        this.userId = userId;
        this.organizationId = organizationId;
        this.key = key;
        this.value = value;
    }
}
class UserMenuSettings {
    constructor() {
        this.isCollapse = true;
        this.isFull = true;
        this.isViewTooltips = true;
        this.items = [];
    }
}
class UserMenuSettingsItem {
}

class CoreChatWidgetBalloonsComponent extends CoreBaseDestroyComponent {
    constructor(usersService, _notificationService, _drawer, _cd, _extendNotif, _сoreUserSettingsService) {
        super();
        this.usersService = usersService;
        this._notificationService = _notificationService;
        this._drawer = _drawer;
        this._cd = _cd;
        this._extendNotif = _extendNotif;
        this._сoreUserSettingsService = _сoreUserSettingsService;
        this.botName = 'Bot';
        this.botAvatar = ``;
        this.userAvatar = ``;
        this.opened = true;
        this.hide = false;
        this.hideUsers = false;
        this.addSettingKey = 'HIDE_USERS_ON_WIDGET_CHAT';
        this._visible = false;
        this.lastSavedHideUsers = null;
        this.focus = new Subject();
        this._maxDialogCount = 5;
    }
    get visible() {
        return this._visible;
    }
    set visible(visible) {
        this._visible = visible;
        if (this._visible) {
            setTimeout(() => { }, 0);
        }
    }
    scrollToBottom() {
        if (this.bottom !== undefined) {
            this.bottom.nativeElement.scrollIntoView();
        }
    }
    ngOnInit() {
        if (this.opened) {
            setTimeout(() => this.visible = true, 1000);
        }
        this._loadRooms();
        this._notificationService.isNotify.pipe(this.takeUntilDestroyed()).subscribe(z => {
            if (this.usersService.chatUser.id != z.userId) {
                if (!!this.rooms) {
                    const chat = this.rooms.filter(x => x.id == z.roomId)[0];
                    if (chat) {
                        chat.newMessage = true;
                    }
                }
                if (this.hide) {
                    this.hide = false;
                }
                this._extendNotif.setHaveNewChatMessage(true);
            }
            if (!!this.rooms) {
                this.rooms = this.rooms.sort((x, y) => (x.newMessage === y.newMessage) ? 0 : x.newMessage ? 1 : -1);
            }
            this._cd.detectChanges();
        });
    }
    openChat(chat) {
        chat.newMessage = false;
        this._drawer.show(CoreChatDialogDrawerComponent, { name: DrawerNames.DIALOG, data: chat });
    }
    hideUsersChat() {
        const newValue = !this.hideUsers;
        if (newValue !== this.lastSavedHideUsers) {
            this.hideUsers = newValue;
            this.saveState();
            this.lastSavedHideUsers = newValue;
        }
    }
    saveState() {
        localStorage.setItem(this.addSettingKey, JSON.stringify({ hideUsers: this.hideUsers }));
        this._сoreUserSettingsService
            .setAdditionalUserSettings(new UserAdditionalSettingsDto(this.usersService.chatUser.userId, null, { hideUsers: this.hideUsers }, this.addSettingKey))
            .pipe(this.takeUntilDestroyed())
            .subscribe();
    }
    // прочитать локальное значение hideUsers из localStorage
    _getCachedHideUsers() {
        const local = localStorage.getItem(this.addSettingKey);
        if (!local)
            return null;
        try {
            const parsed = JSON.parse(local);
            return parsed?.hideUsers ?? null;
        }
        catch {
            return null;
        }
    }
    // Сохранить локальное значение hideUsers в localStorage
    _cacheHideUsers(value) {
        localStorage.setItem(this.addSettingKey, JSON.stringify({ hideUsers: this.hideUsers }));
    }
    _loadRooms(callback) {
        this.usersService
            .getUserChats()
            .pipe(this.takeUntilDestroyed())
            .subscribe(z => {
            this.rooms = z.entity.sort((x, y) => (x.newMessage === y.newMessage) ? 0 : x.newMessage ? -1 : 1);
            if (this.rooms.length > this._maxDialogCount) {
                this.rooms.length = this._maxDialogCount;
            }
            // обратная сортировка, что бы новые сообщения всплывали вверх
            this.rooms = this.rooms.sort((x, y) => (x.newMessage === y.newMessage) ? 0 : x.newMessage ? 1 : -1)
                .sort((x, y) => (x.lastMessageDate === y.lastMessageDate) ? 1 : -1);
            if (callback) {
                callback();
            }
            this.hide = this.rooms.filter(x => x.newMessage === true).length === 0;
            if (this.usersService.chatUser) {
                const cached = this._getCachedHideUsers();
                if (cached !== null) {
                    // Если значение уже есть в localStorage — используем его
                    this.hideUsers = cached;
                    this.lastSavedHideUsers = cached;
                }
                else {
                    this._сoreUserSettingsService
                        .getUserSettings(this.usersService.chatUser.userId, null, this.addSettingKey)
                        .pipe(this.takeUntilDestroyed(), map(z => {
                        const value = z.entity && z.entity['value'] ? JSON.parse(z.entity['value']).hideUsers : false;
                        this.hideUsers = value;
                        this.lastSavedHideUsers = value;
                        this._cacheHideUsers(value);
                    }))
                        .subscribe();
                }
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatWidgetBalloonsComponent, deps: [{ token: SellanChatUsersService }, { token: SellanChatNotificationService }, { token: DrawerService }, { token: i0.ChangeDetectorRef }, { token: PageService }, { token: CoreUserSettingsService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatWidgetBalloonsComponent, isStandalone: false, selector: "core-widget-balloons", inputs: { botName: "botName", botAvatar: "botAvatar", userAvatar: "userAvatar", opened: "opened", hide: "hide", visible: "visible" }, viewQueries: [{ propertyName: "bottom", first: true, predicate: ["bottom"], descendants: true }], usesInheritance: true, ngImport: i0, template: "@if (!hide) {\n  <div class=\"sellan-wrapper\">\n    <div class=\"sln-widgets-balloons\">\n      @if (!hideUsers) {\n        <div class=\"sellan-chat-button\">\n          @for (chat of rooms; track chat) {\n            @if (chat.newMessage) {\n              <core-chat-avatar\n                [useInChat]=\"true\"\n                [url]=\"chat.avatarLink\"\n                [backColor]=\"chat.avatarColor\"\n                [fullName]=\"chat.name\"\n                [newMsg]=\"chat.newMessage\"\n                [newMsgMode]=\"'Circle'\"\n                class=\"core-chat-message-from-avatar\"\n              (click)=\"openChat(chat)\"></core-chat-avatar>\n            }\n          }\n          <span\n            class=\"sln-fade\"\n            [class.sln-fade-in]=\"visible\"\n            [class.sln-fade-out]=\"!visible\"\n          ></span>\n        </div>\n      }\n      <div class=\"sellan-button-view-chat\">\n        <div matTooltip=\"{{ !hideUsers ? '\u0421\u043A\u0440\u044B\u0442\u044C \u0447\u0430\u0442' : '\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0447\u0430\u0442'}}\" matTooltipPosition=\"before\" matTooltipClass=\"custom-tooltip-add-chat\" class=\"sln-pos-view\">\n          <div (click)=\"hideUsersChat()\" class=\"sln-button-veiw-chat\">\n            <div class=\"sln-control-{{ !hideUsers ? 'eye' : 'close-eye'}}\"></div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n}\n", styles: [".sellan-wrapper{display:flex;position:absolute;right:15px;bottom:30px;width:100px;z-index:2;align-items:flex-end;justify-content:flex-end}.sellan-chat-button{width:60px;height:60px;border-radius:50%;border:none;outline:none;color:#fff;font-size:32px;display:flex;flex-direction:column-reverse;margin-left:10px}.sln-widgets-balloons{display:flex;flex-direction:row-reverse;align-items:flex-end}.sellan-chat-button-header{z-index:1;font-weight:700;color:#fff;border:1px solid #fff;background-color:inherit;padding:5px 9px;margin-left:5px}.sellan-chat-button:focus{border:2px solid white}.sellan-chat-box{z-index:2;position:absolute;left:0;height:100vh;width:100vw;margin:0;display:flex;flex-direction:column;box-shadow:0 5px 40px #00000029;background:#1976d2}.sellan-chat-box-hidden{display:none}.sellan-chat-box-header{padding:10px;color:#fff}.sellan-chat-box-main{flex:1;width:99%;background:#fff;display:flex;flex-direction:column-reverse;overflow:auto}.sellan-chat-box-footer{color:#5d6275;min-height:7vh;border-radius:24px;width:97%;margin:10px auto;background:var(--ADD-COLOR-2);box-sizing:border-box;display:flex;justify-content:space-between;align-items:center}.sellan-operator-name{margin:0;padding:1px}.sellan-operator-status{float:right;padding:4px}.sellan-operator-status span{margin-left:4px}.sellan-operator-status-online{color:var(--SUCCESS)}.sellan-operator-status-offline{color:#ff2480}.sellan-operator-avatar{height:30px;width:30px;border-radius:50%;float:left;margin-right:10px}.sellan-chat-message{display:block;width:auto;margin:5px;align-self:flex-start;flex-direction:row;min-width:75%;max-width:75%;word-wrap:break-word}.sellan-chat-message-date{font-size:11px;color:var(--GRAY-SOFT);padding:5px}.sellan-button-add-chat{background:var(--WHITE);border-radius:50%}.sellan-button-add-chat>div{display:flex}.sellan-chat-message-from-avatar{border-radius:50%;background:#fff;margin-top:10px;box-shadow:0 1px 8px 2px var(--PRIMARY)}.sellan-chat-message-text{font-size:14px;margin-top:15px;text-align:left;color:#fff}a{color:#fff!important}.sellan-chat-message-received{margin-right:50px}.sellan-chat-message-received .chat-message-text{background:#b9d6f2;margin-left:50px;border-bottom-left-radius:0}.sellan-chat-message-received .chat-message-text:before{position:absolute;content:\" \";left:-10px;bottom:0;border-right:solid 10px #b9d6f2;border-top:solid 10px transparent;z-index:0}.sellan-chat-message-received .chat-message-date{margin-left:50px}.sellan-chat-message-received .chat-message-from-avatar{position:absolute;left:0;bottom:-15px}.sellan-chat-message-sent{align-self:flex-end}.sellan-chat-message-sent .chat-message-from{float:right}.sellan-chat-message-sent .chat-message-text{background:#84dccf;margin-right:50px;border-bottom-right-radius:0}.sellan-chat-message-sent .chat-message-text:after{position:absolute;content:\" \";right:-10px;bottom:0;border-left:solid 10px #84dccf;border-top:solid 10px transparent;z-index:0}.sellan-chat-message-sent .chat-message-date{text-align:right;padding-right:50px}.sellan-chat-message-sent .chat-message-from-avatar{position:absolute;right:0;bottom:-15px}.blue .sellan-chat-box{background:#1976d2}.grey .sellan-chat-button,.grey .sellan-chat-box{background:#454549}.red .sellan-chat-button,.red .sellan-chat-box{background:#dd0031}.sln-add-chat{width:60px;height:60px;cursor:pointer}@media(min-width:576px){.sellan-chat-button-header{display:none}.sellan-chat-box{inset:auto 40px 100px auto;height:60vh;width:23vw;border-radius:10px}}@media(min-width:768px){.sellan-chat-box{height:70vh}}@media(min-width:992px){.sellan-chat-box{height:80vh;z-index:3}}.sln-button-veiw-chat{z-index:2}.sln-pos-view,.sln-pos-noview{cursor:pointer;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:30px;background:#fff;line-height:0;border:2px solid var(--GRAY-SOFT)}.sln-fade{opacity:0}.sln-fade-in{animation:slnFadeIn .25s ease-out forwards}.sln-fade-out{animation:slnFadeOut .25s ease-in forwards}@keyframes slnFadeIn{0%{opacity:0}to{opacity:1}}@keyframes slnFadeOut{0%{opacity:1}to{opacity:0}}\n"], dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreChatAvatarComponent, selector: "core-chat-avatar", inputs: ["useInChat", "url", "backColor", "fullName", "newMsg", "newMsgMode"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatWidgetBalloonsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-widget-balloons', changeDetection: ChangeDetectionStrategy.Default, standalone: false, template: "@if (!hide) {\n  <div class=\"sellan-wrapper\">\n    <div class=\"sln-widgets-balloons\">\n      @if (!hideUsers) {\n        <div class=\"sellan-chat-button\">\n          @for (chat of rooms; track chat) {\n            @if (chat.newMessage) {\n              <core-chat-avatar\n                [useInChat]=\"true\"\n                [url]=\"chat.avatarLink\"\n                [backColor]=\"chat.avatarColor\"\n                [fullName]=\"chat.name\"\n                [newMsg]=\"chat.newMessage\"\n                [newMsgMode]=\"'Circle'\"\n                class=\"core-chat-message-from-avatar\"\n              (click)=\"openChat(chat)\"></core-chat-avatar>\n            }\n          }\n          <span\n            class=\"sln-fade\"\n            [class.sln-fade-in]=\"visible\"\n            [class.sln-fade-out]=\"!visible\"\n          ></span>\n        </div>\n      }\n      <div class=\"sellan-button-view-chat\">\n        <div matTooltip=\"{{ !hideUsers ? '\u0421\u043A\u0440\u044B\u0442\u044C \u0447\u0430\u0442' : '\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0447\u0430\u0442'}}\" matTooltipPosition=\"before\" matTooltipClass=\"custom-tooltip-add-chat\" class=\"sln-pos-view\">\n          <div (click)=\"hideUsersChat()\" class=\"sln-button-veiw-chat\">\n            <div class=\"sln-control-{{ !hideUsers ? 'eye' : 'close-eye'}}\"></div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n}\n", styles: [".sellan-wrapper{display:flex;position:absolute;right:15px;bottom:30px;width:100px;z-index:2;align-items:flex-end;justify-content:flex-end}.sellan-chat-button{width:60px;height:60px;border-radius:50%;border:none;outline:none;color:#fff;font-size:32px;display:flex;flex-direction:column-reverse;margin-left:10px}.sln-widgets-balloons{display:flex;flex-direction:row-reverse;align-items:flex-end}.sellan-chat-button-header{z-index:1;font-weight:700;color:#fff;border:1px solid #fff;background-color:inherit;padding:5px 9px;margin-left:5px}.sellan-chat-button:focus{border:2px solid white}.sellan-chat-box{z-index:2;position:absolute;left:0;height:100vh;width:100vw;margin:0;display:flex;flex-direction:column;box-shadow:0 5px 40px #00000029;background:#1976d2}.sellan-chat-box-hidden{display:none}.sellan-chat-box-header{padding:10px;color:#fff}.sellan-chat-box-main{flex:1;width:99%;background:#fff;display:flex;flex-direction:column-reverse;overflow:auto}.sellan-chat-box-footer{color:#5d6275;min-height:7vh;border-radius:24px;width:97%;margin:10px auto;background:var(--ADD-COLOR-2);box-sizing:border-box;display:flex;justify-content:space-between;align-items:center}.sellan-operator-name{margin:0;padding:1px}.sellan-operator-status{float:right;padding:4px}.sellan-operator-status span{margin-left:4px}.sellan-operator-status-online{color:var(--SUCCESS)}.sellan-operator-status-offline{color:#ff2480}.sellan-operator-avatar{height:30px;width:30px;border-radius:50%;float:left;margin-right:10px}.sellan-chat-message{display:block;width:auto;margin:5px;align-self:flex-start;flex-direction:row;min-width:75%;max-width:75%;word-wrap:break-word}.sellan-chat-message-date{font-size:11px;color:var(--GRAY-SOFT);padding:5px}.sellan-button-add-chat{background:var(--WHITE);border-radius:50%}.sellan-button-add-chat>div{display:flex}.sellan-chat-message-from-avatar{border-radius:50%;background:#fff;margin-top:10px;box-shadow:0 1px 8px 2px var(--PRIMARY)}.sellan-chat-message-text{font-size:14px;margin-top:15px;text-align:left;color:#fff}a{color:#fff!important}.sellan-chat-message-received{margin-right:50px}.sellan-chat-message-received .chat-message-text{background:#b9d6f2;margin-left:50px;border-bottom-left-radius:0}.sellan-chat-message-received .chat-message-text:before{position:absolute;content:\" \";left:-10px;bottom:0;border-right:solid 10px #b9d6f2;border-top:solid 10px transparent;z-index:0}.sellan-chat-message-received .chat-message-date{margin-left:50px}.sellan-chat-message-received .chat-message-from-avatar{position:absolute;left:0;bottom:-15px}.sellan-chat-message-sent{align-self:flex-end}.sellan-chat-message-sent .chat-message-from{float:right}.sellan-chat-message-sent .chat-message-text{background:#84dccf;margin-right:50px;border-bottom-right-radius:0}.sellan-chat-message-sent .chat-message-text:after{position:absolute;content:\" \";right:-10px;bottom:0;border-left:solid 10px #84dccf;border-top:solid 10px transparent;z-index:0}.sellan-chat-message-sent .chat-message-date{text-align:right;padding-right:50px}.sellan-chat-message-sent .chat-message-from-avatar{position:absolute;right:0;bottom:-15px}.blue .sellan-chat-box{background:#1976d2}.grey .sellan-chat-button,.grey .sellan-chat-box{background:#454549}.red .sellan-chat-button,.red .sellan-chat-box{background:#dd0031}.sln-add-chat{width:60px;height:60px;cursor:pointer}@media(min-width:576px){.sellan-chat-button-header{display:none}.sellan-chat-box{inset:auto 40px 100px auto;height:60vh;width:23vw;border-radius:10px}}@media(min-width:768px){.sellan-chat-box{height:70vh}}@media(min-width:992px){.sellan-chat-box{height:80vh;z-index:3}}.sln-button-veiw-chat{z-index:2}.sln-pos-view,.sln-pos-noview{cursor:pointer;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:30px;background:#fff;line-height:0;border:2px solid var(--GRAY-SOFT)}.sln-fade{opacity:0}.sln-fade-in{animation:slnFadeIn .25s ease-out forwards}.sln-fade-out{animation:slnFadeOut .25s ease-in forwards}@keyframes slnFadeIn{0%{opacity:0}to{opacity:1}}@keyframes slnFadeOut{0%{opacity:1}to{opacity:0}}\n"] }]
        }], ctorParameters: () => [{ type: SellanChatUsersService }, { type: SellanChatNotificationService }, { type: DrawerService }, { type: i0.ChangeDetectorRef }, { type: PageService }, { type: CoreUserSettingsService }], propDecorators: { bottom: [{
                type: ViewChild,
                args: ['bottom']
            }], botName: [{
                type: Input
            }], botAvatar: [{
                type: Input
            }], userAvatar: [{
                type: Input
            }], opened: [{
                type: Input
            }], hide: [{
                type: Input
            }], visible: [{
                type: Input
            }] } });

class CorePageContentComponent extends CoreAbstractComponent {
    constructor(_ngZone) {
        super();
        this.rightPanel = false;
        this.leftfPanel = false;
        if (!this.headHeight) {
            this.headHeight = 65;
        }
        if (!this.titleHeight) {
            this.titleHeight = 0;
        }
        if (!this.footerHeight) {
            this.footerHeight = 25;
        }
        // регистрируем при формировании страницы массив делегатов для события onresize
        if (!window.ResizeDelegats) {
            window.ResizeDelegats = new Array();
        }
        // добавляем делегата на изменение основной части контента
        window.ResizeDelegats.push(() => {
            _ngZone.run(() => {
                this.contentHeight = undefined;
            });
        });
    }
    getMaxContentHeight() {
        const bodyPadding = 20;
        const pageItemsHeight = this.headHeight + this.titleHeight + this.footerHeight;
        this.contentHeight = window.visualViewport?.height - pageItemsHeight - bodyPadding;
        return { height: this.contentHeight.toString() + 'px' };
    }
    getColSize() {
        return this.leftfPanel ? '9' : (this.rightPanel ? '8' : '12');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePageContentComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CorePageContentComponent, isStandalone: false, selector: "core-page-content", inputs: { headHeight: "headHeight", titleHeight: "titleHeight", footerHeight: "footerHeight", hideChat: "hideChat", rightPanel: "rightPanel", leftfPanel: "leftfPanel" }, usesInheritance: true, ngImport: i0, template: "<div class=\"row\">\n  @if (leftfPanel) {\n    <div class=\"col-md-3 sln-content-left\">\n      <ng-scrollbar trackClass=\"sln-crl-core-page-left\" [ngStyle]=\"getMaxContentHeight()\">\n        <ng-content select=\"[pageContentLeft]\"></ng-content>\n      </ng-scrollbar>\n    </div>\n  }\n  <div class=\"col-md-{{ getColSize() }} sln-content-body\">\n    <ng-scrollbar trackClass=\"sln-crl-core-page-body\" [ngStyle]=\"getMaxContentHeight()\">\n      <div class=\"full-width white-bg border-left\">\n        <ng-content select=\"[pageContentBody]\"></ng-content>\n      </div>\n    </ng-scrollbar>\n  </div>\n  @if (rightPanel) {\n    <div class=\"col-md-4 sln-content-right\">\n      <ng-scrollbar trackClass=\"sln-crl-core-page-right\" [ngStyle]=\"getMaxContentHeight()\">\n        <ng-content select=\"[pageContentRight]\"></ng-content>\n      </ng-scrollbar>\n    </div>\n  }\n</div>\n<core-widget-balloons [hide]=\"hideChat\"></core-widget-balloons>\n", styles: [".sln-content-right{padding-left:0;padding-right:10px}::ng-deep .ng-scrollbar-track-wrapper:has(>.sln-crl-core-page-body){right:-10px!important}::ng-deep .ng-scrollbar-track-wrapper:has(>.sln-crl-core-page-right){right:0!important}\n"], dependencies: [{ kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "component", type: CoreChatWidgetBalloonsComponent, selector: "core-widget-balloons", inputs: ["botName", "botAvatar", "userAvatar", "opened", "hide", "visible"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePageContentComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-page-content', standalone: false, template: "<div class=\"row\">\n  @if (leftfPanel) {\n    <div class=\"col-md-3 sln-content-left\">\n      <ng-scrollbar trackClass=\"sln-crl-core-page-left\" [ngStyle]=\"getMaxContentHeight()\">\n        <ng-content select=\"[pageContentLeft]\"></ng-content>\n      </ng-scrollbar>\n    </div>\n  }\n  <div class=\"col-md-{{ getColSize() }} sln-content-body\">\n    <ng-scrollbar trackClass=\"sln-crl-core-page-body\" [ngStyle]=\"getMaxContentHeight()\">\n      <div class=\"full-width white-bg border-left\">\n        <ng-content select=\"[pageContentBody]\"></ng-content>\n      </div>\n    </ng-scrollbar>\n  </div>\n  @if (rightPanel) {\n    <div class=\"col-md-4 sln-content-right\">\n      <ng-scrollbar trackClass=\"sln-crl-core-page-right\" [ngStyle]=\"getMaxContentHeight()\">\n        <ng-content select=\"[pageContentRight]\"></ng-content>\n      </ng-scrollbar>\n    </div>\n  }\n</div>\n<core-widget-balloons [hide]=\"hideChat\"></core-widget-balloons>\n", styles: [".sln-content-right{padding-left:0;padding-right:10px}::ng-deep .ng-scrollbar-track-wrapper:has(>.sln-crl-core-page-body){right:-10px!important}::ng-deep .ng-scrollbar-track-wrapper:has(>.sln-crl-core-page-right){right:0!important}\n"] }]
        }], ctorParameters: () => [{ type: i0.NgZone }], propDecorators: { headHeight: [{
                type: Input
            }], titleHeight: [{
                type: Input
            }], footerHeight: [{
                type: Input
            }], hideChat: [{
                type: Input
            }], rightPanel: [{
                type: Input
            }], leftfPanel: [{
                type: Input
            }] } });

class CoreErrorPage extends CoreAbstractComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreErrorPage, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreErrorPage, isStandalone: false, selector: "core-error", usesInheritance: true, ngImport: i0, template: "<core-page-content>\n    <div pageContentBody>\n        <div class=\"middle-box text-center animated fadeInDown\">\n            <div class=\"sln-common-red-cross-table err-img\"></div>\n            <h1><span>4</span><div class=\"logo-mini-logo logo-mini-logo-position\"></div><span>4</span></h1>\n            <h3 class=\"font-bold\">\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0438 \u0440\u0430\u0431\u043E\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F</h3>\n            <div class=\"error-desc\">\n                \u0421\u0435\u0440\u0432\u0435\u0440 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0438\u043B \u043D\u0435\u0447\u0442\u043E \u043D\u0435\u043E\u0436\u0438\u0434\u0430\u043D\u043D\u043E\u0435, \u0447\u0442\u043E \u043D\u0435 \u043F\u043E\u0437\u0432\u043E\u043B\u0438\u043B\u043E \u0435\u043C\u0443 \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441. \u041C\u044B \u043F\u0440\u0438\u043D\u043E\u0441\u0438\u043C \u0441\u0432\u043E\u0438 \u0438\u0437\u0432\u0438\u043D\u0435\u043D\u0438\u044F.\n                \u0412\u043E\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435\u0441\u044C \u0441\u0441\u044B\u043B\u043A\u043E\u0439 \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0430 \u043D\u0430  <a routerLink=\"/\" >\u0420\u0430\u0431\u043E\u0447\u0438\u0439 \u0441\u0442\u043E\u043B.</a> \n            </div>\n        </div>\n    </div>\n</core-page-content>", styles: [".middle-box{height:85vh;display:flex;align-items:center;justify-content:center;flex-direction:column;width:50%;margin:0 auto;position:relative}.middle-box .err-img{position:absolute;width:100%;z-index:1;opacity:.1;background-size:100%;height:100%}.middle-box h1{display:flex;align-items:center;font-size:10rem;color:var(--DARK-GREY);z-index:2}.middle-box h1 img{height:124px}.middle-box h3{font-size:40px;color:var(--DARK-GREY);z-index:2}.middle-box .error-desc{font-size:17px;text-align:center;color:var(--DARK-GREY);z-index:2}.logo-mini-logo-position{background-repeat:no-repeat;background-size:100px;width:100px;height:120px}\n"], dependencies: [{ kind: "directive", type: i1$7.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: CorePageContentComponent, selector: "core-page-content", inputs: ["headHeight", "titleHeight", "footerHeight", "hideChat", "rightPanel", "leftfPanel"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreErrorPage, decorators: [{
            type: Component,
            args: [{ selector: 'core-error', standalone: false, template: "<core-page-content>\n    <div pageContentBody>\n        <div class=\"middle-box text-center animated fadeInDown\">\n            <div class=\"sln-common-red-cross-table err-img\"></div>\n            <h1><span>4</span><div class=\"logo-mini-logo logo-mini-logo-position\"></div><span>4</span></h1>\n            <h3 class=\"font-bold\">\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0438 \u0440\u0430\u0431\u043E\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F</h3>\n            <div class=\"error-desc\">\n                \u0421\u0435\u0440\u0432\u0435\u0440 \u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0438\u043B \u043D\u0435\u0447\u0442\u043E \u043D\u0435\u043E\u0436\u0438\u0434\u0430\u043D\u043D\u043E\u0435, \u0447\u0442\u043E \u043D\u0435 \u043F\u043E\u0437\u0432\u043E\u043B\u0438\u043B\u043E \u0435\u043C\u0443 \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441. \u041C\u044B \u043F\u0440\u0438\u043D\u043E\u0441\u0438\u043C \u0441\u0432\u043E\u0438 \u0438\u0437\u0432\u0438\u043D\u0435\u043D\u0438\u044F.\n                \u0412\u043E\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435\u0441\u044C \u0441\u0441\u044B\u043B\u043A\u043E\u0439 \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0430 \u043D\u0430  <a routerLink=\"/\" >\u0420\u0430\u0431\u043E\u0447\u0438\u0439 \u0441\u0442\u043E\u043B.</a> \n            </div>\n        </div>\n    </div>\n</core-page-content>", styles: [".middle-box{height:85vh;display:flex;align-items:center;justify-content:center;flex-direction:column;width:50%;margin:0 auto;position:relative}.middle-box .err-img{position:absolute;width:100%;z-index:1;opacity:.1;background-size:100%;height:100%}.middle-box h1{display:flex;align-items:center;font-size:10rem;color:var(--DARK-GREY);z-index:2}.middle-box h1 img{height:124px}.middle-box h3{font-size:40px;color:var(--DARK-GREY);z-index:2}.middle-box .error-desc{font-size:17px;text-align:center;color:var(--DARK-GREY);z-index:2}.logo-mini-logo-position{background-repeat:no-repeat;background-size:100px;width:100px;height:120px}\n"] }]
        }] });

class CoreForbiddenPage extends CoreAbstractComponent {
    constructor(injector) {
        super();
        this.VM = injector.get(VisualSettingManager);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreForbiddenPage, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreForbiddenPage, isStandalone: false, selector: "core-forbidden", usesInheritance: true, ngImport: i0, template: "<core-page-content>\n  <div pageContentBody>\n    <div class=\"middle-box text-center animated fadeInDown\">\n      <div class=\"sln-common-red-cross-table err-img\"></div>\n      <h1><span>4</span><div class=\"logo-mini-logo logo-mini-logo-position\"></div><span>3</span></h1>\n      <h3 class=\"font-bold\">\u0414\u043E\u0441\u0442\u0443\u043F \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D</h3>\n      <div class=\"error-desc\">\n        \u0423 \u0432\u0430\u0441 \u043D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u0430 \u043A \u044D\u0442\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435. <br>\n        \u0415\u0441\u043B\u0438 \u044D\u0442\u043E \u043E\u0448\u0438\u0431\u043A\u0430, \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u0432 \u0442\u0435\u0445\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443 \u0438 \u043C\u044B \u043F\u043E\u043C\u043E\u0436\u0435\u043C! \u0417\u0432\u043E\u043D\u0438\u0442\u0435\n        @if (VM?.Setting?.platform?.isShowPhone) {\n          <a href=\"tel:8{{VM?.Setting?.platform?.phoneFirst}}\" class=\"tel phone-first\"><span class=\"phone-first-span\">{{VM?.Setting?.platform?.phoneFirst | phoneRu}}</span></a>\n        }\n        @if (VM?.Setting?.platform?.isShowPhone) {\n          <a href=\"tel:8{{VM?.Setting?.platform?.phoneSecond}}\" class=\"tel\"><span>{{VM?.Setting?.platform?.phoneSecond | phoneRu}}</span></a>\n        }\n        @if (VM?.Setting?.platform?.linkTelegram?.length > 0) {\n          <div>\n            \u0438\u043B\u0438 \u043D\u0430\u043F\u0438\u0448\u0438\u0442\u0435 \u043D\u0430\u043C \u0432 <a href=\"{{VM?.Setting?.platform?.linkTelegram}}\" target=\"_blank\" rel=\"nofollow\">\u0447\u0430\u0442</a>\n          </div>\n        }\n      </div>\n    </div>\n  </div>\n</core-page-content>", styles: [".middle-box{height:85vh;display:flex;align-items:center;justify-content:center;flex-direction:column;width:50%;margin:0 auto;position:relative}.middle-box .err-img{position:absolute;width:90%;z-index:1;opacity:.1;background-size:100%;height:100%}.middle-box h1{display:flex;align-items:center;font-size:10rem;color:var(--DARK-GREY);z-index:2;line-height:0;margin-bottom:15px}.middle-box h1 img{height:124px}.middle-box h3{font-size:40px;color:var(--DARK-GREY);z-index:2}.middle-box .error-desc{font-size:17px;text-align:center;color:var(--DARK-GREY);z-index:2;margin-bottom:10px}.middle-box .email{display:none}.middle-box a{color:var(--PRIMARY)}.middle-box a span{display:inline-block;font-family:DinProMedium;width:auto}.middle-box .phone-first{padding-right:5px}.middle-box .phone-first-span:after{content:\"/\";padding-left:5px}.logo-mini-logo-position{background-repeat:no-repeat;background-size:100px;width:100px;height:120px}\n"], dependencies: [{ kind: "component", type: CorePageContentComponent, selector: "core-page-content", inputs: ["headHeight", "titleHeight", "footerHeight", "hideChat", "rightPanel", "leftfPanel"] }, { kind: "pipe", type: PhoneRuPipe, name: "phoneRu" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreForbiddenPage, decorators: [{
            type: Component,
            args: [{ selector: 'core-forbidden', standalone: false, template: "<core-page-content>\n  <div pageContentBody>\n    <div class=\"middle-box text-center animated fadeInDown\">\n      <div class=\"sln-common-red-cross-table err-img\"></div>\n      <h1><span>4</span><div class=\"logo-mini-logo logo-mini-logo-position\"></div><span>3</span></h1>\n      <h3 class=\"font-bold\">\u0414\u043E\u0441\u0442\u0443\u043F \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D</h3>\n      <div class=\"error-desc\">\n        \u0423 \u0432\u0430\u0441 \u043D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u0430 \u043A \u044D\u0442\u043E\u0439 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435. <br>\n        \u0415\u0441\u043B\u0438 \u044D\u0442\u043E \u043E\u0448\u0438\u0431\u043A\u0430, \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u0432 \u0442\u0435\u0445\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443 \u0438 \u043C\u044B \u043F\u043E\u043C\u043E\u0436\u0435\u043C! \u0417\u0432\u043E\u043D\u0438\u0442\u0435\n        @if (VM?.Setting?.platform?.isShowPhone) {\n          <a href=\"tel:8{{VM?.Setting?.platform?.phoneFirst}}\" class=\"tel phone-first\"><span class=\"phone-first-span\">{{VM?.Setting?.platform?.phoneFirst | phoneRu}}</span></a>\n        }\n        @if (VM?.Setting?.platform?.isShowPhone) {\n          <a href=\"tel:8{{VM?.Setting?.platform?.phoneSecond}}\" class=\"tel\"><span>{{VM?.Setting?.platform?.phoneSecond | phoneRu}}</span></a>\n        }\n        @if (VM?.Setting?.platform?.linkTelegram?.length > 0) {\n          <div>\n            \u0438\u043B\u0438 \u043D\u0430\u043F\u0438\u0448\u0438\u0442\u0435 \u043D\u0430\u043C \u0432 <a href=\"{{VM?.Setting?.platform?.linkTelegram}}\" target=\"_blank\" rel=\"nofollow\">\u0447\u0430\u0442</a>\n          </div>\n        }\n      </div>\n    </div>\n  </div>\n</core-page-content>", styles: [".middle-box{height:85vh;display:flex;align-items:center;justify-content:center;flex-direction:column;width:50%;margin:0 auto;position:relative}.middle-box .err-img{position:absolute;width:90%;z-index:1;opacity:.1;background-size:100%;height:100%}.middle-box h1{display:flex;align-items:center;font-size:10rem;color:var(--DARK-GREY);z-index:2;line-height:0;margin-bottom:15px}.middle-box h1 img{height:124px}.middle-box h3{font-size:40px;color:var(--DARK-GREY);z-index:2}.middle-box .error-desc{font-size:17px;text-align:center;color:var(--DARK-GREY);z-index:2;margin-bottom:10px}.middle-box .email{display:none}.middle-box a{color:var(--PRIMARY)}.middle-box a span{display:inline-block;font-family:DinProMedium;width:auto}.middle-box .phone-first{padding-right:5px}.middle-box .phone-first-span:after{content:\"/\";padding-left:5px}.logo-mini-logo-position{background-repeat:no-repeat;background-size:100px;width:100px;height:120px}\n"] }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

class CoreNotFoundPage extends CoreAbstractComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotFoundPage, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreNotFoundPage, isStandalone: false, selector: "core-notfound", usesInheritance: true, ngImport: i0, template: "<core-page-content>\n    <div pageContentBody>\n        <div class=\"middle-box text-center animated fadeInDown\"> \n            <div class=\"sln-common-red-cross-table err-img\"></div>  \n            <h1><span>4</span><div class=\"logo-mini-logo logo-mini-logo-position\"></div><span>4</span></h1>\n            <h3 class=\"font-bold\">\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430</h3>\n            <div class=\"error-desc\">\n                \u041C\u044B \u043F\u0440\u0438\u043D\u043E\u0441\u0438\u043C \u0441\u0432\u043E\u0438 \u0438\u0437\u0432\u0438\u043D\u0435\u043D\u0438\u044F \u0437\u0430 \u043D\u0435\u0443\u0434\u043E\u0431\u0441\u0442\u0432\u0430, \u043D\u043E \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430, \u043A\u043E\u0442\u043E\u0440\u0443\u044E \u0432\u044B \u0438\u0449\u0435\u0442\u0435, \u043D\u0435 \u0431\u044B\u043B\u0430 \u043D\u0430\u0439\u0434\u0435\u043D\u0430. \n                \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C URL-\u0430\u0434\u0440\u0435\u0441 \u043D\u0430 \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u043E\u0448\u0438\u0431\u043E\u043A, \n                \u0437\u0430\u0442\u0435\u043C \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u0432 \u0441\u0432\u043E\u0435\u043C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438\u043B\u0438 \u0432\u043E\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435\u0441\u044C \u0441\u0441\u044B\u043B\u043A\u043E\u0439 \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0430 \u043D\u0430  <a routerLink=\"/\" >\u0420\u0430\u0431\u043E\u0447\u0438\u0439 \u0441\u0442\u043E\u043B.</a> \n            </div>\n        </div>\n    </div>\n</core-page-content>", styles: [".middle-box{height:85vh;display:flex;align-items:center;justify-content:center;flex-direction:column;width:50%;margin:0 auto;position:relative}.middle-box .err-img{position:absolute;width:80%;z-index:1;opacity:.1;background-size:100%;height:100%}.middle-box h1{display:flex;align-items:center;font-size:10rem;color:var(--DARK-GREY);z-index:2}.middle-box h1 img{height:124px}.middle-box h3{font-size:40px;color:var(--DARK-GREY);z-index:2}.middle-box .error-desc{font-size:17px;text-align:center;color:var(--DARK-GREY);z-index:2}.logo-mini-logo-position{background-repeat:no-repeat;background-size:100px;width:100px;height:120px}\n"], dependencies: [{ kind: "directive", type: i1$7.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: CorePageContentComponent, selector: "core-page-content", inputs: ["headHeight", "titleHeight", "footerHeight", "hideChat", "rightPanel", "leftfPanel"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreNotFoundPage, decorators: [{
            type: Component,
            args: [{ selector: 'core-notfound', standalone: false, template: "<core-page-content>\n    <div pageContentBody>\n        <div class=\"middle-box text-center animated fadeInDown\"> \n            <div class=\"sln-common-red-cross-table err-img\"></div>  \n            <h1><span>4</span><div class=\"logo-mini-logo logo-mini-logo-position\"></div><span>4</span></h1>\n            <h3 class=\"font-bold\">\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430</h3>\n            <div class=\"error-desc\">\n                \u041C\u044B \u043F\u0440\u0438\u043D\u043E\u0441\u0438\u043C \u0441\u0432\u043E\u0438 \u0438\u0437\u0432\u0438\u043D\u0435\u043D\u0438\u044F \u0437\u0430 \u043D\u0435\u0443\u0434\u043E\u0431\u0441\u0442\u0432\u0430, \u043D\u043E \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430, \u043A\u043E\u0442\u043E\u0440\u0443\u044E \u0432\u044B \u0438\u0449\u0435\u0442\u0435, \u043D\u0435 \u0431\u044B\u043B\u0430 \u043D\u0430\u0439\u0434\u0435\u043D\u0430. \n                \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C URL-\u0430\u0434\u0440\u0435\u0441 \u043D\u0430 \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u043E\u0448\u0438\u0431\u043E\u043A, \n                \u0437\u0430\u0442\u0435\u043C \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u0432 \u0441\u0432\u043E\u0435\u043C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438\u043B\u0438 \u0432\u043E\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435\u0441\u044C \u0441\u0441\u044B\u043B\u043A\u043E\u0439 \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0430 \u043D\u0430  <a routerLink=\"/\" >\u0420\u0430\u0431\u043E\u0447\u0438\u0439 \u0441\u0442\u043E\u043B.</a> \n            </div>\n        </div>\n    </div>\n</core-page-content>", styles: [".middle-box{height:85vh;display:flex;align-items:center;justify-content:center;flex-direction:column;width:50%;margin:0 auto;position:relative}.middle-box .err-img{position:absolute;width:80%;z-index:1;opacity:.1;background-size:100%;height:100%}.middle-box h1{display:flex;align-items:center;font-size:10rem;color:var(--DARK-GREY);z-index:2}.middle-box h1 img{height:124px}.middle-box h3{font-size:40px;color:var(--DARK-GREY);z-index:2}.middle-box .error-desc{font-size:17px;text-align:center;color:var(--DARK-GREY);z-index:2}.logo-mini-logo-position{background-repeat:no-repeat;background-size:100px;width:100px;height:120px}\n"] }]
        }] });

class MenuService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    getItems(module) {
        const url = this._startUp.apiRoot('menu/build', 'core') + '?module=' + module;
        return this._ajaxM.get({ url: url });
    }
    removeUserView(viewName) {
        const url = this._startUp.apiRoot('menu/user-view?key=' + viewName, 'core');
        return this._ajaxM.delete({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MenuService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MenuService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MenuService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class CoreChatProfileDrawerComponent extends CoreBaseDestroyComponent {
    constructor(config, _popup, _avatarService, _cropper, _drawer, _chatUserService, _context) {
        super();
        this.config = config;
        this._popup = _popup;
        this._avatarService = _avatarService;
        this._cropper = _cropper;
        this._drawer = _drawer;
        this._chatUserService = _chatUserService;
        this._context = _context;
        this.name = DrawerNames.PROFILE;
        this.profile = JSON.parse(JSON.stringify(config.data));
        this.myId = _context.session.userId;
    }
    uploadIcon() {
        // пользователь можем вносить изменения в чате только для себя      
        if (this.myId === this.profile.userId) {
            this._cropper.uploadAvatar((upload) => {
                this._avatarService
                    .avatarUpload(AvatarEntity.User, this.profile.userId, upload)
                    .pipe(this.takeUntilDestroyed())
                    .subscribe(response => this._popup.HandleIEntityResponse({
                    response: response,
                    successCallback: (entity) => {
                        this.profile.avatarLink = entity;
                        this._context.updateSessionPart('avatarLink', this.profile.avatarLink);
                    }
                }));
            });
        }
    }
    removeIcon() {
        // пользователь можем вносить изменения в чате только для себя
        if (this.myId === this.profile.userId) {
            this._avatarService
                .avatarRemove(AvatarEntity.User, this.profile.userId)
                .pipe(this.takeUntilDestroyed())
                .subscribe(response => this._popup.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this.profile.avatarLink = undefined;
                    this._context.updateSessionPart('avatarLink', undefined);
                }
            }));
        }
    }
    setColor() {
        // пользователь можем вносить изменения в чате только для себя
        if (this.myId === this.profile.userId) {
            this._avatarService
                .avatarBackground(AvatarEntity.User, this.profile.userId)
                .pipe(this.takeUntilDestroyed())
                .subscribe(response => this._popup.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this.profile.avatarColor = entity;
                    this._context.updateSessionPart('avatarColor', this.profile.avatarColor);
                }
            }));
        }
    }
    save() {
        this._chatUserService
            .updateChetUserInfo(this.profile)
            .pipe(this.takeUntilDestroyed())
            .subscribe(response => this._popup.HandleIResponse({
            response: response,
            successCallback: () => {
                this._chatUserService.chatUser = this.profile;
                this._drawer.close(DrawerNames.PROFILE);
            }
        }));
    }
    close() {
        this._drawer.close(DrawerNames.PROFILE);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatProfileDrawerComponent, deps: [{ token: CORE_DRAWER_DATA_TOKEN_KEY }, { token: PopupResults }, { token: CoreAvatarService }, { token: CoreCropperService }, { token: DrawerService }, { token: SellanChatUsersService }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatProfileDrawerComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-drawer [name]=\"name\" width=\"420\" [footerHeight]=\"60\">\n  <div title class=\"sln-drawer-header\">\n    <button (click)=\"close()\" class=\"sln-drawer-close\">\n      x\n    </button>\n    <h3 class=\"sln-drawer-title\"> \u041C\u043E\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442</h3>\n  </div>\n  <div class=\"row sln-block-user-icon\" body>\n    <div class=\"sln-editable-icon-block\">\n      <div class=\"core-user-icon\">\n        <core-user-icon sizeSuffix=\"preview\"\n          [fullName]=\"profile.fullName\"\n          [url]=\"profile.avatarLink\"\n          [backColor]=\"profile.avatarColor\">\n        </core-user-icon>\n        @if (myId === profile.userId) {\n          <div class=\"sln-editable-icon sln-editable-icon-avatar\" (click)=\"uploadIcon()\">\n            <div class=\"sln-chat-add-photo sln-chat-add-photo-position\"></div>\n          </div>\n        }\n        @if (myId === profile.userId) {\n          <div class=\"sln-editable-icon sln-editable-icon-color\" (click)=\"setColor()\">\n            <div class=\"sln-chat-change-color-photo sln-chat-change-color-photo-position\"></div>\n          </div>\n        }\n        @if (myId === profile.userId && profile.avatarLink) {\n          <div class=\"sln-editable-icon sln-editable-icon-remove\" (click)=\"removeIcon()\">\n            <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n          </div>\n        }\n      </div>\n\n    </div>\n    <h4 class=\"sln-h4 sln-chat-profile-fullName\">{{ profile.fullName }}</h4>\n    <form #bodyForm=\"ngForm\" novalidate class=\"sln-chat-profile-form\">     \n      <div class=\"row\">\n        <div class=\"col-md-12\">\n          <core-field-string [(ngModel)]=\"profile.statusRow\" name=\"statusRow\" fieldName=\"statusRow\" placeholder=\"\u041C\u043E\u0439 \u0441\u0442\u0430\u0442\u0443\u0441\"\n          [settings]=\"{ rightHintHide: true }\"></core-field-string>\n        </div>\n        <div class=\"col-md-12\">\n          <core-field-bool [(ngModel)]=\"profile.useSound\" name=\"useSound\" fieldName=\"useSound\" placeholder=\"\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0437\u0432\u0443\u043A \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u0439\"\n            [settings]=\"{ mode: 'Slide' }\"></core-field-bool>\n        </div>\n      </div>\n    </form>\n  </div>\n  <div footer class=\"sln-new-group-footer\">\n    <button class=\"btn-default sln-btn-full-s close\" (click)=\"close()\">\n      \u041E\u0442\u043C\u0435\u043D\u0430\n    </button>\n    <button class=\"btn-primary sln-btn-full-s save\" (click)=\"save()\">\n      \u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\n    </button>\n  </div>\n</core-drawer>", styles: [".sln-new-group-header{padding:0 14px;display:flex;align-items:center;width:100%;justify-content:space-between;border-bottom:2px solid var(--PRIMARY)}.sln-drawer-title{color:var(--DARK-GREY);font-size:20px;font-family:var(--font-medium)}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}.sln-block-user-icon{padding:0}.sln-block-user-icon .sln-editable-icon-block{width:100%;margin-top:10px;justify-content:center;padding:0}.sln-new-group-footer{padding:0 15px}.sln-btn-light-s{margin-left:10px}.sln-chat-profile-fullName{text-align:center;margin-top:10px;border-bottom:2px solid var(--PRIMARY);padding:10px 15px;width:100%}.sln-chat-profile-form{padding:15px;width:100%}.sln-h6{margin:5px 0}.sln-drawer-header{padding:0 10px}.save{margin-left:10px}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreUserIconComponent, selector: "core-user-icon", inputs: ["useInChat", "sizeSuffix", "url", "backColor", "fullName"] }, { kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreDrawerComponent, selector: "core-drawer", inputs: ["name", "titleHeight", "footerHeight", "dialogTitle", "width", "minWidth", "hasTitle", "hasFooter", "goto"], outputs: ["reachedTopRun", "reachedBottomRun"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatProfileDrawerComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-drawer [name]=\"name\" width=\"420\" [footerHeight]=\"60\">\n  <div title class=\"sln-drawer-header\">\n    <button (click)=\"close()\" class=\"sln-drawer-close\">\n      x\n    </button>\n    <h3 class=\"sln-drawer-title\"> \u041C\u043E\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442</h3>\n  </div>\n  <div class=\"row sln-block-user-icon\" body>\n    <div class=\"sln-editable-icon-block\">\n      <div class=\"core-user-icon\">\n        <core-user-icon sizeSuffix=\"preview\"\n          [fullName]=\"profile.fullName\"\n          [url]=\"profile.avatarLink\"\n          [backColor]=\"profile.avatarColor\">\n        </core-user-icon>\n        @if (myId === profile.userId) {\n          <div class=\"sln-editable-icon sln-editable-icon-avatar\" (click)=\"uploadIcon()\">\n            <div class=\"sln-chat-add-photo sln-chat-add-photo-position\"></div>\n          </div>\n        }\n        @if (myId === profile.userId) {\n          <div class=\"sln-editable-icon sln-editable-icon-color\" (click)=\"setColor()\">\n            <div class=\"sln-chat-change-color-photo sln-chat-change-color-photo-position\"></div>\n          </div>\n        }\n        @if (myId === profile.userId && profile.avatarLink) {\n          <div class=\"sln-editable-icon sln-editable-icon-remove\" (click)=\"removeIcon()\">\n            <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n          </div>\n        }\n      </div>\n\n    </div>\n    <h4 class=\"sln-h4 sln-chat-profile-fullName\">{{ profile.fullName }}</h4>\n    <form #bodyForm=\"ngForm\" novalidate class=\"sln-chat-profile-form\">     \n      <div class=\"row\">\n        <div class=\"col-md-12\">\n          <core-field-string [(ngModel)]=\"profile.statusRow\" name=\"statusRow\" fieldName=\"statusRow\" placeholder=\"\u041C\u043E\u0439 \u0441\u0442\u0430\u0442\u0443\u0441\"\n          [settings]=\"{ rightHintHide: true }\"></core-field-string>\n        </div>\n        <div class=\"col-md-12\">\n          <core-field-bool [(ngModel)]=\"profile.useSound\" name=\"useSound\" fieldName=\"useSound\" placeholder=\"\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0437\u0432\u0443\u043A \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u0439\"\n            [settings]=\"{ mode: 'Slide' }\"></core-field-bool>\n        </div>\n      </div>\n    </form>\n  </div>\n  <div footer class=\"sln-new-group-footer\">\n    <button class=\"btn-default sln-btn-full-s close\" (click)=\"close()\">\n      \u041E\u0442\u043C\u0435\u043D\u0430\n    </button>\n    <button class=\"btn-primary sln-btn-full-s save\" (click)=\"save()\">\n      \u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\n    </button>\n  </div>\n</core-drawer>", styles: [".sln-new-group-header{padding:0 14px;display:flex;align-items:center;width:100%;justify-content:space-between;border-bottom:2px solid var(--PRIMARY)}.sln-drawer-title{color:var(--DARK-GREY);font-size:20px;font-family:var(--font-medium)}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}.sln-block-user-icon{padding:0}.sln-block-user-icon .sln-editable-icon-block{width:100%;margin-top:10px;justify-content:center;padding:0}.sln-new-group-footer{padding:0 15px}.sln-btn-light-s{margin-left:10px}.sln-chat-profile-fullName{text-align:center;margin-top:10px;border-bottom:2px solid var(--PRIMARY);padding:10px 15px;width:100%}.sln-chat-profile-form{padding:15px;width:100%}.sln-h6{margin:5px 0}.sln-drawer-header{padding:0 10px}.save{margin-left:10px}\n"] }]
        }], ctorParameters: () => [{ type: DrawerConfig, decorators: [{
                    type: Inject,
                    args: [CORE_DRAWER_DATA_TOKEN_KEY]
                }] }, { type: PopupResults }, { type: CoreAvatarService }, { type: CoreCropperService }, { type: DrawerService }, { type: SellanChatUsersService }, { type: ContextService }] });

class CoreChatListMenuComponent extends CoreBaseDestroyComponent {
    constructor(_drawer, _service) {
        super();
        this._drawer = _drawer;
        this._service = _service;
    }
    newChat() {
        this._drawer.show(CoreChatNewDrawerComponent, { name: DrawerNames.USER_LIST, data: { isNew: true } });
    }
    myProfile() {
        this._drawer.show(CoreChatProfileDrawerComponent, { name: DrawerNames.PROFILE, data: this._service.chatUser });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatListMenuComponent, deps: [{ token: DrawerService }, { token: SellanChatUsersService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreChatListMenuComponent, isStandalone: false, selector: "core-chat-list-menu", usesInheritance: true, ngImport: i0, template: "<div matTooltip=\"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\" matTooltipPosition=\"below\">\n    <button class=\"btn-chat\" [matMenuTriggerFor]=\"actionMenu\">\n        <div class=\"sln-grid-vertical-dots\" aria-hidden=\"true\" alt=\"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\"></div>\n    </button>\n</div>\n<mat-menu #actionMenu=\"matMenu\">\n    <button mat-menu-item (click)=\"newChat()\">\n        <div class=\"sln-chat-new-chat sln-chat-new-chat-position\"></div>\n        <span class=\"b-margin-icon\">\u041D\u043E\u0432\u044B\u0439 \u0447\u0430\u0442</span>\n    </button>\n    <button mat-menu-item (click)=\"myProfile()\">\n        <div class=\"sln-chat-my-profile sln-chat-my-profile-position\" alt=\"\u041C\u043E\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C\"></div>\n        <span class=\"b-margin-icon\">\u041C\u043E\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C</span>\n    </button>\n</mat-menu>", styles: [".btn-chat{background:transparent;border:none;cursor:pointer;line-height:0;margin-left:10px;height:100%;width:20px;padding-top:2px}.btn-chat img{height:18px}\n"], dependencies: [{ kind: "component", type: i4$6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatListMenuComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-chat-list-menu', standalone: false, template: "<div matTooltip=\"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\" matTooltipPosition=\"below\">\n    <button class=\"btn-chat\" [matMenuTriggerFor]=\"actionMenu\">\n        <div class=\"sln-grid-vertical-dots\" aria-hidden=\"true\" alt=\"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435\"></div>\n    </button>\n</div>\n<mat-menu #actionMenu=\"matMenu\">\n    <button mat-menu-item (click)=\"newChat()\">\n        <div class=\"sln-chat-new-chat sln-chat-new-chat-position\"></div>\n        <span class=\"b-margin-icon\">\u041D\u043E\u0432\u044B\u0439 \u0447\u0430\u0442</span>\n    </button>\n    <button mat-menu-item (click)=\"myProfile()\">\n        <div class=\"sln-chat-my-profile sln-chat-my-profile-position\" alt=\"\u041C\u043E\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C\"></div>\n        <span class=\"b-margin-icon\">\u041C\u043E\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C</span>\n    </button>\n</mat-menu>", styles: [".btn-chat{background:transparent;border:none;cursor:pointer;line-height:0;margin-left:10px;height:100%;width:20px;padding-top:2px}.btn-chat img{height:18px}\n"] }]
        }], ctorParameters: () => [{ type: DrawerService }, { type: SellanChatUsersService }] });

class CoreChatListDrawerComponent extends CoreBaseDestroyComponent {
    get showEmptySearch() {
        return !Utility.isEmpty(this.roomSearch) && this.rooms.length === 0;
    }
    constructor(_eventBroker, config, _drawer, _service, _popup) {
        super();
        this.config = config;
        this._drawer = _drawer;
        this._service = _service;
        this._popup = _popup;
        this.name = DrawerNames.LIST;
        this.blockLoading = false;
        this.roomSearch = null;
        this.roomsPage = 0;
        this._closeDrawerEvents = _eventBroker.listen('drawer-closed-event', (value) => {
            if (value.name === DrawerNames.USER_LIST || value.name === DrawerNames.GROUP || value.name === DrawerNames.DIALOG) {
                if (value.data?.needReload === true) {
                    this.roomsPage = 0;
                    this._reloadChat(true);
                }
            }
        });
        this._callDialogListner = _eventBroker.listen("chat-drawer-call-dialog", (value) => {
            this._drawer.show(CoreChatDialogDrawerComponent, { name: DrawerNames.DIALOG, data: value });
        });
    }
    ngOnInit() {
        this._reloadChat(true);
    }
    ngOnDestroy() {
        this._closeDrawerEvents.ignore();
        this._callDialogListner.ignore();
    }
    onSearchChange($event) {
        if ($event?.length >= 3) {
            this._reloadChat(true, $event);
        }
        else if ($event?.length == 0) {
            this._reloadChat(true);
        }
    }
    onScroll($event) {
        if ($event.position === 'BOTTOM') {
            if (this.blockLoading === false) {
                this.blockLoading = true;
                this._reloadChat();
            }
        }
    }
    userSelected(chat) {
        this.rooms.filter(z => z.id == chat.id)[0].newMessage = false;
        this.selectedRoom = this.rooms.filter(z => z.id == chat.id)[0];
        this._drawer.show(CoreChatDialogDrawerComponent, { name: DrawerNames.DIALOG, data: this.selectedRoom });
    }
    newChat() {
        this._drawer.show(CoreChatNewDrawerComponent, { name: DrawerNames.USER_LIST, data: { isNew: true } });
    }
    closeDrawChat() {
        this._drawer.close(DrawerNames.LIST);
    }
    _reloadChat(force, filter) {
        if (force !== true) {
            this.roomsPage++;
        }
        this._service
            .getMyRooms(force === true ? undefined : this.roomsPage, filter)
            .pipe(this.takeUntilDestroyed())
            .subscribe(response => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                if (force === true) {
                    this.rooms = entity;
                    this.roomsPage = 0;
                }
                else {
                    this.rooms = this.rooms.concat(entity);
                }
                this.blockLoading = false;
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatListDrawerComponent, deps: [{ token: EventBrokerService }, { token: CORE_DRAWER_DATA_TOKEN_KEY }, { token: DrawerService }, { token: CoreChatService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreChatListDrawerComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-drawer [name]=\"name\" width=\"420\" hasFooter=\"false\" (reachedBottomRun)=\"onScroll($event)\">\n  <div title class=\"sln-drawer-header\">\n    <button (click)=\"closeDrawChat()\" class=\"sln-drawer-close\">\n      x\n    </button>\n    <form #roomSearchForm=\"ngForm\" novalidate>\n      <core-field-string [(ngModel)]=\"roomSearch\" name=\"roomSearch\" fieldName=\"roomSearch\"\n        placeholder=\"\u041F\u043E\u0438\u0441\u043A\" (valueChange)=\"onSearchChange($event)\"\n      [settings]=\"{ rightHintHide: true}\" class=\"sln-input-s\"></core-field-string>\n    </form>\n    <core-chat-list-menu></core-chat-list-menu>\n  </div>\n  <div body class=\"sln-drawer-body-wrap\">\n    @for (room of rooms; track room) {\n      <core-chat-item (click)=\"userSelected(room)\" [chat]=\"room\"></core-chat-item>\n    }\n    @if (showEmptySearch) {\n      <div class=\"sln-showEmptySearch\">\n        <span>\n          \u041F\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u0443 \"{{ roomSearch }}\" \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E.\n        </span>\n        <button class=\"btn-primary sln-btn-light-s newChat\" (click)=\"newChat()\">\n          \u041D\u043E\u0432\u044B\u0439&nbsp;\u0447\u0430\u0442\n        </button>\n      </div>\n    }\n  </div>\n</core-drawer>", styles: [".container{width:100%;display:flex}.container .chat-list{border:1px solid var(--PRIMARY);border-radius:4px 0 0 4px;width:35%;max-height:85vh;background:#fff;padding:10px 20px}.container .chat-list .chat-title{display:flex;justify-content:space-between}.container .chat-list .chat-title .chat-name{font-weight:500}.container .chat-list .chat-title .chat-date{font-size:.7rem;color:#000000b3}.container .chat-list .search-input{margin:24px}.sln-drawer-body-wrap{padding-bottom:10px}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}.sln-new-chat-btn{height:45px;display:flex;align-items:center;justify-content:center}.sln-drawer-header{width:100%;display:flex;align-items:center;padding:0 15px;border-bottom:2px solid var(--PRIMARY)}.sln-drawer-header form{width:100%}.sln-drawer-header .sln-new-chat-btn{width:110px}.sln-drawer-header core-field-string{width:100%}.sln-showEmptySearch{padding:10px 18px;text-align:center}.sln-showEmptySearch span{color:var(--DARK-GREY);font-family:var(--font-medium);margin-bottom:10px;display:block;font-size:17px}.newChat{margin-top:10px}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreDrawerComponent, selector: "core-drawer", inputs: ["name", "titleHeight", "footerHeight", "dialogTitle", "width", "minWidth", "hasTitle", "hasFooter", "goto"], outputs: ["reachedTopRun", "reachedBottomRun"] }, { kind: "component", type: CoreChatRoomComponent, selector: "core-chat-item", inputs: ["chat"] }, { kind: "component", type: CoreChatListMenuComponent, selector: "core-chat-list-menu" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreChatListDrawerComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-drawer [name]=\"name\" width=\"420\" hasFooter=\"false\" (reachedBottomRun)=\"onScroll($event)\">\n  <div title class=\"sln-drawer-header\">\n    <button (click)=\"closeDrawChat()\" class=\"sln-drawer-close\">\n      x\n    </button>\n    <form #roomSearchForm=\"ngForm\" novalidate>\n      <core-field-string [(ngModel)]=\"roomSearch\" name=\"roomSearch\" fieldName=\"roomSearch\"\n        placeholder=\"\u041F\u043E\u0438\u0441\u043A\" (valueChange)=\"onSearchChange($event)\"\n      [settings]=\"{ rightHintHide: true}\" class=\"sln-input-s\"></core-field-string>\n    </form>\n    <core-chat-list-menu></core-chat-list-menu>\n  </div>\n  <div body class=\"sln-drawer-body-wrap\">\n    @for (room of rooms; track room) {\n      <core-chat-item (click)=\"userSelected(room)\" [chat]=\"room\"></core-chat-item>\n    }\n    @if (showEmptySearch) {\n      <div class=\"sln-showEmptySearch\">\n        <span>\n          \u041F\u043E \u0437\u0430\u043F\u0440\u043E\u0441\u0443 \"{{ roomSearch }}\" \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E.\n        </span>\n        <button class=\"btn-primary sln-btn-light-s newChat\" (click)=\"newChat()\">\n          \u041D\u043E\u0432\u044B\u0439&nbsp;\u0447\u0430\u0442\n        </button>\n      </div>\n    }\n  </div>\n</core-drawer>", styles: [".container{width:100%;display:flex}.container .chat-list{border:1px solid var(--PRIMARY);border-radius:4px 0 0 4px;width:35%;max-height:85vh;background:#fff;padding:10px 20px}.container .chat-list .chat-title{display:flex;justify-content:space-between}.container .chat-list .chat-title .chat-name{font-weight:500}.container .chat-list .chat-title .chat-date{font-size:.7rem;color:#000000b3}.container .chat-list .search-input{margin:24px}.sln-drawer-body-wrap{padding-bottom:10px}.sln-drawer-close{background:var(--WHITE);border:none;cursor:pointer;border-radius:4px;text-transform:uppercase;letter-spacing:.2px;width:20px;height:20px;margin-right:10px}.sln-new-chat-btn{height:45px;display:flex;align-items:center;justify-content:center}.sln-drawer-header{width:100%;display:flex;align-items:center;padding:0 15px;border-bottom:2px solid var(--PRIMARY)}.sln-drawer-header form{width:100%}.sln-drawer-header .sln-new-chat-btn{width:110px}.sln-drawer-header core-field-string{width:100%}.sln-showEmptySearch{padding:10px 18px;text-align:center}.sln-showEmptySearch span{color:var(--DARK-GREY);font-family:var(--font-medium);margin-bottom:10px;display:block;font-size:17px}.newChat{margin-top:10px}\n"] }]
        }], ctorParameters: () => [{ type: EventBrokerService }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [CORE_DRAWER_DATA_TOKEN_KEY]
                }] }, { type: DrawerService }, { type: CoreChatService }, { type: PopupResults }] });

class CorePageTooltipVirtualAccountComponent extends CoreAbstractComponent {
    ngOnInit() {
        this.VA = this.data;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePageTooltipVirtualAccountComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CorePageTooltipVirtualAccountComponent, isStandalone: false, selector: "ng-component", inputs: { data: "data" }, usesInheritance: true, ngImport: i0, template: "<div class=\"sln-v-account-content\">\n    <span class=\"sln-VA-account\">{{ VA?.account }}</span><br />\n    <small><span class=\"sln-v-account-free\">\u0421\u0432\u043E\u0431\u043E\u0434\u043D\u043E:</span>{{ VA?.free | money }}\u0440\u0443\u0431.</small><br/>\n    <small><span class=\"sln-v-account-bloked\">\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043E:</span>{{ VA?.bloked | money }} \u0440\u0443\u0431.</small><br>\n</div>\n", styles: [".sln-v-account-content{text-align:center;padding:5px}.sln-v-account-content span,.sln-v-account-content small{color:var(--DARK-GREY);font-family:var(--font-medium)}.sln-v-account-content .sln-VA-account{color:var(--DARK-GREY);font-family:var(--font-bold)}.sln-v-account-content .sln-v-account-free{color:var(--SUCCESS);font-family:var(--font-bold);margin-right:5px}.sln-v-account-content .sln-v-account-bloked{color:var(--DANGER);margin-right:5px;font-family:var(--font-bold)}\n"], dependencies: [{ kind: "pipe", type: MoneyPipe, name: "money" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePageTooltipVirtualAccountComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<div class=\"sln-v-account-content\">\n    <span class=\"sln-VA-account\">{{ VA?.account }}</span><br />\n    <small><span class=\"sln-v-account-free\">\u0421\u0432\u043E\u0431\u043E\u0434\u043D\u043E:</span>{{ VA?.free | money }}\u0440\u0443\u0431.</small><br/>\n    <small><span class=\"sln-v-account-bloked\">\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043E:</span>{{ VA?.bloked | money }} \u0440\u0443\u0431.</small><br>\n</div>\n", styles: [".sln-v-account-content{text-align:center;padding:5px}.sln-v-account-content span,.sln-v-account-content small{color:var(--DARK-GREY);font-family:var(--font-medium)}.sln-v-account-content .sln-VA-account{color:var(--DARK-GREY);font-family:var(--font-bold)}.sln-v-account-content .sln-v-account-free{color:var(--SUCCESS);font-family:var(--font-bold);margin-right:5px}.sln-v-account-content .sln-v-account-bloked{color:var(--DANGER);margin-right:5px;font-family:var(--font-bold)}\n"] }]
        }], propDecorators: { data: [{
                type: Input
            }] } });

class CoreMenuSettingDialogWindow extends CoreBaseDestroyComponent {
    constructor(_dialogRef, data) {
        super();
        this._dialogRef = _dialogRef;
        this.data = data;
    }
    isSelectedRow(item) {
        return this.data.settings.items.find(x => x.id === item.recordId)?.hidden !== true;
    }
    getCheckboxName(item, index, level) {
        return `isSelectedRow_${item.recordId}_${level}_${index}`;
    }
    onSelectedChange(event, item, parent) {
        const array = [];
        if (parent) {
            // Если это подэлемент, добавляем его в массив
            array.push(item.recordId);
            // Рекурсивно добавляем все дочерние элементы
            this.addAllSubItems(item, array);
            if (event) {
                // При включении элемента включаем всех родителей вверх по иерархии
                this.addAllParents(item, array);
            }
        }
        else {
            // Если это элемент верхнего уровня, добавляем его и все подэлементы
            array.push(item.recordId);
            this.addAllSubItems(item, array);
        }
        // Обновляем настройки видимости
        array.forEach(x => {
            let settingsItem = this.data.settings.items.find(y => y.id === x);
            if (!settingsItem) {
                settingsItem = new UserMenuSettingsItem();
                settingsItem.id = x;
                settingsItem.hidden = !event;
                this.data.settings.items.push(settingsItem);
            }
            else {
                settingsItem.hidden = !event;
            }
        });
        // После обновления проверяем состояние всех родителей
        // Если у родителя все дочерние элементы отключены, отключаем и родителя
        this.syncParentsState();
    }
    addAllSubItems(item, array) {
        if (item.subMenuItems && item.subMenuItems.length > 0) {
            item.subMenuItems.forEach(subItem => {
                array.push(subItem.recordId);
                this.addAllSubItems(subItem, array);
            });
        }
    }
    shouldUpdateParent(parent) {
        if (!parent.subMenuItems || parent.subMenuItems.length === 0) {
            return false;
        }
        let hiddenCount = 0;
        parent.subMenuItems.forEach(x => {
            const isHidden = this.data.settings.items.find(y => y.id === x.recordId)?.hidden === true;
            if (isHidden) {
                hiddenCount++;
            }
        });
        return hiddenCount === parent.subMenuItems.length;
    }
    addAllParents(item, array) {
        // Находим родителя в дереве меню и добавляем его в массив
        const parent = this.findParentMenuItem(item.recordId, this.data.items);
        if (parent) {
            array.push(parent.recordId);
            // Рекурсивно добавляем родителей выше по иерархии
            this.addAllParents(parent, array);
        }
    }
    syncParentsState() {
        // Проходим по всем элементам меню и синхронизируем состояние родителей
        this.syncParentStateRecursive(this.data.items);
    }
    syncParentStateRecursive(items) {
        items.forEach(item => {
            if (item.subMenuItems && item.subMenuItems.length > 0) {
                // Сначала синхронизируем дочерние элементы
                this.syncParentStateRecursive(item.subMenuItems);
                // Проверяем, все ли дочерние элементы отключены
                const allChildrenHidden = item.subMenuItems.every(child => {
                    const settingsItem = this.data.settings.items.find(x => x.id === child.recordId);
                    return settingsItem?.hidden === true;
                });
                // Обновляем состояние родителя
                let parentSettingsItem = this.data.settings.items.find(x => x.id === item.recordId);
                if (!parentSettingsItem) {
                    parentSettingsItem = new UserMenuSettingsItem();
                    parentSettingsItem.id = item.recordId;
                    this.data.settings.items.push(parentSettingsItem);
                }
                parentSettingsItem.hidden = allChildrenHidden;
            }
        });
    }
    findParentMenuItem(childId, items) {
        for (const item of items) {
            if (item.subMenuItems && item.subMenuItems.length > 0) {
                // Проверяем, является ли текущий элемент непосредственным родителем
                if (item.subMenuItems.some(x => x.recordId === childId)) {
                    return item;
                }
                // Рекурсивно ищем в подэлементах
                const found = this.findParentMenuItem(childId, item.subMenuItems);
                if (found) {
                    return found;
                }
            }
        }
        return null;
    }
    save() {
        this.data.settings.isFull = false;
        this._dialogRef.close(this.data.settings);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreMenuSettingDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreMenuSettingDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u043C\u0435\u043D\u044E\" width=\"600\">\n  <div body>\n    <form #newForm=\"ngForm\" novalidate class=\"sln-menu-settings-dialog-form\">\n      <div class=\"row\">\n        <div class=\"col-md-12\">\n          <core-field-bool [(ngModel)]=\"data.settings.isViewTooltips\" name=\"isViewTooltips\" fieldName=\"isViewTooltips\" placeholder=\"\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0438\"\n          [settings]=\"{ mode: 'Slide'}\"></core-field-bool>\n        </div>\n      </div>\n      <div class=\"row\">\n        <ng-scrollbar style=\"height: 210px;\">\n          @for (item of data.items; track item; let i = $index) {\n            <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: item, level: 0, index: i, parent: null }\"></ng-container>\n          }\n        </ng-scrollbar>\n      </div>\n    </form>\n  </div>\n  <div footer>\n    <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newForm.invalid\">\n      \u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\n    </button>\n  </div>\n</core-dialog>\n\n<ng-template #menuItemTemplate let-item let-level=\"level\" let-index=\"index\" let-parent=\"parent\">\n  <div class=\"col-md-12 sln-menu-item\" [class.sln-sub-menu-item]=\"level > 0\" [style.margin-left.rem]=\"level * 1.2\">\n    <mat-checkbox\n      [ngModel]=\"isSelectedRow(item)\"\n      [name]=\"getCheckboxName(item, index, level)\"\n      class=\"sln-mat-checkbox\"\n      (ngModelChange)=\"onSelectedChange($event, item, parent)\">\n    </mat-checkbox>\n    {{ item.text }}\n  </div>\n  @if (item.subMenuItems && item.subMenuItems.length > 0) {\n    @for (subItem of item.subMenuItems; track subItem; let j = $index) {\n      <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: subItem, level: level + 1, index: j, parent: item }\"></ng-container>\n    }\n  }\n</ng-template>", styles: [".sln-menu-settings-dialog-form{display:flex;flex-direction:column;gap:10px}.sln-menu-item,.sln-mat-checkbox-text{color:var(--DARK-GREY);font-family:var(--font-medium)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "component", type: i3$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: 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: CoreMenuSettingDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u043C\u0435\u043D\u044E\" width=\"600\">\n  <div body>\n    <form #newForm=\"ngForm\" novalidate class=\"sln-menu-settings-dialog-form\">\n      <div class=\"row\">\n        <div class=\"col-md-12\">\n          <core-field-bool [(ngModel)]=\"data.settings.isViewTooltips\" name=\"isViewTooltips\" fieldName=\"isViewTooltips\" placeholder=\"\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0438\"\n          [settings]=\"{ mode: 'Slide'}\"></core-field-bool>\n        </div>\n      </div>\n      <div class=\"row\">\n        <ng-scrollbar style=\"height: 210px;\">\n          @for (item of data.items; track item; let i = $index) {\n            <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: item, level: 0, index: i, parent: null }\"></ng-container>\n          }\n        </ng-scrollbar>\n      </div>\n    </form>\n  </div>\n  <div footer>\n    <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newForm.invalid\">\n      \u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\n    </button>\n  </div>\n</core-dialog>\n\n<ng-template #menuItemTemplate let-item let-level=\"level\" let-index=\"index\" let-parent=\"parent\">\n  <div class=\"col-md-12 sln-menu-item\" [class.sln-sub-menu-item]=\"level > 0\" [style.margin-left.rem]=\"level * 1.2\">\n    <mat-checkbox\n      [ngModel]=\"isSelectedRow(item)\"\n      [name]=\"getCheckboxName(item, index, level)\"\n      class=\"sln-mat-checkbox\"\n      (ngModelChange)=\"onSelectedChange($event, item, parent)\">\n    </mat-checkbox>\n    {{ item.text }}\n  </div>\n  @if (item.subMenuItems && item.subMenuItems.length > 0) {\n    @for (subItem of item.subMenuItems; track subItem; let j = $index) {\n      <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: subItem, level: level + 1, index: j, parent: item }\"></ng-container>\n    }\n  }\n</ng-template>", styles: [".sln-menu-settings-dialog-form{display:flex;flex-direction:column;gap:10px}.sln-menu-item,.sln-mat-checkbox-text{color:var(--DARK-GREY);font-family:var(--font-medium)}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

const MENU_ITEMS_LOADED_KEY = 'MenuItemsLoaded';
const LAST_MENU_ITEM_LOADED_KEY = 'LastMenuItemLoaded';
const MENU_ITEMS_LOADED_EVENT = 'core-menu-items-loaded';
function saveMenuItemsToStorage(storage, items, eventBroker) {
    storage.setItem(MENU_ITEMS_LOADED_KEY, JSON.stringify(serializeMenuItems(items)));
    eventBroker?.emitDom(MENU_ITEMS_LOADED_EVENT, true);
}
function getMenuItemTitleForLastLoaded(storage) {
    const lastLoaded = storage.getItem(LAST_MENU_ITEM_LOADED_KEY);
    if (!lastLoaded) {
        return null;
    }
    const items = readStoredMenuItems(storage);
    if (!items?.length) {
        return null;
    }
    const found = findMenuItemByUrl(items, lastLoaded);
    return found?.text ?? null;
}
function serializeMenuItems(items) {
    return items.map(item => ({
        url: item.url,
        text: item.text,
        subMenuItems: item.subMenuItems?.length ? serializeMenuItems(item.subMenuItems) : undefined,
    }));
}
function readStoredMenuItems(storage) {
    try {
        const raw = storage.getItem(MENU_ITEMS_LOADED_KEY);
        if (!raw) {
            return null;
        }
        const parsed = JSON.parse(raw);
        return Array.isArray(parsed) ? parsed : null;
    }
    catch {
        return null;
    }
}
function findMenuItemByUrl(items, url) {
    for (const item of items) {
        if (item.url === url) {
            return item;
        }
        if (item.subMenuItems?.length) {
            const found = findMenuItemByUrl(item.subMenuItems, url);
            if (found) {
                return found;
            }
        }
    }
    return undefined;
}

class MiniDraftItem {
}

class MiniDraftService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    // Получение ссылки на клиента для которого формируется черновик
    customerLink(draft) {
        const url = this._startUp.apiRoot('actions/customer-link', 'bpm');
        return this._ajaxM.post({ url: url, data: draft });
    }
    // Сохранение мини-черновика
    saveMiniDraft(draft) {
        const url = this._startUp.apiRoot('actions/mini-draft', 'bpm');
        return this._ajaxM.post({ url: url, data: draft });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MiniDraftService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MiniDraftService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MiniDraftService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class CoreMiniDraftDialogWindow extends CoreBaseDestroyComponent {
    get session() {
        return this._cookieService.getTyped('user_session');
    }
    constructor(_dialogRef, data, _service, _router, _popupResults, _startup, _cookieService, _notificationSrv) {
        super();
        this._dialogRef = _dialogRef;
        this.data = data;
        this._service = _service;
        this._router = _router;
        this._popupResults = _popupResults;
        this._startup = _startup;
        this._cookieService = _cookieService;
        this._notificationSrv = _notificationSrv;
        this.hidden = true;
        this.item = new MiniDraftItem();
        this.current = this.session?.organizations?.currentLink;
    }
    getContainer() {
        return this.productTemplate;
    }
    async ngAfterViewInit() {
        if (this.data.remoteName && this.data.remoteExposedModule && this.data.remoteComponent) {
            await this.loadExternalWidget();
            return;
        }
    }
    async loadExternalWidget() {
        const miniDraftModule = await loadRemoteModule({
            remoteName: this.data.remoteName,
            exposedModule: this.data.remoteExposedModule
        });
        const component = this.getContainer().createComponent(miniDraftModule[this.data.remoteComponent]);
        component.instance.dataChange.pipe(this.takeUntilDestroyed()).subscribe((data) => {
            this.onDataChange(data);
        });
    }
    onDataChange($event) {
        this.item.templateData = JSON.stringify($event);
    }
    onSearchClick(data) {
        if (data) {
            if (this.current.detail.organizationInn === data.inn) {
                this._notificationSrv.showError("Вы не можете завести заявку как агент для самого себя");
                this.organizationSearch.clearSearch();
                this.item.customerInn = null;
                this.item.customerKpp = null;
            }
            else {
                this.item.customerInn = data.inn;
                this.item.customerKpp = data.kpp;
            }
        }
    }
    save($event) {
        ButtonLoadingService.run($event.target);
        if (this.data.mode === 1) {
            this.handleCustomerLink();
        }
        if (this.data.mode === 2) {
            this.handleSaveMiniDraft();
        }
    }
    createMiniDraftObject() {
        return {
            systemObjectId: this.data.systemObjectId,
            customerInn: this.item.customerInn,
            customerKpp: this.item.customerKpp,
            module: this.data.remoteExposedModule,
            templateData: this.item.templateData
        };
    }
    navigateToUrl(url) {
        if (this._startup.getByKey('APP_MODULE_NAME') === 'bpm') {
            this._router.navigate([url]);
        }
        else {
            window.location.href = this._startup.getByKey('APP_URL_BASE') + '/bpm' + url;
        }
    }
    handleResponse(entity, systemObjectId, urlSuffix) {
        this._dialogRef.close();
        const url = `/requests/${systemObjectId}/${urlSuffix}/${entity.id}`;
        this.navigateToUrl(url);
    }
    handleCustomerLink() {
        const miniDraft = this.createMiniDraftObject();
        this._service
            .customerLink(miniDraft)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popupResults.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.handleResponse(entity, miniDraft.systemObjectId, 'create');
            }
        }));
    }
    handleSaveMiniDraft() {
        const miniDraft = this.createMiniDraftObject();
        this._service
            .saveMiniDraft(miniDraft)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popupResults.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                this.handleResponse(entity, miniDraft.systemObjectId, 'request');
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreMiniDraftDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: MiniDraftService }, { token: i1$7.Router }, { token: PopupResults }, { token: Startup }, { token: BrowserLocalStorage }, { token: CoreNotificationService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreMiniDraftDialogWindow, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "productTemplate", first: true, predicate: ["productTemplate"], descendants: true, read: ViewContainerRef }, { propertyName: "organizationSearch", first: true, predicate: ["organizationSearch"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u044F\u0432\u043A\u0438\" width=\"700\">\n  <div body>\n    <form #newForm=\"ngForm\" novalidate>\n      @if (data.isBrokerSide) {\n        <div class=\"col-md-12\">\n          <label><span>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044E \u043A\u043B\u0438\u0435\u043D\u0442\u0430:</span></label>\n          <div class=\"form-group\">\n            <core-organization-search #organizationSearch (searchClick)=\"onSearchClick($event)\"></core-organization-search>\n            <core-field-inn [hidden]=\"true\" [(ngModel)]=\"item.customerInn\" name=\"customerInn\" fieldName=\"customerInn\" [settings]=\"{ isRequired: true }\"></core-field-inn>\n            <core-field-kpp [hidden]=\"true\" [(ngModel)]=\"item.customerKpp\" name=\"customerKpp\" fieldName=\"customerKpp\" [settings]=\"{ isRequired: item?.customerInn?.length === 10 }\"></core-field-kpp>\n          </div>\n        </div>\n      }\n      <ng-container #productTemplate></ng-container>\n    </form>\n  </div>\n  <div footer>\n    <button type=\"button\" class=\"btn-primary\" (click)=\"save($event)\" [disabled]=\"newForm.invalid\">\n      \u041D\u043E\u0432\u0430\u044F \u0437\u0430\u044F\u0432\u043A\u0430\n      <div [hidden]=\"true\" class=\"sln-progress-bar\"><mat-progress-bar mode=\"indeterminate\"></mat-progress-bar></div>\n    </button>\n  </div>\n</core-dialog>\n", styles: [".form-group{margin-top:12px}label{margin-bottom:10px;color:var(--DARK-GREY);font-size:15px;letter-spacing:.003em}.common-btn .mat-progress-bar{top:12px}form .col-md-12{padding:0 1px}.btn-primary{padding:0;width:140px;height:45px}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i6$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: CoreFieldInnComponent, selector: "core-field-inn" }, { kind: "component", type: CoreFieldKppComponent, selector: "core-field-kpp" }, { kind: "component", type: CoreOrganizationSearchComponent, selector: "core-organization-search", inputs: ["placeholder", "classes"], outputs: ["searchClick", "clearClick"] }, { kind: "component", type: 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: CoreMiniDraftDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u044F\u0432\u043A\u0438\" width=\"700\">\n  <div body>\n    <form #newForm=\"ngForm\" novalidate>\n      @if (data.isBrokerSide) {\n        <div class=\"col-md-12\">\n          <label><span>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044E \u043A\u043B\u0438\u0435\u043D\u0442\u0430:</span></label>\n          <div class=\"form-group\">\n            <core-organization-search #organizationSearch (searchClick)=\"onSearchClick($event)\"></core-organization-search>\n            <core-field-inn [hidden]=\"true\" [(ngModel)]=\"item.customerInn\" name=\"customerInn\" fieldName=\"customerInn\" [settings]=\"{ isRequired: true }\"></core-field-inn>\n            <core-field-kpp [hidden]=\"true\" [(ngModel)]=\"item.customerKpp\" name=\"customerKpp\" fieldName=\"customerKpp\" [settings]=\"{ isRequired: item?.customerInn?.length === 10 }\"></core-field-kpp>\n          </div>\n        </div>\n      }\n      <ng-container #productTemplate></ng-container>\n    </form>\n  </div>\n  <div footer>\n    <button type=\"button\" class=\"btn-primary\" (click)=\"save($event)\" [disabled]=\"newForm.invalid\">\n      \u041D\u043E\u0432\u0430\u044F \u0437\u0430\u044F\u0432\u043A\u0430\n      <div [hidden]=\"true\" class=\"sln-progress-bar\"><mat-progress-bar mode=\"indeterminate\"></mat-progress-bar></div>\n    </button>\n  </div>\n</core-dialog>\n", styles: [".form-group{margin-top:12px}label{margin-bottom:10px;color:var(--DARK-GREY);font-size:15px;letter-spacing:.003em}.common-btn .mat-progress-bar{top:12px}form .col-md-12{padding:0 1px}.btn-primary{padding:0;width:140px;height:45px}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: MiniDraftService }, { type: i1$7.Router }, { type: PopupResults }, { type: Startup }, { type: BrowserLocalStorage }, { type: CoreNotificationService }], propDecorators: { productTemplate: [{
                type: ViewChild,
                args: ["productTemplate", { read: ViewContainerRef }]
            }], organizationSearch: [{
                type: ViewChild,
                args: ['organizationSearch']
            }] } });

class CoreRigthMenuComponent extends CoreBaseDestroyComponent {
    constructor(_injector, cdRef, _el) {
        super();
        this._injector = _injector;
        this.cdRef = cdRef;
        this._el = _el;
        /** Меню развёрнуто при наведении на свёрнутую панель (sellan.core.page.html). */
        this.hoverExpanded = false;
        this.menuItemExpanded = new EventEmitter();
        this.menuItemCollapsed = new EventEmitter();
        this.menuItemSettingsUpdated = new EventEmitter();
        this._didAutoScrollToActiveItem = false;
        this._autoScrollAttempts = 0;
        this._storage = _injector.get(BrowserLocalStorage);
    }
    isSelectedMenuItem(menuItem) {
        const lastLoaded = this._storage.getItem(LAST_MENU_ITEM_LOADED_KEY);
        if (!lastLoaded)
            return false;
        return menuItem.url === lastLoaded;
    }
    onMenuItemClick(item) {
        this._storage.setItem(LAST_MENU_ITEM_LOADED_KEY, item.url);
        this.cdRef.detectChanges();
    }
    ngOnChanges(changes) {
        if (changes['hoverExpanded']?.currentValue === true && this.menuSettings?.isCollapse === false) {
            this._didAutoScrollToActiveItem = false;
            this._autoScrollAttempts = 0;
        }
        // На обновлении страницы нужно дождаться, пока входные данные отрисуются.
        if (this._didAutoScrollToActiveItem)
            return;
        if (!this.menuItems || this.menuItems.length === 0)
            return;
        if (!this._canAutoScrollToActiveItem())
            return;
        // menuSettings.items может приходить позже — даём небольшую задержку и пробуем ещё раз.
        this._scheduleAutoScrollToActiveItem();
    }
    ngAfterViewInit() {
        if (this._didAutoScrollToActiveItem)
            return;
        // При первом рендере (особенно когда inputs приходят “сразу”) прокручиваем сразу после отрисовки.
        this._scheduleAutoScrollToActiveItem();
    }
    _canAutoScrollToActiveItem() {
        return this.menuSettings?.isCollapse !== false || this.hoverExpanded === true;
    }
    _scheduleAutoScrollToActiveItem() {
        const lastLoaded = this._storage.getItem('LastMenuItemLoaded');
        if (!lastLoaded)
            return;
        if (!this._canAutoScrollToActiveItem())
            return;
        const delayMs = this.hoverExpanded && this.menuSettings?.isCollapse === false ? 350 : 150;
        // Чтобы mat-expansion-panel успел применить [expanded] и DOM отрисовался.
        setTimeout(() => {
            if (this._didAutoScrollToActiveItem)
                return;
            if (!this._canAutoScrollToActiveItem())
                return;
            this._autoScrollToActiveItem(lastLoaded);
        }, delayMs);
    }
    _autoScrollToActiveItem(lastLoadedUrl) {
        if (this._autoScrollAttempts >= 5)
            return;
        this._autoScrollAttempts++;
        const activeItem = this._findMenuItemByUrl(this.menuItems, lastLoadedUrl);
        if (!activeItem?.recordId)
            return;
        // Если активный пункт внутри свернутых accordion — разворачиваем родителей локально,
        // чтобы элемент реально появился в DOM/был видим.
        const path = this._findPathToMenuItemByUrl(this.menuItems, lastLoadedUrl);
        this._ensureExpandedForPath(path);
        this.cdRef.detectChanges();
        // Ждём применения [expanded] и стабилизации layout, затем плавно скроллим.
        requestAnimationFrame(() => {
            requestAnimationFrame(() => {
                const el = this._el.nativeElement.querySelector(`[data-menu-record-id="${activeItem.recordId}"]`);
                if (el) {
                    this._scrollElementIntoViewSmooth(el);
                    this._didAutoScrollToActiveItem = true;
                }
                else {
                    // Элемент ещё не отрисовался (например, из-за асинхронных изменений/accordion-анимаций).
                    this._scheduleAutoScrollToActiveItem();
                }
            });
        });
    }
    _scrollElementIntoViewSmooth(el) {
        const viewport = this._findMenuScrollViewport(el);
        if (!viewport) {
            el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' });
            return;
        }
        const viewportRect = viewport.getBoundingClientRect();
        const elRect = el.getBoundingClientRect();
        const targetTop = viewport.scrollTop + (elRect.top - viewportRect.top) - (viewportRect.height - elRect.height) / 2;
        const maxTop = Math.max(0, viewport.scrollHeight - viewport.clientHeight);
        const clampedTop = Math.min(maxTop, Math.max(0, targetTop));
        if (Math.abs(viewport.scrollTop - clampedTop) < 2) {
            return;
        }
        const startTop = viewport.scrollTop;
        const distance = clampedTop - startTop;
        const durationMs = 400;
        const startTime = performance.now();
        const easeInOutCubic = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
        const step = (now) => {
            const progress = Math.min((now - startTime) / durationMs, 1);
            viewport.scrollTop = startTop + distance * easeInOutCubic(progress);
            if (progress < 1) {
                requestAnimationFrame(step);
            }
        };
        requestAnimationFrame(step);
    }
    _findMenuScrollViewport(el) {
        let node = el.parentElement;
        while (node && node !== document.body) {
            if (node.classList.contains('ng-scroll-viewport') || node.classList.contains('ng-scrollbar-viewport')) {
                return node;
            }
            const { overflowY } = getComputedStyle(node);
            if ((overflowY === 'auto' || overflowY === 'scroll') && node.scrollHeight > node.clientHeight) {
                return node;
            }
            node = node.parentElement;
        }
        return null;
    }
    _findMenuItemByUrl(items, url) {
        for (const item of items ?? []) {
            if (item.url === url)
                return item;
            if (item.subMenuItems?.length) {
                const found = this._findMenuItemByUrl(item.subMenuItems, url);
                if (found)
                    return found;
            }
        }
        return null;
    }
    _findPathToMenuItemByUrl(items, url) {
        for (const item of items ?? []) {
            if (item.url === url)
                return [item];
            if (item.subMenuItems?.length) {
                const path = this._findPathToMenuItemByUrl(item.subMenuItems, url);
                if (path.length)
                    return [item, ...path];
            }
        }
        return [];
    }
    _ensureExpandedForPath(path) {
        if (!path?.length)
            return;
        for (const item of path) {
            // Для простых пунктов разворачивать не нужно — но для родителей accordion это важно.
            const hasChildren = item.subMenuItems?.length;
            if (!hasChildren)
                continue;
            const record = this.menuSettings.items.find(y => y.id === item.recordId);
            if (Utility.isEmpty(record)) {
                const settingsItem = new UserMenuSettingsItem();
                settingsItem.id = item.recordId;
                settingsItem.expanded = true;
                settingsItem.hidden = false;
                this.menuSettings.items.push(settingsItem);
            }
            else {
                record.expanded = true;
            }
            item.expanded = true;
        }
    }
    checkExpanded(item) {
        if (item.selected)
            return true;
        const record = this.menuSettings.items.find(y => y.id === item.recordId);
        if (!Utility.isEmpty(record)) {
            item.expanded = record.expanded;
        }
        return item.expanded;
    }
    onOpenedMenuPanel(item) {
        item.expanded = true;
        const record = this.menuSettings.items.find(y => y.id === item.recordId);
        const savedExpanded = record?.expanded === true;
        // Первый (init) event иногда приходит из-за биндинга [expanded] или auto-open по selected.
        // Игнорируем его только если состояние не изменилось относительно сохранённого.
        if (!item.expandedInit) {
            item.expandedInit = true;
            if (savedExpanded) {
                return;
            }
            // Если было сохранено "свернуто", а мы получили opened — считаем это реальным действием и сохраняем.
        }
        this._makeExpandedSetting(item);
        this.menuItemExpanded.emit(item);
    }
    onClosedMenuPanel(item) {
        item.expanded = false;
        const record = this.menuSettings.items.find(y => y.id === item.recordId);
        const savedExpanded = record?.expanded === true;
        if (!item.expandedInit) {
            item.expandedInit = true;
            if (!savedExpanded) {
                return;
            }
            // Если было сохранено "развёрнуто", а мы получили closed — считаем это реальным действием и сохраняем.
        }
        this._makeExpandedSetting(item);
        this.menuItemCollapsed.emit(item);
    }
    goToUrl(event, item) {
        event.stopPropagation();
        this.onMenuItemClick(item);
    }
    _makeExpandedSetting(item) {
        const record = this.menuSettings.items.find(y => y.id === item.recordId);
        if (Utility.isEmpty(record)) {
            var settingsItem = new UserMenuSettingsItem();
            settingsItem.id = item.recordId;
            settingsItem.expanded = item.expanded;
            settingsItem.hidden = false;
            this.menuSettings.items.push(settingsItem);
        }
        else {
            record.expanded = item.expanded;
        }
    }
    handleSubMenuItem(subMenuItems) {
        if (this.menuSettings.isFull) {
            return subMenuItems;
        }
        let needUpdateSettings = false;
        const filteredItems = subMenuItems.filter(item => {
            const settingsItem = this.menuSettings.items.find(x => x.id === item.recordId);
            // Если элемент является общим (isShared = true)
            if (item.settings?.isShared === true) {
                // Если нет явной настройки hidden
                if (Utility.isEmpty(settingsItem)) {
                    // Добавляем настройку с hidden = true (скрываем по умолчанию)
                    const newSettingsItem = new UserMenuSettingsItem();
                    newSettingsItem.id = item.recordId;
                    newSettingsItem.hidden = true;
                    newSettingsItem.expanded = false;
                    this.menuSettings.items.push(newSettingsItem);
                    needUpdateSettings = true;
                    return false; // Скрываем элемент
                }
                // Если есть явная настройка hidden = false, показываем элемент
                // Иначе (если hidden = true или не определен) скрываем
                return settingsItem.hidden === false;
            }
            // Для обычных элементов (не isShared) - показываем, если hidden !== true
            return settingsItem?.hidden !== true;
        });
        if (needUpdateSettings) {
            this.menuSettings.isFull = false;
            this.menuItemSettingsUpdated.emit(this.menuSettings);
        }
        return filteredItems;
    }
    createNew(event, item) {
        event.stopPropagation();
        if (this._injector.get(NotificationDetailService).stopNewRequestAction()) {
            return;
        }
        const roleId = this._injector.get(ContextService).session?.organizations?.currentLink?.detail.globalRoleId;
        if (Utility.isEmpty(item.settings?.miniDraftRemoteName) && roleId === RolesEnum.Consumer) {
            const startM = this._injector.get(Startup);
            if (startM.getByKey('APP_MODULE_NAME') === 'bpm') {
                window.location.href = startM.getByKey('APP_URL_BASE') + '/bpm' + item.url + '/create';
            }
            else {
                window.location.href = item.url + '/create';
            }
        }
        else {
            const urlArray = item.url.split('/');
            const systemObjectId = Number(urlArray[urlArray.length - 1]);
            const data = {
                systemObjectId: systemObjectId,
                isBrokerSide: roleId === RolesEnum.Broker,
                mode: Utility.isEmpty(item.settings?.miniDraftRemoteName) ? MiniDraftModeEnum.Classic : MiniDraftModeEnum.DraftInWindow,
                remoteName: item.settings.miniDraftRemoteName,
                remoteExposedModule: item.settings.miniDraftRemoteExposedModule,
                remoteComponent: item.settings.miniDraftRemoteComponent
            };
            CoreDialog.window(CoreMiniDraftDialogWindow, data);
        }
    }
    deleteMenuItem(event, item) {
        event.stopPropagation();
        const _userSettingService = this._injector.get(MenuService);
        const _popup = this._injector.get(PopupResults);
        _userSettingService
            .removeUserView(item.recordId)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => _popup.HandleIResponse({
            response: response,
            successCallback: () => {
                this._removeMenuItemRecursive(this.menuItems, item.recordId);
            }
        }));
    }
    /**
     * Рекурсивно удаляет элемент меню из многоуровневой структуры
     * @param items Массив элементов меню для поиска
     * @param userViewName Имя представления для удаления
     * @returns true если элемент был найден и удален
     */
    _removeMenuItemRecursive(items, recordId) {
        if (!items || items.length === 0) {
            return false;
        }
        // Поиск элемента на текущем уровне
        const index = items.findIndex(x => x.recordId === recordId);
        if (index > -1) {
            items.splice(index, 1);
            return true;
        }
        // Рекурсивный поиск во всех подпунктах
        for (const item of items) {
            if (item.subMenuItems && item.subMenuItems.length > 0) {
                if (this._removeMenuItemRecursive(item.subMenuItems, recordId)) {
                    return true;
                }
            }
        }
        return false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRigthMenuComponent, deps: [{ token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreRigthMenuComponent, isStandalone: false, selector: "core-rigth-menu", inputs: { menuItems: "menuItems", menuSettings: "menuSettings", showNewBtn: "showNewBtn", hoverExpanded: "hoverExpanded" }, outputs: { menuItemExpanded: "menuItemExpanded", menuItemCollapsed: "menuItemCollapsed", menuItemSettingsUpdated: "menuItemSettingsUpdated" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<!-- \u0428\u0430\u0431\u043B\u043E\u043D \u0434\u043B\u044F \u0431\u043B\u043E\u043A\u0430 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430 (block title) -->\n<ng-template #blockTitleTemplate let-item>\n  <div class=\"sln-menu-panel-header\">\n    <ul class=\"sln-ul-hover sln-menu-panel-block-title\">\n      <li class=\"sln-li-hover sln-menu-li-simple-icon\" [attr.data-menu-record-id]=\"item.recordId\"\n          [ngClass]=\"{'sln-selected-menu-item': isSelectedMenuItem(item)}\" [style.background-color]=\"(item.blockTitleBackgroundColor ? (item.blockTitleBackgroundColor + ' !important') : undefined)\">\n        <span class=\"nav-label {{item.icon}} sln-first-position-icon\" [ngClass]=\"{'active': isSelectedMenuItem(item)}\"></span>\n        <strong class=\"sln-item-text sln-item-text-title\" [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\">{{item.text}}</strong>\n      </li>\n    </ul>\n  </div>\n</ng-template>\n\n<!-- \u0420\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u044B\u0439 \u0448\u0430\u0431\u043B\u043E\u043D \u0434\u043B\u044F \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u043C\u0435\u043D\u044E -->\n<ng-template #menuItemTemplate let-item let-level=\"level\">\n  <li [class]=\"item.name\" [attr.data-level]=\"level\" [attr.data-menu-record-id]=\"item.recordId\">\n    <!-- \u042D\u043B\u0435\u043C\u0435\u043D\u0442 \u0441 \u043F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u0430\u043C\u0438 \u0438 isBlockTitle === true (\u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0441\u043A\u0440\u044B\u0442, \u0431\u0435\u0437 accordion) -->\n    @if (item.subMenuItems && item.subMenuItems.length > 0 && item.isBlockTitle === true) {\n      <div>\n        <ng-container *ngTemplateOutlet=\"blockTitleTemplate; context: { $implicit: item }\"></ng-container>\n        <!-- \u041F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u044B \u0432\u0441\u0435\u0433\u0434\u0430 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u044E\u0442\u0441\u044F -->\n        <ul class=\"nav nav-second-level\">\n          <div class=\"nav-second-level-list\">\n            @for (subItem of handleSubMenuItem(item.subMenuItems); track subItem) {\n              <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: subItem, level: level + 1 }\"></ng-container>\n            }\n          </div>\n        </ul>\n      </div>\n    }\n    <!-- \u042D\u043B\u0435\u043C\u0435\u043D\u0442 \u0441 \u043F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u0430\u043C\u0438 (accordion) \u0434\u043B\u044F \u043E\u0431\u044B\u0447\u043D\u044B\u0445 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 -->\n    @if (item.subMenuItems && item.subMenuItems.length > 0 && item.isBlockTitle !== true) {\n      <div class=\"sln-accordion\">\n        <mat-accordion>\n          <mat-expansion-panel #panel [expanded]=\"checkExpanded(item)\" (opened)=\"onOpenedMenuPanel(item)\" (closed)=\"onClosedMenuPanel(item)\">\n            @if (item.selected || (!menuSettings.isCollapse && item.expanded) ? panel.open() : false) {\n              <div></div>\n            }\n            <mat-expansion-panel-header class=\"sln-menu-panel-header\" [style.background-color]=\"(item.blockTitleBackgroundColor ? (item.blockTitleBackgroundColor + ' !important') : undefined)\" >\n              <mat-panel-title>\n                @if (item.settings.needNewBtn && showNewBtn) {\n                  <div (click)=\"createNew($event, item)\" class=\"sln-menu-plus sln-menu-plus-position\"></div>\n                }\n                <span class=\"nav-label {{item.icon}} sln-first-position-icon\" [ngClass]=\"item.expanded ? 'active' : ''\">\n                </span>\n                <p class=\"sln-item-text\" [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\">{{item.text}}</p>\n              </mat-panel-title>\n            </mat-expansion-panel-header>\n            <!-- \u0420\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u044B\u0439 \u0432\u044B\u0437\u043E\u0432 \u0434\u043B\u044F \u043F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u043E\u0432 -->\n            <ul class=\"nav nav-second-level\">\n              <div class=\"nav-second-level-list\">\n                @for (subItem of handleSubMenuItem(item.subMenuItems); track subItem) {\n                  <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: subItem, level: level + 1 }\"></ng-container>\n                }\n              </div>\n            </ul>\n          </mat-expansion-panel>\n        </mat-accordion>\n      </div>\n    }\n    <!-- \u042D\u043B\u0435\u043C\u0435\u043D\u0442 \u0431\u0435\u0437 \u043F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u043E\u0432 -->\n    @if (!item.subMenuItems || item.subMenuItems.length === 0) {\n      <div class=\"sln-accordion\">\n        @if (item.isBlockTitle === true) {\n          <ng-container *ngTemplateOutlet=\"blockTitleTemplate; context: { $implicit: item }\"></ng-container>\n        }\n        @if (item.isBlockTitle !== true) {\n          <div [ngClass]=\"{'sln-left-li': level > 0}\">\n            @if (level === 0) {\n              <ul class=\"sln-ul-hover\">\n                <li class=\"sln-li-hover sln-menu-li-simple-icon\" [ngClass]=\"{'sln-selected-menu-item': isSelectedMenuItem(item)}\" [style.background-color]=\"(item.blockTitleBackgroundColor ? (item.blockTitleBackgroundColor + ' !important') : undefined)\">\n                  @if (item.isDirect !== true) {\n                    <a routerLink=\"{{item.url}}\" (click)=\"onMenuItemClick(item)\" class=\"sln-menu-li-simple-icon-link\">\n                      <span class=\"nav-label {{item.icon}} sln-first-position-icon\" [ngClass]=\"{'active': isSelectedMenuItem(item)}\"></span>\n                      <p class=\"sln-item-text\" [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\">{{item.text}}</p>\n                    </a>\n                  }\n                  @if (item.isDirect === true) {\n                    <a [attr.href]=\"item.url\" (click)=\"goToUrl($event, item)\" class=\"sln-menu-li-simple-icon-link\">\n                      <span class=\"nav-label {{item.icon}} sln-first-position-icon\" [ngClass]=\"{'active': isSelectedMenuItem(item)}\"></span>\n                      <p class=\"sln-item-text\" [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\">{{item.text}}</p>\n                    </a>\n                  }\n                </li>\n              </ul>\n            }\n            @if (level > 0) {\n              <div class=\"sln-menu-sub-item-block\" [ngClass]=\"{'sln-selected-menu-item': isSelectedMenuItem(item)}\" [style.background-color]=\"(item.blockTitleBackgroundColor ? (item.blockTitleBackgroundColor + ' !important') : undefined)\">\n                @if (item.settings.needNewBtn && showNewBtn) {\n                  <div (click)=\"createNew($event, item)\" class=\"sln-menu-plus sln-menu-plus-position\"></div>\n                }\n                <div class=\"sln-first-position-icon\" [ngClass]=\"item.icon\"></div>\n                <div [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\">\n                  @if (item.isDirect !== true) {\n                    <a routerLink=\"{{item.url}}\" (click)=\"onMenuItemClick(item)\" class=\"sln-menu-numbers\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\" >\n                      {{item.text}}\n                    </a>\n                  }\n                  @if (item.isDirect === true) {\n                    <a [attr.href]=\"item.url\" (click)=\"goToUrl($event, item)\" class=\"sln-menu-numbers\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\" >\n                      {{item.text}}\n                    </a>\n                  }\n                </div>\n                @if (item.settings?.needNotification === true) {\n                  <span class=\"sln-badge-primary sln-menu-numbers-view\">\n                    {{ item.settings?.notificationCount ?? 0 }}\n                  </span>\n                }\n                @if (item.settings?.canDeleteView) {\n                  <div (click)=\"deleteMenuItem($event, item)\" class=\"sln-common-action-delete sln-common-action-delete-position sln-menu-user-view-name-delete\"></div>\n                }\n              </div>\n            }\n          </div>\n        }\n      </div>\n    }\n  </li>\n</ng-template>\n\n<!-- \u041E\u0441\u043D\u043E\u0432\u043D\u043E\u0439 \u0441\u043F\u0438\u0441\u043E\u043A \u043C\u0435\u043D\u044E -->\n<ul class=\"nav metismenu\" id=\"side-menu\">\n  @for (item of menuItems; track item) {\n    <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: item, level: 0 }\"></ng-container>\n  }\n</ul>\n\n", styles: [".sln-menu-sub-item-block{display:flex;align-items:center;justify-content:flex-start;gap:5px;width:100%;padding:0 22px}.sln-menu-numbers{display:flex;justify-content:space-between;width:100%;align-items:center}.sln-menu-numbers span{color:var(--GRAY);font-size:14px;font-family:var(--font-bold)}.sln-left-li{height:56px;position:relative;display:flex;align-items:center;padding:0;cursor:pointer}.sln-left-li a{text-decoration:none!important}.sln-left-li .sln-menu-numbers-view{display:flex}.sln-left-li .sln-menu-user-view-name-delete{position:absolute;right:10px;display:none}.sln-left-li img{width:20px}.sln-left-li span .nav{width:100%;padding-left:0;margin-bottom:0;list-style:none}.sln-left-li span .nav mat-accordion{width:100%}.sln-left-li:hover{position:relative}.sln-left-li:hover .sln-menu-numbers-view{display:none}.sln-left-li:hover .sln-menu-user-view-name-delete{display:block}.nav-label p{text-transform:uppercase;margin:0 0 0 5px;text-decoration:none}.sln-li-hover{height:54px}.sln-li-hover{display:flex;align-items:center}.sln-li-hover.sln-menu-li-simple-icon{padding-left:24px}.sln-menu-li-simple-icon-link{display:flex;align-items:center;flex:1;width:100%;min-height:54px;text-decoration:none!important;color:inherit;cursor:pointer;box-sizing:border-box}.sln-li-hover:hover.sln-menu-li-simple-icon{background:#f5f5f5}.sln-li-hover .nav-label{font-size:11px;text-transform:uppercase;text-decoration:none}.nav-second-level-list li{color:var(--GRAY);font-size:14px}.nav-second-level-list li a{overflow-wrap:anywhere;min-height:54px;width:200px;padding-right:5px}.nav-second-level-list .sln-left-li{position:relative}li[data-level=\"3\"] .sln-menu-sub-item-block,li[data-level=\"4\"] .sln-menu-sub-item-block,li[data-level=\"5\"] .sln-menu-sub-item-block{padding-left:24px}li[data-level=\"3\"] .sln-menu-sub-item-block{margin-left:7px}li[data-level=\"4\"] .sln-menu-sub-item-block{margin-left:13px}li[data-level=\"5\"] .sln-menu-sub-item-block{margin-left:19px}.nav-nested-level{margin-left:1rem}.nav-nested-level-list li{padding:0 5px 0 52px;color:var(--GRAY);font-size:14px}.nav-nested-level-list li a{text-decoration:none;text-transform:uppercase;padding:0 10px;height:100%}.nav-nested-level-list .sln-left-li{position:relative}.nav-nested-level .mat-expansion-panel-header{padding-left:24px!important}.mat-expansion-panel-header.sln-left-li .mat-expansion-panel-header-title{display:flex;align-items:center;width:100%}.mat-expansion-panel-header.sln-left-li .mat-expansion-panel-header-title .sln-first-position-icon{margin-right:10px}.mat-expansion-panel-header.sln-left-li .mat-expansion-panel-header-title .sln-menu-numbers{flex:1}.nav-nested-level-list .mat-accordion{width:100%}.nav-nested-level-list .mat-expansion-panel{box-shadow:none!important}.mat-expansion-panel-header{position:relative;height:54px!important;background:var(--WHITE)}.mat-expansion-panel{border-radius:0}.mat-expansion-panel-header-title{align-items:center}#side-menu{height:100%}#side-menu img{width:25px;background:transparent}#side-menu .sln-change-delete{width:20px;background:transparent;position:absolute;left:0}.sln-menu-panel-block-title{cursor:auto;color:var(--DARK-GREY)}.sln-menu-panel-header:hover:before{content:\"\";position:absolute;left:0;border-left:4px solid var(--PRIMARY);height:54px}.sln-menu-panel-header:hover p{color:var(--PRIMARY)}.sln-ul-hover.sln-menu-li-simple-icon{padding-left:0}.sln-ul-hover:hover .sln-menu-li-simple-icon{background:#f5f5f5}.mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none!important}.mat-accordion .mat-expansion-panel:last-of-type,.mat-accordion .mat-expansion-panel:first-of-type{border-radius:0!important}.sln-menu-plus{position:absolute;right:15px}.sln-menu-plus-position{background-repeat:no-repeat;background-position:center;background-size:9px;height:25px;width:25px;cursor:pointer;border-radius:8px;border:2px solid rgba(52,105,244,.7411764706)}.sln-menu-plus-position:hover{background-color:#346af40a;border:2px solid var(--PRIMARY)}.mat-expansion-panel-header:hover .sln-menu-plus{transition:.3s ease;right:4px;clip-path:inset(0% 0% 0% 0%)}.mat-expansion-panel:not(.mat-expanded) .nav-second-level .sln-menu-plus{display:none!important}.mat-focus-indicator{position:initial!important;outline:none}.mat-focus-indicator:focus{outline:none}.sln-ul-hover{width:100%}.sln-ul-hover:hover{background-color:var(--LIGHT-GRAY)!important}.sln-ul-hover:hover .sln-factoring-settings-text,.sln-ul-hover:hover .sln-item-text{color:var(--BLACK)}.sln-ul-hover:hover:before{left:-5px!important}.sln-ul-hover:hover{background:none!important}.sln-ul-hover:hover .sln-item-text{color:var(--PRIMARY)}.sln-ul-hover:hover:before{content:\"\";border-left:4px solid var(--PRIMARY)!important;position:absolute;height:54px;left:0;z-index:2}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$7.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i3.MatAccordion, selector: "mat-accordion", inputs: ["hideToggle", "displayMode", "togglePosition"], exportAs: ["matAccordion"] }, { kind: "component", type: i3.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i3.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i3.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRigthMenuComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-rigth-menu', standalone: false, template: "<!-- \u0428\u0430\u0431\u043B\u043E\u043D \u0434\u043B\u044F \u0431\u043B\u043E\u043A\u0430 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430 (block title) -->\n<ng-template #blockTitleTemplate let-item>\n  <div class=\"sln-menu-panel-header\">\n    <ul class=\"sln-ul-hover sln-menu-panel-block-title\">\n      <li class=\"sln-li-hover sln-menu-li-simple-icon\" [attr.data-menu-record-id]=\"item.recordId\"\n          [ngClass]=\"{'sln-selected-menu-item': isSelectedMenuItem(item)}\" [style.background-color]=\"(item.blockTitleBackgroundColor ? (item.blockTitleBackgroundColor + ' !important') : undefined)\">\n        <span class=\"nav-label {{item.icon}} sln-first-position-icon\" [ngClass]=\"{'active': isSelectedMenuItem(item)}\"></span>\n        <strong class=\"sln-item-text sln-item-text-title\" [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\">{{item.text}}</strong>\n      </li>\n    </ul>\n  </div>\n</ng-template>\n\n<!-- \u0420\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u044B\u0439 \u0448\u0430\u0431\u043B\u043E\u043D \u0434\u043B\u044F \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u043C\u0435\u043D\u044E -->\n<ng-template #menuItemTemplate let-item let-level=\"level\">\n  <li [class]=\"item.name\" [attr.data-level]=\"level\" [attr.data-menu-record-id]=\"item.recordId\">\n    <!-- \u042D\u043B\u0435\u043C\u0435\u043D\u0442 \u0441 \u043F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u0430\u043C\u0438 \u0438 isBlockTitle === true (\u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0441\u043A\u0440\u044B\u0442, \u0431\u0435\u0437 accordion) -->\n    @if (item.subMenuItems && item.subMenuItems.length > 0 && item.isBlockTitle === true) {\n      <div>\n        <ng-container *ngTemplateOutlet=\"blockTitleTemplate; context: { $implicit: item }\"></ng-container>\n        <!-- \u041F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u044B \u0432\u0441\u0435\u0433\u0434\u0430 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u044E\u0442\u0441\u044F -->\n        <ul class=\"nav nav-second-level\">\n          <div class=\"nav-second-level-list\">\n            @for (subItem of handleSubMenuItem(item.subMenuItems); track subItem) {\n              <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: subItem, level: level + 1 }\"></ng-container>\n            }\n          </div>\n        </ul>\n      </div>\n    }\n    <!-- \u042D\u043B\u0435\u043C\u0435\u043D\u0442 \u0441 \u043F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u0430\u043C\u0438 (accordion) \u0434\u043B\u044F \u043E\u0431\u044B\u0447\u043D\u044B\u0445 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 -->\n    @if (item.subMenuItems && item.subMenuItems.length > 0 && item.isBlockTitle !== true) {\n      <div class=\"sln-accordion\">\n        <mat-accordion>\n          <mat-expansion-panel #panel [expanded]=\"checkExpanded(item)\" (opened)=\"onOpenedMenuPanel(item)\" (closed)=\"onClosedMenuPanel(item)\">\n            @if (item.selected || (!menuSettings.isCollapse && item.expanded) ? panel.open() : false) {\n              <div></div>\n            }\n            <mat-expansion-panel-header class=\"sln-menu-panel-header\" [style.background-color]=\"(item.blockTitleBackgroundColor ? (item.blockTitleBackgroundColor + ' !important') : undefined)\" >\n              <mat-panel-title>\n                @if (item.settings.needNewBtn && showNewBtn) {\n                  <div (click)=\"createNew($event, item)\" class=\"sln-menu-plus sln-menu-plus-position\"></div>\n                }\n                <span class=\"nav-label {{item.icon}} sln-first-position-icon\" [ngClass]=\"item.expanded ? 'active' : ''\">\n                </span>\n                <p class=\"sln-item-text\" [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\">{{item.text}}</p>\n              </mat-panel-title>\n            </mat-expansion-panel-header>\n            <!-- \u0420\u0435\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u044B\u0439 \u0432\u044B\u0437\u043E\u0432 \u0434\u043B\u044F \u043F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u043E\u0432 -->\n            <ul class=\"nav nav-second-level\">\n              <div class=\"nav-second-level-list\">\n                @for (subItem of handleSubMenuItem(item.subMenuItems); track subItem) {\n                  <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: subItem, level: level + 1 }\"></ng-container>\n                }\n              </div>\n            </ul>\n          </mat-expansion-panel>\n        </mat-accordion>\n      </div>\n    }\n    <!-- \u042D\u043B\u0435\u043C\u0435\u043D\u0442 \u0431\u0435\u0437 \u043F\u043E\u0434\u043F\u0443\u043D\u043A\u0442\u043E\u0432 -->\n    @if (!item.subMenuItems || item.subMenuItems.length === 0) {\n      <div class=\"sln-accordion\">\n        @if (item.isBlockTitle === true) {\n          <ng-container *ngTemplateOutlet=\"blockTitleTemplate; context: { $implicit: item }\"></ng-container>\n        }\n        @if (item.isBlockTitle !== true) {\n          <div [ngClass]=\"{'sln-left-li': level > 0}\">\n            @if (level === 0) {\n              <ul class=\"sln-ul-hover\">\n                <li class=\"sln-li-hover sln-menu-li-simple-icon\" [ngClass]=\"{'sln-selected-menu-item': isSelectedMenuItem(item)}\" [style.background-color]=\"(item.blockTitleBackgroundColor ? (item.blockTitleBackgroundColor + ' !important') : undefined)\">\n                  @if (item.isDirect !== true) {\n                    <a routerLink=\"{{item.url}}\" (click)=\"onMenuItemClick(item)\" class=\"sln-menu-li-simple-icon-link\">\n                      <span class=\"nav-label {{item.icon}} sln-first-position-icon\" [ngClass]=\"{'active': isSelectedMenuItem(item)}\"></span>\n                      <p class=\"sln-item-text\" [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\">{{item.text}}</p>\n                    </a>\n                  }\n                  @if (item.isDirect === true) {\n                    <a [attr.href]=\"item.url\" (click)=\"goToUrl($event, item)\" class=\"sln-menu-li-simple-icon-link\">\n                      <span class=\"nav-label {{item.icon}} sln-first-position-icon\" [ngClass]=\"{'active': isSelectedMenuItem(item)}\"></span>\n                      <p class=\"sln-item-text\" [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\">{{item.text}}</p>\n                    </a>\n                  }\n                </li>\n              </ul>\n            }\n            @if (level > 0) {\n              <div class=\"sln-menu-sub-item-block\" [ngClass]=\"{'sln-selected-menu-item': isSelectedMenuItem(item)}\" [style.background-color]=\"(item.blockTitleBackgroundColor ? (item.blockTitleBackgroundColor + ' !important') : undefined)\">\n                @if (item.settings.needNewBtn && showNewBtn) {\n                  <div (click)=\"createNew($event, item)\" class=\"sln-menu-plus sln-menu-plus-position\"></div>\n                }\n                <div class=\"sln-first-position-icon\" [ngClass]=\"item.icon\"></div>\n                <div [matTooltip]=\"(menuSettings.isViewTooltips === true ? item.tooltip : undefined)\">\n                  @if (item.isDirect !== true) {\n                    <a routerLink=\"{{item.url}}\" (click)=\"onMenuItemClick(item)\" class=\"sln-menu-numbers\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\" >\n                      {{item.text}}\n                    </a>\n                  }\n                  @if (item.isDirect === true) {\n                    <a [attr.href]=\"item.url\" (click)=\"goToUrl($event, item)\" class=\"sln-menu-numbers\" [style.color]=\"(item.blockTitleForegroundColor ? (item.blockTitleForegroundColor + ' !important') : undefined)\" >\n                      {{item.text}}\n                    </a>\n                  }\n                </div>\n                @if (item.settings?.needNotification === true) {\n                  <span class=\"sln-badge-primary sln-menu-numbers-view\">\n                    {{ item.settings?.notificationCount ?? 0 }}\n                  </span>\n                }\n                @if (item.settings?.canDeleteView) {\n                  <div (click)=\"deleteMenuItem($event, item)\" class=\"sln-common-action-delete sln-common-action-delete-position sln-menu-user-view-name-delete\"></div>\n                }\n              </div>\n            }\n          </div>\n        }\n      </div>\n    }\n  </li>\n</ng-template>\n\n<!-- \u041E\u0441\u043D\u043E\u0432\u043D\u043E\u0439 \u0441\u043F\u0438\u0441\u043E\u043A \u043C\u0435\u043D\u044E -->\n<ul class=\"nav metismenu\" id=\"side-menu\">\n  @for (item of menuItems; track item) {\n    <ng-container *ngTemplateOutlet=\"menuItemTemplate; context: { $implicit: item, level: 0 }\"></ng-container>\n  }\n</ul>\n\n", styles: [".sln-menu-sub-item-block{display:flex;align-items:center;justify-content:flex-start;gap:5px;width:100%;padding:0 22px}.sln-menu-numbers{display:flex;justify-content:space-between;width:100%;align-items:center}.sln-menu-numbers span{color:var(--GRAY);font-size:14px;font-family:var(--font-bold)}.sln-left-li{height:56px;position:relative;display:flex;align-items:center;padding:0;cursor:pointer}.sln-left-li a{text-decoration:none!important}.sln-left-li .sln-menu-numbers-view{display:flex}.sln-left-li .sln-menu-user-view-name-delete{position:absolute;right:10px;display:none}.sln-left-li img{width:20px}.sln-left-li span .nav{width:100%;padding-left:0;margin-bottom:0;list-style:none}.sln-left-li span .nav mat-accordion{width:100%}.sln-left-li:hover{position:relative}.sln-left-li:hover .sln-menu-numbers-view{display:none}.sln-left-li:hover .sln-menu-user-view-name-delete{display:block}.nav-label p{text-transform:uppercase;margin:0 0 0 5px;text-decoration:none}.sln-li-hover{height:54px}.sln-li-hover{display:flex;align-items:center}.sln-li-hover.sln-menu-li-simple-icon{padding-left:24px}.sln-menu-li-simple-icon-link{display:flex;align-items:center;flex:1;width:100%;min-height:54px;text-decoration:none!important;color:inherit;cursor:pointer;box-sizing:border-box}.sln-li-hover:hover.sln-menu-li-simple-icon{background:#f5f5f5}.sln-li-hover .nav-label{font-size:11px;text-transform:uppercase;text-decoration:none}.nav-second-level-list li{color:var(--GRAY);font-size:14px}.nav-second-level-list li a{overflow-wrap:anywhere;min-height:54px;width:200px;padding-right:5px}.nav-second-level-list .sln-left-li{position:relative}li[data-level=\"3\"] .sln-menu-sub-item-block,li[data-level=\"4\"] .sln-menu-sub-item-block,li[data-level=\"5\"] .sln-menu-sub-item-block{padding-left:24px}li[data-level=\"3\"] .sln-menu-sub-item-block{margin-left:7px}li[data-level=\"4\"] .sln-menu-sub-item-block{margin-left:13px}li[data-level=\"5\"] .sln-menu-sub-item-block{margin-left:19px}.nav-nested-level{margin-left:1rem}.nav-nested-level-list li{padding:0 5px 0 52px;color:var(--GRAY);font-size:14px}.nav-nested-level-list li a{text-decoration:none;text-transform:uppercase;padding:0 10px;height:100%}.nav-nested-level-list .sln-left-li{position:relative}.nav-nested-level .mat-expansion-panel-header{padding-left:24px!important}.mat-expansion-panel-header.sln-left-li .mat-expansion-panel-header-title{display:flex;align-items:center;width:100%}.mat-expansion-panel-header.sln-left-li .mat-expansion-panel-header-title .sln-first-position-icon{margin-right:10px}.mat-expansion-panel-header.sln-left-li .mat-expansion-panel-header-title .sln-menu-numbers{flex:1}.nav-nested-level-list .mat-accordion{width:100%}.nav-nested-level-list .mat-expansion-panel{box-shadow:none!important}.mat-expansion-panel-header{position:relative;height:54px!important;background:var(--WHITE)}.mat-expansion-panel{border-radius:0}.mat-expansion-panel-header-title{align-items:center}#side-menu{height:100%}#side-menu img{width:25px;background:transparent}#side-menu .sln-change-delete{width:20px;background:transparent;position:absolute;left:0}.sln-menu-panel-block-title{cursor:auto;color:var(--DARK-GREY)}.sln-menu-panel-header:hover:before{content:\"\";position:absolute;left:0;border-left:4px solid var(--PRIMARY);height:54px}.sln-menu-panel-header:hover p{color:var(--PRIMARY)}.sln-ul-hover.sln-menu-li-simple-icon{padding-left:0}.sln-ul-hover:hover .sln-menu-li-simple-icon{background:#f5f5f5}.mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none!important}.mat-accordion .mat-expansion-panel:last-of-type,.mat-accordion .mat-expansion-panel:first-of-type{border-radius:0!important}.sln-menu-plus{position:absolute;right:15px}.sln-menu-plus-position{background-repeat:no-repeat;background-position:center;background-size:9px;height:25px;width:25px;cursor:pointer;border-radius:8px;border:2px solid rgba(52,105,244,.7411764706)}.sln-menu-plus-position:hover{background-color:#346af40a;border:2px solid var(--PRIMARY)}.mat-expansion-panel-header:hover .sln-menu-plus{transition:.3s ease;right:4px;clip-path:inset(0% 0% 0% 0%)}.mat-expansion-panel:not(.mat-expanded) .nav-second-level .sln-menu-plus{display:none!important}.mat-focus-indicator{position:initial!important;outline:none}.mat-focus-indicator:focus{outline:none}.sln-ul-hover{width:100%}.sln-ul-hover:hover{background-color:var(--LIGHT-GRAY)!important}.sln-ul-hover:hover .sln-factoring-settings-text,.sln-ul-hover:hover .sln-item-text{color:var(--BLACK)}.sln-ul-hover:hover:before{left:-5px!important}.sln-ul-hover:hover{background:none!important}.sln-ul-hover:hover .sln-item-text{color:var(--PRIMARY)}.sln-ul-hover:hover:before{content:\"\";border-left:4px solid var(--PRIMARY)!important;position:absolute;height:54px;left:0;z-index:2}\n"] }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { menuItems: [{
                type: Input
            }], menuSettings: [{
                type: Input
            }], showNewBtn: [{
                type: Input
            }], hoverExpanded: [{
                type: Input
            }], menuItemExpanded: [{
                type: Output
            }], menuItemCollapsed: [{
                type: Output
            }], menuItemSettingsUpdated: [{
                type: Output
            }] } });

class SortLinksPipe {
    transform(value) {
        return value.sort((a, b) => {
            if (a.detail.organizationName < b.detail.organizationName) {
                return -1;
            }
            if (a.detail.organizationName > b.detail.organizationName) {
                return 1;
            }
            return 0;
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SortLinksPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: SortLinksPipe, isStandalone: false, name: "sortLinks" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SortLinksPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'sortLinks',
                    standalone: false
                }]
        }] });

class CorePage extends CoreBaseDestroyComponent {
    get menuItems() {
        return this.menuSettings.isFull ? this._menuItems : this._menuItems.filter(item => this.menuSettings.items.find(x => x.id === item.recordId)?.hidden !== true);
    }
    handleSubMenuItem(subMenuItems) {
        return this.menuSettings.isFull
            ? subMenuItems
            : subMenuItems.filter(item => this.menuSettings.items.find(x => x.id === item.recordId)?.hidden !== true);
    }
    // текущая сессия пользователя
    get session() {
        return this._contextService.session;
    }
    get haveMessageChat() {
        return this._pageService.haveNewChatMessage;
    }
    get userCardUrl() {
        if (this.session) {
            const folder = Utility.isEmpty(this._startM.webSubfolder()) ? '' : '../main/';
            return folder + 'users/' + this.session.userId + '?personId=' + this.session.personId;
        }
        return '#';
    }
    get organizationCardUrl() {
        if (this.session?.organizations) {
            const folder = Utility.isEmpty(this._startM.webSubfolder()) ? '' : '../main/';
            return folder + 'organizations/' + this.session.organizations.currentLink?.organizationId;
        }
        return '#';
    }
    get accountCardUrl() {
        if (this.session) {
            const folder = Utility.isEmpty(this._startM.webSubfolder()) ? '' : '../financial/';
            return folder + 'accounts/' + this.VM.Setting?.virtualAccount?.account;
        }
        return '#';
    }
    get notificationSubsCardUrl() {
        if (this.session) {
            const folder = Utility.isEmpty(this._startM.webSubfolder()) ? '' : '../notification/';
            return folder + 'subscriptions/my';
        }
        return '#';
    }
    get organizationLinks() {
        const distinctBy = (arr, keySelector) => {
            const seen = new Set();
            return arr.filter(item => {
                const key = keySelector(item);
                if (!seen.has(key)) {
                    seen.add(key);
                    return true;
                }
                return false;
            });
        };
        const links = this.session?.organizations.linkItems;
        if (!links)
            return null;
        const res = distinctBy(links, link => `${link.detail.organizationInn}_${link.detail.globalRoleId}`);
        return res;
    }
    get showNewBtn() {
        const roleId = this.session?.organizations?.currentLink?.detail?.globalRoleId;
        return roleId === RolesEnum.Broker || roleId === RolesEnum.Consumer;
    }
    constructor(_injector, _contextService, _router, _popup, _userSettingSrv, _pageService, _startM) {
        super();
        this._injector = _injector;
        this._contextService = _contextService;
        this._router = _router;
        this._popup = _popup;
        this._userSettingSrv = _userSettingSrv;
        this._pageService = _pageService;
        this._startM = _startM;
        this.virtualAccountTooltipComponentType = CorePageTooltipVirtualAccountComponent;
        // меню доступное для текущей сессии пользователя
        this._menuItems = [];
        // флаг наведения на элемент меню
        this.hoverMenu = false;
        // отображение данных о технической поддержки
        this.isShowSupportInfo = false;
        this.VM = _injector.get(VisualSettingManager);
        this._storage = _injector.get(BrowserLocalStorage);
        this._eventBroker = _injector.get(EventBrokerService);
        this._authService = _injector.get(AuthorizationService);
        this.menuSettings = new UserMenuSettings();
        // регистрируем при формировании страницы массив делегатов для события onresize
        if (!window.ResizeDelegats) {
            window.ResizeDelegats = new Array();
        }
        // добавляем делегата на изменение меню
        window.ResizeDelegats.push(() => {
            _injector.get(NgZone).run(() => {
                this.menuHeight = undefined;
            });
        });
        // подписка на событие
        window.onresize = () => {
            if (window.ResizeDelegats) {
                window.ResizeDelegats.forEach((resizeDelegat) => {
                    resizeDelegat();
                });
            }
        };
        this._routerSubscription = this._router.events
            .pipe(filter(event => event instanceof NavigationStart || event instanceof NavigationEnd))
            .subscribe((event) => {
            const url = decodeURI(event.url);
            console.log('url', event);
            console.log('url', url);
            if (event instanceof NavigationStart) {
                if (event.navigationTrigger === 'popstate') {
                    // начался переход назад
                    this._storage.setItem(LAST_MENU_ITEM_LOADED_KEY, url);
                }
            }
            if (event instanceof NavigationEnd) {
                if (url === '/') {
                    this._storage.setItem(LAST_MENU_ITEM_LOADED_KEY, '/dashboard');
                }
                else {
                    const count = this.menuItems.filter(x => x.url === url || x.subMenuItems?.filter(e => e.url === url).length > 0).length;
                    if (this.menuItems.length === 0 || count > 0 || url.indexOf('view') !== -1) {
                        this._storage.setItem(LAST_MENU_ITEM_LOADED_KEY, url);
                    }
                }
            }
        });
    }
    ngOnInit() {
        this.diag = this._injector.get(DiagService).getInfo();
        this.initAdditionaSettings(() => {
            this._injector.get(MenuService)
                .getItems(this._startM.getByKey('APP_MODULE_NAME'))
                .pipe(this.takeUntilDestroyed())
                .subscribe((response) => this._popup.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this._menuItems = entity;
                    saveMenuItemsToStorage(this._storage, entity, this._eventBroker);
                    this._selectedMenuItemLogic();
                }
            }));
        });
    }
    ngOnDestroy() {
        this._routerSubscription?.unsubscribe();
        super.ngOnDestroy();
    }
    initAdditionaSettings(callback) {
        this._userSettingSrv
            .getUserSettings(this.session.userId, this.session.organizations.currentLink.organizationId, UserAdditionalSettingsDto.MENU_SETTINGS_KEY)
            .pipe(this.takeUntilDestroyed())
            .subscribe(z => this._popup.HandleIEntityResponse({
            response: z,
            successCallback: (entity) => {
                if (!Utility.isEmpty(entity?.value)) {
                    const settings = JSON.parse(entity.value);
                    if (!Utility.isEmpty(settings['isCollapse'])) {
                        this.menuSettings.isCollapse = settings['isCollapse'];
                    }
                    if (!Utility.isEmpty(settings['isFull'])) {
                        this.menuSettings.isFull = settings['isFull'];
                    }
                    if (!Utility.isEmpty(settings['isViewTooltips'])) {
                        this.menuSettings.isViewTooltips = settings['isViewTooltips'];
                    }
                    if (!Utility.isEmpty(settings['items'])) {
                        this.menuSettings.items = settings['items'];
                    }
                }
                callback();
            }
        }));
    }
    showSupportInfo() {
        this.isShowSupportInfo = !this.isShowSupportInfo;
    }
    getMaxMenuHeight() {
        if (this.menuHeight === undefined) {
            this.menuHeight = window.innerHeight;
        }
        return { height: this.menuHeight.toString() + 'px' };
    }
    onOpenedMenuPanel(item) {
        item.expanded = true;
        this._makeExpandedSetting(item);
    }
    onClosedMenuPanel(item) {
        item.expanded = false;
        this._makeExpandedSetting(item);
    }
    onMenuItemSettingsUpdated(settings) {
        this.menuSettings = settings;
        this._updateMenuSettings(this.menuSettings);
    }
    _makeExpandedSetting(item) {
        const record = this.menuSettings.items.find(y => y.id === item.recordId);
        if (Utility.isEmpty(record)) {
            var settingsItem = new UserMenuSettingsItem();
            settingsItem.id = item.recordId;
            settingsItem.expanded = item.expanded;
            this.menuSettings.items.push(settingsItem);
        }
        else {
            record.expanded = item.expanded;
        }
        this._updateMenuSettings(this.menuSettings);
    }
    toggleNavBar() {
        this.menuSettings.isCollapse = !this.menuSettings.isCollapse;
        this._updateMenuSettings(this.menuSettings);
    }
    toggleFullMenu() {
        this.menuSettings.isFull = !this.menuSettings.isFull;
        this._updateMenuSettings(this.menuSettings);
    }
    editMenu() {
        const origin = new UserMenuSettings();
        origin.isCollapse = this.menuSettings.isCollapse;
        origin.isFull = this.menuSettings.isFull;
        origin.isViewTooltips = this.menuSettings.isViewTooltips;
        origin.items = this.menuSettings.items.map(x => ({ id: x.id, hidden: x.hidden, expanded: x.expanded }));
        const data = { items: this._menuItems, settings: this.menuSettings };
        CoreDialog.window(CoreMenuSettingDialogWindow, data, (result) => {
            if (result) {
                this._updateMenuSettings(result);
            }
        }, () => {
            this.menuSettings = origin;
        });
    }
    _updateMenuSettings(settings) {
        this.menuSettings = settings;
        const dto = new UserAdditionalSettingsDto(this.session.userId, this.session.organizations.currentLink.organizationId, this.menuSettings, UserAdditionalSettingsDto.MENU_SETTINGS_KEY);
        this._userSettingSrv
            .setAdditionalUserSettings(dto)
            .pipe(this.takeUntilDestroyed())
            .subscribe();
    }
    menuMouseLeave() {
        this.hoverMenu = !this.hoverMenu;
        this._selectedMenuItemLogic();
    }
    _selectedMenuItemLogic() {
        const checked = '/' + this._startM.getByKey('APP_MODULE_NAME') + this._storage.getItem(LAST_MENU_ITEM_LOADED_KEY);
        for (let i = 0; i < this.menuItems.length; i++) {
            if (this.menuItems[i].subMenuItems?.length > 0) {
                this.menuItems[i].selected = false;
                this.menuItems[i].subMenuItems.map(k => {
                    if (k.url.endsWith(checked)) {
                        this.menuAccordeon?.get(i)?.openAll();
                        this.menuItems[i].selected = true;
                    }
                });
            }
            else {
                this.menuItems[i].selected = true;
            }
        }
    }
    chengeCurrentLink(linkId) {
        const token = this._authService.getToken();
        this._authService
            .changeSeessionOrgLink(token, linkId)
            .pipe(this.takeUntilDestroyed())
            .subscribe((result) => {
            if (result.isSuccess) {
                this._contextService.chageOrganization(result.entity);
                window.location.reload();
            }
        });
    }
    trimOrganizationName(detail) {
        let trimCount = 30;
        if (!detail)
            return null;
        if (detail.globalRoleId === RolesEnum.Broker) {
            trimCount = trimCount - 6; // 'Агент' и один пробел
        }
        return detail.organizationName.length > trimCount ? detail.organizationName.slice(0, trimCount) + '...' : detail.organizationName;
    }
    openChat() {
        this._injector.get(DrawerService).show(CoreChatListDrawerComponent, { name: DrawerNames.LIST });
    }
    logout() {
        this._authService.logout();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePage, deps: [{ token: i0.Injector }, { token: ContextService }, { token: i1$7.Router }, { token: PopupResults }, { token: CoreUserSettingsService }, { token: PageService }, { token: Startup }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CorePage, isStandalone: false, selector: "core-page", viewQueries: [{ propertyName: "menuAccordeon", predicate: MatAccordion, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"content\">\n  <div id=\"sln-wrapper\">\n    <!-- HEADER -->\n    <div class=\"sln-header-flex\">\n      <!-- logo -->\n      <div class=\"logo-wrap\">\n        @if (menuSettings.isCollapse) {\n        <li routerLink=\"/dashboard\" class=\"sln-logo sln-logo-position\"></li>\n        } @if (!menuSettings.isCollapse) {\n        <li\n          routerLink=\"/dashboard\"\n          class=\"logo-mini-logo logo-mini-logo-position\"\n        ></li>\n        }\n      </div>\n\n      <nav class=\"sln-header\" role=\"navigation\">\n        <!-- BURGER -->\n        <div class=\"navbar-header\">\n          <a [matMenuTriggerFor]=\"settingsMenu\">\n            <div\n              class=\"sln-menu-control sln-header-top-menu-hidden-position\"\n            ></div>\n          </a>\n          <mat-menu #settingsMenu=\"matMenu\">\n            <button mat-menu-item (click)=\"toggleNavBar()\">\n              <div\n                class=\"{{ menuSettings.isCollapse === true ? 'sln-header-top-menu sln-header-top-menu-position' : 'sln-header-top-menu-hidden sln-header-top-menu-hidden-position'}}\"\n              ></div>\n              <span class=\"sln-mat-menu-span\"\n                >{{ menuSettings.isCollapse === true ? '\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C' : '\u0420\u0430\u0437\u0432\u0435\u0440\u043D\u0443\u0442\u044C'\n                }} \u043C\u0435\u043D\u044E</span\n              >\n            </button>\n            <button mat-menu-item (click)=\"toggleFullMenu()\">\n              <div\n                class=\"sln-open-common-menu sln-header-top-menu-hidden-position\"\n              ></div>\n              <span class=\"sln-mat-menu-span\"\n                >{{ menuSettings.isFull === true ? '\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435' : '\u041F\u043E\u043B\u043D\u043E\u0435'\n                }} \u043C\u0435\u043D\u044E</span\n              >\n            </button>\n            <button mat-menu-item (click)=\"editMenu()\">\n              <div\n                class=\"sln-menu-settings sln-header-top-menu-hidden-position\"\n              ></div>\n              <span class=\"sln-mat-menu-span\">\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u043C\u0435\u043D\u044E</span>\n            </button>\n          </mat-menu>\n        </div>\n        <div class=\"sln-section-page-head\">\n          <ng-content select=\"[pageHead]\"></ng-content>\n        </div>\n        <div class=\"sln-section-card\">\n          <!-- \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 -->\n          <div style=\"text-align: center\">\n            <a href=\"{{accountCardUrl}}\">\n              <span\n                [core-tooltip]=\"virtualAccountTooltipComponentType\"\n                [contentData]=\"VM.Setting?.virtualAccount\"\n                [position]=\"'bottom'\"\n                class=\"virtualAccount-tooltip\">\n                <div class=\"sln-header-\u0441ard sln-header-card-position\"></div>\n              </span>\n            </a>\n          </div>\n          <div class=\"sln-section-chat\">\n            <div matTooltip=\"\u0427\u0430\u0442\" matTooltipPosition=\"below\">\n              <a class=\"sln-link-chat-header\" (click)=\"openChat()\">\n                @if (!haveMessageChat) {\n                <div\n                  class=\"sln-header-chat\"\n                ></div>\n                } @if (haveMessageChat) {\n                <div class=\"sln-header-chat\"></div>\n                }\n              </a>\n            </div>\n          </div>\n          <div class=\"sln-section-chat\">\n            <div matTooltip=\"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438\" matTooltipPosition=\"below\">\n              <div class=\"sln-core-session-exit\">\n                <div\n                  class=\"dev-tools-image dev-tools-iamge-position\"\n                  [matMenuTriggerFor]=\"topMenu\"\n                ></div>\n              </div>\n              <mat-menu #topMenu=\"matMenu\">\n                <a href=\"{{userCardUrl}}\" class=\"sln-mat-menu\">\n                  <button mat-menu-item>\n                    <div\n                      class=\"sln-header-my-profile sln-header-common-position\"\n                    ></div>\n                    <span class=\"sln-mat-menu-span\">\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430 \u043F\u0440\u043E\u0444\u0438\u043B\u044F</span>\n                  </button>\n                </a>\n                <a href=\"{{organizationCardUrl}}\" class=\"sln-mat-menu\">\n                  <button mat-menu-item>\n                    <div\n                      class=\"sln-header-organization-card sln-header-common-position\"\n                    ></div>\n                    <span class=\"sln-mat-menu-span\"\n                      >\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430 {{ session?.organizations?.currentLink?.type !==\n                      'Team' ? '\u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438': '\u043A\u043E\u043C\u0430\u043D\u0434\u044B' }}\n                    </span>\n                  </button>\n                </a>\n                <a href=\"{{accountCardUrl}}\" class=\"sln-mat-menu\">\n                  @if (VM.Setting?.virtualAccount) {\n                  <button mat-menu-item>\n                    <div\n                      class=\"sln-header-virtual-account sln-header-common-position\"\n                    ></div>\n                    <span class=\"sln-mat-menu-span\">\u0412\u0438\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u044B\u0439 \u0441\u0447\u0435\u0442</span>\n                  </button>\n                  }\n                </a>\n                <a href=\"{{notificationSubsCardUrl}}\" class=\"sln-mat-menu\">\n                  <button mat-menu-item>\n                    <div\n                      class=\"sln-header-my-subscriptions sln-header-common-position\"\n                    ></div>\n                    <span class=\"sln-mat-menu-span\">\u041C\u043E\u0438 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0438</span>\n                  </button>\n                </a>\n              </mat-menu>\n            </div>\n          </div>\n        </div>\n        <!-- LOGO  -->\n        <li class=\"nav-header\">\n          <div class=\"dropdown profile-element\" style=\"text-align: center\">\n            <!-- FLEX NAME -->\n            <div class=\"sln-about-person-flex\">\n              <div class=\"sln-about-person\">\n                <span class=\"clear\">\n                  <span class=\"\" style=\"margin-bottom: 2px\">\n                    <span class=\"font-bold\"\n                      ><a href=\"{{userCardUrl}}\">{{session?.name}}</a></span\n                    >\n                  </span>\n                </span>\n                <div class=\"sln-admin\" [matMenuTriggerFor]=\"organizationsMenu\">\n                  <small class=\"sln-organizationName\">\n                    @if\n                    (session?.organizations?.currentLink?.detail?.globalRoleId\n                    === 2) {\n                    <span>\u0410\u0433\u0435\u043D\u0442</span>\n                    } {{\n                    trimOrganizationName(session?.organizations?.currentLink?.detail)\n                    }}\n                  </small>\n                </div>\n              </div>\n              <span\n                class=\"sln-user-icon\"\n                [matMenuTriggerFor]=\"organizationsMenu\"\n              >\n                <core-user-icon\n                  [fullName]=\"session?.name\"\n                  [url]=\"session?.avatarLink\"\n                  [backColor]=\"session?.avatarColor\"\n                ></core-user-icon>\n              </span>\n              <mat-menu #organizationsMenu=\"matMenu\">\n                @for (link of organizationLinks | sortLinks; track link) {\n                <button\n                  mat-menu-item\n                  (click)=\"chengeCurrentLink(link.linkId)\"\n                  class=\"sln-change-organization-item\"\n                  [ngClass]=\"{'sln-change-organization-current': link.detail?.organizationInn === session?.organizations.currentLink?.detail?.organizationInn && link.detail?.globalRoleId === session?.organizations.currentLink?.detail?.globalRoleId }\"\n                >\n                  <div>\n                    <div>\n                      <small class=\"sln-organizationName\">\n                        {{link.detail.organizationName}}\n                      </small>\n                    </div>\n                    @if (link.type !== 'Team') {\n                    <div class=\"sln-change-organization-requisite\">\n                      <small class=\"sln-organizationInn\"\n                        >\u0418\u041D\u041D:{{link.detail.organizationInn}}\n                      </small>\n                      @if (link.detail.globalRoleId === 2) {\n                      <span class=\"sln-change-organization-requisite-agent\"\n                        >\u0410\u0433\u0435\u043D\u0442</span\n                      >\n                      }\n                    </div>\n                    }\n                  </div>\n                </button>\n                }\n                <button\n                  mat-menu-item\n                  (click)=\"logout()\"\n                  class=\"sln-mat-menu sln-logout\"\n                >\n                  <div class=\"sln-header-exit sln-header-common-position\"></div>\n                  <span class=\"sln-mat-menu-span sln-logout-text\">\u0412\u044B\u0445\u043E\u0434</span>\n                </button>\n              </mat-menu>\n            </div>\n          </div>\n        </li>\n      </nav>\n    </div>\n    <!-- right section -->\n    <div id=\"sln-page-wrapper\" class=\"gray-bg sln-page-wrapper\">\n      <div class=\"left-section\">\n        <nav\n          #fullNavigationMenu\n          [ngClass]=\"{ 'navbar-hide': !menuSettings.isCollapse, 'navbar-hover-style': hoverMenu }\"\n          class=\"navbar-default navbar-static-side open-menu\"\n          role=\"navigation\"\n          (mouseleave)=\"hoverMenu = false\"\n        >\n          <div class=\"sidebar-collapse\">\n            <div class=\"sln-core-page-logo\">\n              <ng-scrollbar\n                trackClass=\"sln-crl-core-page\"\n                [ngStyle]=\"getMaxMenuHeight()\"\n              >\n                <core-rigth-menu\n                  [menuItems]=\"menuItems\"\n                  [menuSettings]=\"menuSettings\"\n                  [showNewBtn]=\"showNewBtn\"\n                  [hoverExpanded]=\"hoverMenu\"\n                  (menuItemExpanded)=\"onOpenedMenuPanel($event)\"\n                  (menuItemCollapsed)=\"onClosedMenuPanel($event)\"\n                  (menuItemSettingsUpdated)=\"onMenuItemSettingsUpdated($event)\"\n                >\n                </core-rigth-menu>\n              </ng-scrollbar>\n            </div>\n          </div>\n        </nav>\n        <!-- menu hide -->\n        @if (!menuSettings.isCollapse) {\n        <nav\n          class=\"sln-hide-menu navbar-default navbar-static-side\"\n          role=\"navigation\"\n          (mouseenter)=\"menuMouseLeave()\"\n        >\n          <div class=\"sidebar-collapse\">\n            <ng-scrollbar\n              trackClass=\"sln-crl-core-page-hidden\"\n              [ngStyle]=\"getMaxMenuHeight()\"\n              class=\"sln-crl-core-page-hide\"\n            >\n              <div class=\"sln-core-page-logo-hide\">\n                <ul class=\"nav metismenu\" id=\"side-menu-hide\">\n                  <div class=\"dropdown-m sln-hidden-fake-menu-items\">\n                    @for (item of menuItems; track item; let i = $index) {\n                    <ng-container class=\"{{menuItems[i].name}}\">\n                      <li class=\"sln-li-hover\">\n                        <div style=\"width: 100%\">\n                          <p\n                            class=\"nav-label {{menuItems[i].icon}} sln-second-position-icon\"\n                          ></p>\n                        </div>\n                      </li>\n                      @for (subItem of handleSubMenuItem(item.subMenuItems ||\n                      []); track subItem; let j = $index) {\n                      <ng-container class=\"{{subItem.name}}\">\n                        <li class=\"sln-li-hover\">\n                          <div style=\"width: 100%\">\n                            <p\n                              class=\"nav-label {{subItem.icon}} sln-second-position-icon\"\n                            ></p>\n                          </div>\n                        </li>\n                      </ng-container>\n                      }\n                    </ng-container>\n                    }\n                  </div>\n                </ul>\n              </div>\n            </ng-scrollbar>\n          </div>\n        </nav>\n        }\n      </div>\n      <div class=\"right-section\">\n        <ng-content select=\"[pageBody]\"></ng-content>\n      </div>\n\n      <!--\u041A\u043E\u043D\u0442\u0435\u043D\u0442 \u0441\u0442\u0440\u0430\u043D\u0438\u0446 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F-->\n      <ng-template drawerHost><div></div></ng-template>\n    </div>\n    <!-- footer -->\n    <div class=\"sln-footer\">\n      <div class=\"sln-footer-left\">\n        <span\n          class=\"sln-nav-item-text sln-support-link\"\n          (click)=\"showSupportInfo()\"\n          >\u041D\u0430\u043F\u0438\u0441\u0430\u0442\u044C \u0432 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443</span\n        >\n      </div>\n      <div class=\"sln-footer-right\">\n        <p>\n          <a\n            class=\"sln-nav-item-text sln-support-link\"\n            href=\"{{VM?.Setting?.platform?.linkPersonalInformation}}\"\n            target=\"_blank\"\n            >\u041F\u043E\u043B\u0438\u0442\u0438\u043A\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0438 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445</a\n          >\n          | <span>\u0412\u0435\u0440\u0441\u0438\u044F {{diag.version}} | {{diag.host}}</span>\n        </p>\n        @if (isShowSupportInfo) {\n        <div class=\"sln-info-support\">\n          <div class=\"sln-support-another-links\">\n            @if (VM?.Setting?.platform?.isShowPhone) {\n            <a href=\"tel:8{{VM?.Setting?.platform?.phoneFirst}}\" class=\"tel\">\n              <span>{{VM?.Setting?.platform?.phoneFirst | phoneRu }}</span>\n            </a>\n            } @if (VM?.Setting?.platform?.isShowPhone) {\n            <a href=\"tel:8{{VM?.Setting?.platform?.phoneSecond}}\" class=\"tel\">\n              <span>{{VM?.Setting?.platform?.phoneSecond | phoneRu }}</span>\n            </a>\n            }\n            <a href=\"mailto:{{VM?.Setting?.platform?.email}}\" class=\"email\">\n              <span>{{VM?.Setting?.platform?.email}}</span>\n            </a>\n          </div>\n          <div class=\"sln-support-messengers\">\n            <div class=\"sln-support-tw\">\n              @if (VM?.Setting?.platform?.linkTelegram?.length > 0) {\n              <a href=\"{{VM?.Setting?.platform?.linkTelegram}}\" target=\"_blank\">\n                <div class=\"sln-menu-telegram\"></div>\n              </a>\n              } @if (VM?.Setting?.platform?.linkWhatsApp?.length > 0) {\n              <a href=\"{{VM?.Setting?.platform?.linkWhatsApp}}\" target=\"_blank\">\n                <div class=\"sln-menu-whatsapp sln-menu-whatsapp-position\"></div>\n              </a>\n              }\n            </div>\n          </div>\n          <a\n            href=\"https://anydesk.com/ru/downloads/windows\"\n            target=\"_blank\"\n            rel=\"nofollow\"\n            class=\"anydesk\"\n          >\n            <span>\u0421\u043A\u0430\u0447\u0430\u0442\u044C Anydesk</span>\n          </a>\n        </div>\n        }\n      </div>\n    </div>\n  </div>\n</div>\n", styles: ["li{list-style:none}.sln-user-icon{cursor:pointer}.navbar-static-top{width:90%;margin:10px auto 0}.sln-menu-reports-text{padding-left:17px}.sln-chage-organization-select{cursor:pointer;display:flex;align-items:center;height:20px}.sln-chage-organization-select .mat-mdc-select-arrow{width:24px;height:24px}.sln-change-organization-item{display:flex;flex-direction:column;align-items:flex-start;color:var(--DARK-GREY);font-family:var(--font-medium)}.sln-change-organization-item .sln-organizationName{font-family:var(--font-medium);font-size:13px}.sln-change-organization-item .sln-organizationKpp,.sln-change-organization-item .sln-organizationInn{font-family:var(--font-medium);font-size:12px;color:var(--GRAY-SOFT)}.sln-change-organization-item.sln-change-organization-current{border-left:2px solid var(--PRIMARY);color:var(--PRIMARY)}.sln-change-organization-item .sln-change-organization-requisite{display:flex;justify-content:space-between;font-size:small}.sln-change-organization-item .sln-change-organization-requisite-agent{margin-left:50px}.sln-logout-text{font-family:var(--font-medium);font-size:13px;color:var(--DARK-GREY)}.sln-mat-menu{text-decoration:none;display:flex;align-items:center}.sln-mat-menu button .sln-mat-menu-span{font-family:var(--font-medium)}.sln-mat-menu button:hover .sln-mat-menu-span{color:var(--PRIMARY);font-family:var(--font-medium)}.sln-menu-panel-block-title{cursor:auto;color:var(--DARK-GREY)}.sln-session-organizations{padding:0;color:var(--GRAY-SOFT)}.dashboard a{display:flex;align-items:center}.overlay-dropdown{display:none;position:absolute;margin-top:40px;right:0}.sln-overlay-flex ul{margin-bottom:20px;display:flex;flex-direction:column;justify-content:space-between}.sln-overlay-flex img{padding-right:10px!important}a:hover .overlay-dropdown{cursor:default;position:absolute;display:block;width:244px;height:230px;padding:20px;background:var(--WHITE);border:1px solid var(--LIGHT-GRAY);box-shadow:0 2px 10px #0000000a,0 6px 36px #00000005}a:hover .overlay-dropdown:after{content:\"\";position:absolute;left:20px;top:-40px;border:10px solid transparent}.sln-financial-service-application,.sln-section-card{display:flex;align-items:stretch;justify-content:flex-end;flex:1;gap:10px}.sln-financial-service-application img,.sln-section-card img{cursor:pointer;vertical-align:middle}.news img{margin-right:25px;cursor:pointer}.dropdown{padding:0 10px;display:flex;flex-direction:column;align-items:center}.dropdown img{width:50px!important;height:50px!important}.sln-about-person-flex{display:flex;justify-content:center;align-items:center}.sln-about-person{margin-right:10px}.sln-about-person .clear{text-align:end}.sln-about-person .clear a{font-size:13px;line-height:18px;text-align:right;color:var(--DARK-GREY)}.sln-about-person .sln-admin{cursor:pointer;margin-top:-5px;height:25px;display:flex;align-items:center;justify-content:flex-end}.sln-about-person .sln-admin small{font-size:13px;text-align:right;letter-spacing:.01em;color:var(--GRAY)}.navbar-right{margin:0!important}.ps-content{height:100%!important;background:#fff}.sln-left-li img{width:20px}.sln-core-page-logo-hide img{padding-top:14px;margin-bottom:4px;width:145px}.sln-core-page-logo{display:flex;flex-direction:column;align-items:center;height:100%;width:100%}.sln-core-page-logo .logo-img{width:145px;margin-top:10px;margin-bottom:4px!important}.sln-core-page-logo img{width:145px}.sln-support{display:flex;align-items:center;width:100%;padding:0 23px!important;cursor:pointer;position:relative}.sln-support,.sln-support-hide{width:100%;padding:5px 23px;margin-top:34px;cursor:pointer}.sln-support img,.sln-support-hide img{width:26px!important;margin-right:12px!important}.sln-support a,.sln-support-hide a{text-decoration:none}.sln-support a:focus,.sln-support-hide a:focus{background:#f5f5f5!important}.sln-info-support{margin:0 5px;background:#fff;position:absolute;left:150px;bottom:30px;border:1.4px solid var(--GRAY);border-radius:4px;padding:5px 15px;display:flex;flex-direction:column;flex-wrap:wrap;filter:drop-shadow(0px 2px 4px rgba(0,0,0,.09)) drop-shadow(0px 6px 36px rgba(0,0,0,.02));z-index:999;align-items:center}.sln-info-support .sln-support-messengers{width:70%}.sln-info-support .sln-support-messengers p{color:var(--DARK-GREY);font-family:var(--font-medium);font-size:14px;text-transform:uppercase;text-align:center}.sln-info-support .sln-support-messengers .sln-support-tw{display:flex;justify-content:space-around}.sln-info-support .sln-support-another-links{display:flex;flex-direction:column;flex-wrap:wrap;align-items:center;margin:5px 0}.sln-info-support .sln-support-another-links a{margin:1px 0;border-bottom:1px solid var(--WHITE)}.sln-info-support .sln-support-another-links a:hover{border-bottom:1px solid var(--MIDLE-GRAY)}.sln-info-support .sln-support-another-links span{font-size:14px;color:var(--MIDLE-GRAY)}.sln-info-support .anydesk{color:var(--MIDLE-GRAY)}.sln-info-support .anydesk:hover{color:var(--PRIMARY)}.sln-support-hide{padding:5px 0 5px 10px!important;text-align:center}.sln-support-hide a{display:block}.sln-support-hide:focus{background:#f5f5f5!important}.sln-support-hide:hover{background:#f3f6f5}.sln-support:focus{background:#f3f6f5}.mat-menu-panel{margin-top:10px!important;overflow:hidden}.dropdown-m{position:relative!important;display:inline-block;width:100%}.dropdown-content{border-right:4px solid var(--GRAY);display:flex;left:78px;margin-top:-54px;position:fixed;z-index:2;border-radius:4px;background:var(--WHITE);box-shadow:0 2px 10px #0000000a,0 6px 36px #00000005}.dropdown-content ul{flex-direction:row}.dropdown-content ul a{padding:2px 20px!important}.dropdown-content .sln-left-li:hover{border:none!important}.dropdown-content a{padding:6.8px 16px!important;text-decoration:none;display:flex!important;flex-direction:row!important}.dropdown:hover .dropdown-content{display:flex;flex-direction:row}.dropdown:hover .dropbtn{background-color:var(--LIGHT-GRAY)}::ng-deep .has .mat-expansion-indicator:after{display:none!important}.sln-link-chat-header{color:var(--PRIMARY);height:auto;display:block}::ng-deep .custom-directive-tooltip-container{text-align:center;z-index:100;position:fixed;opacity:0;transform:translate(-50%,-30%);animation:tooltip-slide .18s ease-out .5s;animation-fill-mode:forwards;pointer-events:none;font-family:var(--font-medium);background:var(--WHITE);border:1px solid var(--GRAY);border-radius:4px;font-size:14px;padding:3px 7px;color:var(--MIDLE-GRAY)}@keyframes tooltip-slide{0%{opacity:0;transform:translate(-50%,-30%)}to{opacity:1;transform:translate(-50%)}}.sln-change-delete{cursor:pointer;height:20px;margin-right:9px}.navbar-header img{cursor:pointer;margin-right:10px}.sln-mat-menu-span{color:var(--DARK-GREY);font-family:var(--font-medium)}.sln-ul-hover:hover{background-color:var(--LIGHT-GRAY)!important}.sln-ul-hover:hover .sln-factoring-settings-text,.sln-ul-hover:hover .sln-item-text{color:var(--BLACK)}.sln-ul-hover:hover:before{left:-5px!important}.sln-ul-hover:hover{background:none!important}.sln-ul-hover:hover .sln-item-text{color:var(--PRIMARY)}.sln-ul-hover:hover:before{content:\"\";border-left:4px solid var(--PRIMARY)!important;position:absolute;height:54px;left:0;z-index:2}.navbar-hover-style{display:block;position:fixed;z-index:99999;animation:showmenu .3s ease-out}@keyframes showmenu{0%{transform:translate(-50px)}to{transform:translate(0)}}.sln-dp-logo-position{background-position:50% 39%;background-size:115px}.sln-dp-blue-logo-position{background-position:center 42%;background-size:30px}.sln-change-role{border:2px solid var(--GRAY-SOFT);border-radius:7px;height:30px;display:flex;align-items:center;justify-content:center;padding:0 5px;cursor:pointer}.sln-change-role .sln-role-text{font-family:var(--font-medium);text-transform:uppercase;font-size:12px;color:var(--MIDLE-GRAY)}#side-menu-hide{height:94%;width:100%}#side-menu-hide img{width:25px!important;margin-left:0;background:#fff}#side-menu-hide .sln-li-hover .nav-label{background-position:center;background-size:26px}.sln-hide-menu{width:75px}.sln-hide-menu .mat-expansion-panel-header-title{margin:0}.sln-hide-menu .sln-li-hover{position:relative!important}.sln-hide-menu .sln-li-hover:hover{height:inherit;background:#f5f5f5}.sln-hide-menu .sln-li-hover:hover:before{content:\"\";position:absolute;left:0;border-left:4px solid var(--PRIMARY);height:54px}.sln-hide-menu .sln-li-hover{display:block!important}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1$7.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "component", type: i4$6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreUserIconComponent, selector: "core-user-icon", inputs: ["useInChat", "sizeSuffix", "url", "backColor", "fullName"] }, { kind: "directive", type: CoreTooltipDirective, selector: "[core-tooltip]", inputs: ["core-tooltip", "contentData", "position", "offset", "hidden"] }, { kind: "component", type: CoreRigthMenuComponent, selector: "core-rigth-menu", inputs: ["menuItems", "menuSettings", "showNewBtn", "hoverExpanded"], outputs: ["menuItemExpanded", "menuItemCollapsed", "menuItemSettingsUpdated"] }, { kind: "pipe", type: PhoneRuPipe, name: "phoneRu" }, { kind: "pipe", type: SortLinksPipe, name: "sortLinks" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePage, decorators: [{
            type: Component,
            args: [{ selector: 'core-page', standalone: false, template: "<div class=\"content\">\n  <div id=\"sln-wrapper\">\n    <!-- HEADER -->\n    <div class=\"sln-header-flex\">\n      <!-- logo -->\n      <div class=\"logo-wrap\">\n        @if (menuSettings.isCollapse) {\n        <li routerLink=\"/dashboard\" class=\"sln-logo sln-logo-position\"></li>\n        } @if (!menuSettings.isCollapse) {\n        <li\n          routerLink=\"/dashboard\"\n          class=\"logo-mini-logo logo-mini-logo-position\"\n        ></li>\n        }\n      </div>\n\n      <nav class=\"sln-header\" role=\"navigation\">\n        <!-- BURGER -->\n        <div class=\"navbar-header\">\n          <a [matMenuTriggerFor]=\"settingsMenu\">\n            <div\n              class=\"sln-menu-control sln-header-top-menu-hidden-position\"\n            ></div>\n          </a>\n          <mat-menu #settingsMenu=\"matMenu\">\n            <button mat-menu-item (click)=\"toggleNavBar()\">\n              <div\n                class=\"{{ menuSettings.isCollapse === true ? 'sln-header-top-menu sln-header-top-menu-position' : 'sln-header-top-menu-hidden sln-header-top-menu-hidden-position'}}\"\n              ></div>\n              <span class=\"sln-mat-menu-span\"\n                >{{ menuSettings.isCollapse === true ? '\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C' : '\u0420\u0430\u0437\u0432\u0435\u0440\u043D\u0443\u0442\u044C'\n                }} \u043C\u0435\u043D\u044E</span\n              >\n            </button>\n            <button mat-menu-item (click)=\"toggleFullMenu()\">\n              <div\n                class=\"sln-open-common-menu sln-header-top-menu-hidden-position\"\n              ></div>\n              <span class=\"sln-mat-menu-span\"\n                >{{ menuSettings.isFull === true ? '\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0435' : '\u041F\u043E\u043B\u043D\u043E\u0435'\n                }} \u043C\u0435\u043D\u044E</span\n              >\n            </button>\n            <button mat-menu-item (click)=\"editMenu()\">\n              <div\n                class=\"sln-menu-settings sln-header-top-menu-hidden-position\"\n              ></div>\n              <span class=\"sln-mat-menu-span\">\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u043C\u0435\u043D\u044E</span>\n            </button>\n          </mat-menu>\n        </div>\n        <div class=\"sln-section-page-head\">\n          <ng-content select=\"[pageHead]\"></ng-content>\n        </div>\n        <div class=\"sln-section-card\">\n          <!-- \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 -->\n          <div style=\"text-align: center\">\n            <a href=\"{{accountCardUrl}}\">\n              <span\n                [core-tooltip]=\"virtualAccountTooltipComponentType\"\n                [contentData]=\"VM.Setting?.virtualAccount\"\n                [position]=\"'bottom'\"\n                class=\"virtualAccount-tooltip\">\n                <div class=\"sln-header-\u0441ard sln-header-card-position\"></div>\n              </span>\n            </a>\n          </div>\n          <div class=\"sln-section-chat\">\n            <div matTooltip=\"\u0427\u0430\u0442\" matTooltipPosition=\"below\">\n              <a class=\"sln-link-chat-header\" (click)=\"openChat()\">\n                @if (!haveMessageChat) {\n                <div\n                  class=\"sln-header-chat\"\n                ></div>\n                } @if (haveMessageChat) {\n                <div class=\"sln-header-chat\"></div>\n                }\n              </a>\n            </div>\n          </div>\n          <div class=\"sln-section-chat\">\n            <div matTooltip=\"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438\" matTooltipPosition=\"below\">\n              <div class=\"sln-core-session-exit\">\n                <div\n                  class=\"dev-tools-image dev-tools-iamge-position\"\n                  [matMenuTriggerFor]=\"topMenu\"\n                ></div>\n              </div>\n              <mat-menu #topMenu=\"matMenu\">\n                <a href=\"{{userCardUrl}}\" class=\"sln-mat-menu\">\n                  <button mat-menu-item>\n                    <div\n                      class=\"sln-header-my-profile sln-header-common-position\"\n                    ></div>\n                    <span class=\"sln-mat-menu-span\">\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430 \u043F\u0440\u043E\u0444\u0438\u043B\u044F</span>\n                  </button>\n                </a>\n                <a href=\"{{organizationCardUrl}}\" class=\"sln-mat-menu\">\n                  <button mat-menu-item>\n                    <div\n                      class=\"sln-header-organization-card sln-header-common-position\"\n                    ></div>\n                    <span class=\"sln-mat-menu-span\"\n                      >\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430 {{ session?.organizations?.currentLink?.type !==\n                      'Team' ? '\u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438': '\u043A\u043E\u043C\u0430\u043D\u0434\u044B' }}\n                    </span>\n                  </button>\n                </a>\n                <a href=\"{{accountCardUrl}}\" class=\"sln-mat-menu\">\n                  @if (VM.Setting?.virtualAccount) {\n                  <button mat-menu-item>\n                    <div\n                      class=\"sln-header-virtual-account sln-header-common-position\"\n                    ></div>\n                    <span class=\"sln-mat-menu-span\">\u0412\u0438\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u044B\u0439 \u0441\u0447\u0435\u0442</span>\n                  </button>\n                  }\n                </a>\n                <a href=\"{{notificationSubsCardUrl}}\" class=\"sln-mat-menu\">\n                  <button mat-menu-item>\n                    <div\n                      class=\"sln-header-my-subscriptions sln-header-common-position\"\n                    ></div>\n                    <span class=\"sln-mat-menu-span\">\u041C\u043E\u0438 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0438</span>\n                  </button>\n                </a>\n              </mat-menu>\n            </div>\n          </div>\n        </div>\n        <!-- LOGO  -->\n        <li class=\"nav-header\">\n          <div class=\"dropdown profile-element\" style=\"text-align: center\">\n            <!-- FLEX NAME -->\n            <div class=\"sln-about-person-flex\">\n              <div class=\"sln-about-person\">\n                <span class=\"clear\">\n                  <span class=\"\" style=\"margin-bottom: 2px\">\n                    <span class=\"font-bold\"\n                      ><a href=\"{{userCardUrl}}\">{{session?.name}}</a></span\n                    >\n                  </span>\n                </span>\n                <div class=\"sln-admin\" [matMenuTriggerFor]=\"organizationsMenu\">\n                  <small class=\"sln-organizationName\">\n                    @if\n                    (session?.organizations?.currentLink?.detail?.globalRoleId\n                    === 2) {\n                    <span>\u0410\u0433\u0435\u043D\u0442</span>\n                    } {{\n                    trimOrganizationName(session?.organizations?.currentLink?.detail)\n                    }}\n                  </small>\n                </div>\n              </div>\n              <span\n                class=\"sln-user-icon\"\n                [matMenuTriggerFor]=\"organizationsMenu\"\n              >\n                <core-user-icon\n                  [fullName]=\"session?.name\"\n                  [url]=\"session?.avatarLink\"\n                  [backColor]=\"session?.avatarColor\"\n                ></core-user-icon>\n              </span>\n              <mat-menu #organizationsMenu=\"matMenu\">\n                @for (link of organizationLinks | sortLinks; track link) {\n                <button\n                  mat-menu-item\n                  (click)=\"chengeCurrentLink(link.linkId)\"\n                  class=\"sln-change-organization-item\"\n                  [ngClass]=\"{'sln-change-organization-current': link.detail?.organizationInn === session?.organizations.currentLink?.detail?.organizationInn && link.detail?.globalRoleId === session?.organizations.currentLink?.detail?.globalRoleId }\"\n                >\n                  <div>\n                    <div>\n                      <small class=\"sln-organizationName\">\n                        {{link.detail.organizationName}}\n                      </small>\n                    </div>\n                    @if (link.type !== 'Team') {\n                    <div class=\"sln-change-organization-requisite\">\n                      <small class=\"sln-organizationInn\"\n                        >\u0418\u041D\u041D:{{link.detail.organizationInn}}\n                      </small>\n                      @if (link.detail.globalRoleId === 2) {\n                      <span class=\"sln-change-organization-requisite-agent\"\n                        >\u0410\u0433\u0435\u043D\u0442</span\n                      >\n                      }\n                    </div>\n                    }\n                  </div>\n                </button>\n                }\n                <button\n                  mat-menu-item\n                  (click)=\"logout()\"\n                  class=\"sln-mat-menu sln-logout\"\n                >\n                  <div class=\"sln-header-exit sln-header-common-position\"></div>\n                  <span class=\"sln-mat-menu-span sln-logout-text\">\u0412\u044B\u0445\u043E\u0434</span>\n                </button>\n              </mat-menu>\n            </div>\n          </div>\n        </li>\n      </nav>\n    </div>\n    <!-- right section -->\n    <div id=\"sln-page-wrapper\" class=\"gray-bg sln-page-wrapper\">\n      <div class=\"left-section\">\n        <nav\n          #fullNavigationMenu\n          [ngClass]=\"{ 'navbar-hide': !menuSettings.isCollapse, 'navbar-hover-style': hoverMenu }\"\n          class=\"navbar-default navbar-static-side open-menu\"\n          role=\"navigation\"\n          (mouseleave)=\"hoverMenu = false\"\n        >\n          <div class=\"sidebar-collapse\">\n            <div class=\"sln-core-page-logo\">\n              <ng-scrollbar\n                trackClass=\"sln-crl-core-page\"\n                [ngStyle]=\"getMaxMenuHeight()\"\n              >\n                <core-rigth-menu\n                  [menuItems]=\"menuItems\"\n                  [menuSettings]=\"menuSettings\"\n                  [showNewBtn]=\"showNewBtn\"\n                  [hoverExpanded]=\"hoverMenu\"\n                  (menuItemExpanded)=\"onOpenedMenuPanel($event)\"\n                  (menuItemCollapsed)=\"onClosedMenuPanel($event)\"\n                  (menuItemSettingsUpdated)=\"onMenuItemSettingsUpdated($event)\"\n                >\n                </core-rigth-menu>\n              </ng-scrollbar>\n            </div>\n          </div>\n        </nav>\n        <!-- menu hide -->\n        @if (!menuSettings.isCollapse) {\n        <nav\n          class=\"sln-hide-menu navbar-default navbar-static-side\"\n          role=\"navigation\"\n          (mouseenter)=\"menuMouseLeave()\"\n        >\n          <div class=\"sidebar-collapse\">\n            <ng-scrollbar\n              trackClass=\"sln-crl-core-page-hidden\"\n              [ngStyle]=\"getMaxMenuHeight()\"\n              class=\"sln-crl-core-page-hide\"\n            >\n              <div class=\"sln-core-page-logo-hide\">\n                <ul class=\"nav metismenu\" id=\"side-menu-hide\">\n                  <div class=\"dropdown-m sln-hidden-fake-menu-items\">\n                    @for (item of menuItems; track item; let i = $index) {\n                    <ng-container class=\"{{menuItems[i].name}}\">\n                      <li class=\"sln-li-hover\">\n                        <div style=\"width: 100%\">\n                          <p\n                            class=\"nav-label {{menuItems[i].icon}} sln-second-position-icon\"\n                          ></p>\n                        </div>\n                      </li>\n                      @for (subItem of handleSubMenuItem(item.subMenuItems ||\n                      []); track subItem; let j = $index) {\n                      <ng-container class=\"{{subItem.name}}\">\n                        <li class=\"sln-li-hover\">\n                          <div style=\"width: 100%\">\n                            <p\n                              class=\"nav-label {{subItem.icon}} sln-second-position-icon\"\n                            ></p>\n                          </div>\n                        </li>\n                      </ng-container>\n                      }\n                    </ng-container>\n                    }\n                  </div>\n                </ul>\n              </div>\n            </ng-scrollbar>\n          </div>\n        </nav>\n        }\n      </div>\n      <div class=\"right-section\">\n        <ng-content select=\"[pageBody]\"></ng-content>\n      </div>\n\n      <!--\u041A\u043E\u043D\u0442\u0435\u043D\u0442 \u0441\u0442\u0440\u0430\u043D\u0438\u0446 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F-->\n      <ng-template drawerHost><div></div></ng-template>\n    </div>\n    <!-- footer -->\n    <div class=\"sln-footer\">\n      <div class=\"sln-footer-left\">\n        <span\n          class=\"sln-nav-item-text sln-support-link\"\n          (click)=\"showSupportInfo()\"\n          >\u041D\u0430\u043F\u0438\u0441\u0430\u0442\u044C \u0432 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443</span\n        >\n      </div>\n      <div class=\"sln-footer-right\">\n        <p>\n          <a\n            class=\"sln-nav-item-text sln-support-link\"\n            href=\"{{VM?.Setting?.platform?.linkPersonalInformation}}\"\n            target=\"_blank\"\n            >\u041F\u043E\u043B\u0438\u0442\u0438\u043A\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0438 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445</a\n          >\n          | <span>\u0412\u0435\u0440\u0441\u0438\u044F {{diag.version}} | {{diag.host}}</span>\n        </p>\n        @if (isShowSupportInfo) {\n        <div class=\"sln-info-support\">\n          <div class=\"sln-support-another-links\">\n            @if (VM?.Setting?.platform?.isShowPhone) {\n            <a href=\"tel:8{{VM?.Setting?.platform?.phoneFirst}}\" class=\"tel\">\n              <span>{{VM?.Setting?.platform?.phoneFirst | phoneRu }}</span>\n            </a>\n            } @if (VM?.Setting?.platform?.isShowPhone) {\n            <a href=\"tel:8{{VM?.Setting?.platform?.phoneSecond}}\" class=\"tel\">\n              <span>{{VM?.Setting?.platform?.phoneSecond | phoneRu }}</span>\n            </a>\n            }\n            <a href=\"mailto:{{VM?.Setting?.platform?.email}}\" class=\"email\">\n              <span>{{VM?.Setting?.platform?.email}}</span>\n            </a>\n          </div>\n          <div class=\"sln-support-messengers\">\n            <div class=\"sln-support-tw\">\n              @if (VM?.Setting?.platform?.linkTelegram?.length > 0) {\n              <a href=\"{{VM?.Setting?.platform?.linkTelegram}}\" target=\"_blank\">\n                <div class=\"sln-menu-telegram\"></div>\n              </a>\n              } @if (VM?.Setting?.platform?.linkWhatsApp?.length > 0) {\n              <a href=\"{{VM?.Setting?.platform?.linkWhatsApp}}\" target=\"_blank\">\n                <div class=\"sln-menu-whatsapp sln-menu-whatsapp-position\"></div>\n              </a>\n              }\n            </div>\n          </div>\n          <a\n            href=\"https://anydesk.com/ru/downloads/windows\"\n            target=\"_blank\"\n            rel=\"nofollow\"\n            class=\"anydesk\"\n          >\n            <span>\u0421\u043A\u0430\u0447\u0430\u0442\u044C Anydesk</span>\n          </a>\n        </div>\n        }\n      </div>\n    </div>\n  </div>\n</div>\n", styles: ["li{list-style:none}.sln-user-icon{cursor:pointer}.navbar-static-top{width:90%;margin:10px auto 0}.sln-menu-reports-text{padding-left:17px}.sln-chage-organization-select{cursor:pointer;display:flex;align-items:center;height:20px}.sln-chage-organization-select .mat-mdc-select-arrow{width:24px;height:24px}.sln-change-organization-item{display:flex;flex-direction:column;align-items:flex-start;color:var(--DARK-GREY);font-family:var(--font-medium)}.sln-change-organization-item .sln-organizationName{font-family:var(--font-medium);font-size:13px}.sln-change-organization-item .sln-organizationKpp,.sln-change-organization-item .sln-organizationInn{font-family:var(--font-medium);font-size:12px;color:var(--GRAY-SOFT)}.sln-change-organization-item.sln-change-organization-current{border-left:2px solid var(--PRIMARY);color:var(--PRIMARY)}.sln-change-organization-item .sln-change-organization-requisite{display:flex;justify-content:space-between;font-size:small}.sln-change-organization-item .sln-change-organization-requisite-agent{margin-left:50px}.sln-logout-text{font-family:var(--font-medium);font-size:13px;color:var(--DARK-GREY)}.sln-mat-menu{text-decoration:none;display:flex;align-items:center}.sln-mat-menu button .sln-mat-menu-span{font-family:var(--font-medium)}.sln-mat-menu button:hover .sln-mat-menu-span{color:var(--PRIMARY);font-family:var(--font-medium)}.sln-menu-panel-block-title{cursor:auto;color:var(--DARK-GREY)}.sln-session-organizations{padding:0;color:var(--GRAY-SOFT)}.dashboard a{display:flex;align-items:center}.overlay-dropdown{display:none;position:absolute;margin-top:40px;right:0}.sln-overlay-flex ul{margin-bottom:20px;display:flex;flex-direction:column;justify-content:space-between}.sln-overlay-flex img{padding-right:10px!important}a:hover .overlay-dropdown{cursor:default;position:absolute;display:block;width:244px;height:230px;padding:20px;background:var(--WHITE);border:1px solid var(--LIGHT-GRAY);box-shadow:0 2px 10px #0000000a,0 6px 36px #00000005}a:hover .overlay-dropdown:after{content:\"\";position:absolute;left:20px;top:-40px;border:10px solid transparent}.sln-financial-service-application,.sln-section-card{display:flex;align-items:stretch;justify-content:flex-end;flex:1;gap:10px}.sln-financial-service-application img,.sln-section-card img{cursor:pointer;vertical-align:middle}.news img{margin-right:25px;cursor:pointer}.dropdown{padding:0 10px;display:flex;flex-direction:column;align-items:center}.dropdown img{width:50px!important;height:50px!important}.sln-about-person-flex{display:flex;justify-content:center;align-items:center}.sln-about-person{margin-right:10px}.sln-about-person .clear{text-align:end}.sln-about-person .clear a{font-size:13px;line-height:18px;text-align:right;color:var(--DARK-GREY)}.sln-about-person .sln-admin{cursor:pointer;margin-top:-5px;height:25px;display:flex;align-items:center;justify-content:flex-end}.sln-about-person .sln-admin small{font-size:13px;text-align:right;letter-spacing:.01em;color:var(--GRAY)}.navbar-right{margin:0!important}.ps-content{height:100%!important;background:#fff}.sln-left-li img{width:20px}.sln-core-page-logo-hide img{padding-top:14px;margin-bottom:4px;width:145px}.sln-core-page-logo{display:flex;flex-direction:column;align-items:center;height:100%;width:100%}.sln-core-page-logo .logo-img{width:145px;margin-top:10px;margin-bottom:4px!important}.sln-core-page-logo img{width:145px}.sln-support{display:flex;align-items:center;width:100%;padding:0 23px!important;cursor:pointer;position:relative}.sln-support,.sln-support-hide{width:100%;padding:5px 23px;margin-top:34px;cursor:pointer}.sln-support img,.sln-support-hide img{width:26px!important;margin-right:12px!important}.sln-support a,.sln-support-hide a{text-decoration:none}.sln-support a:focus,.sln-support-hide a:focus{background:#f5f5f5!important}.sln-info-support{margin:0 5px;background:#fff;position:absolute;left:150px;bottom:30px;border:1.4px solid var(--GRAY);border-radius:4px;padding:5px 15px;display:flex;flex-direction:column;flex-wrap:wrap;filter:drop-shadow(0px 2px 4px rgba(0,0,0,.09)) drop-shadow(0px 6px 36px rgba(0,0,0,.02));z-index:999;align-items:center}.sln-info-support .sln-support-messengers{width:70%}.sln-info-support .sln-support-messengers p{color:var(--DARK-GREY);font-family:var(--font-medium);font-size:14px;text-transform:uppercase;text-align:center}.sln-info-support .sln-support-messengers .sln-support-tw{display:flex;justify-content:space-around}.sln-info-support .sln-support-another-links{display:flex;flex-direction:column;flex-wrap:wrap;align-items:center;margin:5px 0}.sln-info-support .sln-support-another-links a{margin:1px 0;border-bottom:1px solid var(--WHITE)}.sln-info-support .sln-support-another-links a:hover{border-bottom:1px solid var(--MIDLE-GRAY)}.sln-info-support .sln-support-another-links span{font-size:14px;color:var(--MIDLE-GRAY)}.sln-info-support .anydesk{color:var(--MIDLE-GRAY)}.sln-info-support .anydesk:hover{color:var(--PRIMARY)}.sln-support-hide{padding:5px 0 5px 10px!important;text-align:center}.sln-support-hide a{display:block}.sln-support-hide:focus{background:#f5f5f5!important}.sln-support-hide:hover{background:#f3f6f5}.sln-support:focus{background:#f3f6f5}.mat-menu-panel{margin-top:10px!important;overflow:hidden}.dropdown-m{position:relative!important;display:inline-block;width:100%}.dropdown-content{border-right:4px solid var(--GRAY);display:flex;left:78px;margin-top:-54px;position:fixed;z-index:2;border-radius:4px;background:var(--WHITE);box-shadow:0 2px 10px #0000000a,0 6px 36px #00000005}.dropdown-content ul{flex-direction:row}.dropdown-content ul a{padding:2px 20px!important}.dropdown-content .sln-left-li:hover{border:none!important}.dropdown-content a{padding:6.8px 16px!important;text-decoration:none;display:flex!important;flex-direction:row!important}.dropdown:hover .dropdown-content{display:flex;flex-direction:row}.dropdown:hover .dropbtn{background-color:var(--LIGHT-GRAY)}::ng-deep .has .mat-expansion-indicator:after{display:none!important}.sln-link-chat-header{color:var(--PRIMARY);height:auto;display:block}::ng-deep .custom-directive-tooltip-container{text-align:center;z-index:100;position:fixed;opacity:0;transform:translate(-50%,-30%);animation:tooltip-slide .18s ease-out .5s;animation-fill-mode:forwards;pointer-events:none;font-family:var(--font-medium);background:var(--WHITE);border:1px solid var(--GRAY);border-radius:4px;font-size:14px;padding:3px 7px;color:var(--MIDLE-GRAY)}@keyframes tooltip-slide{0%{opacity:0;transform:translate(-50%,-30%)}to{opacity:1;transform:translate(-50%)}}.sln-change-delete{cursor:pointer;height:20px;margin-right:9px}.navbar-header img{cursor:pointer;margin-right:10px}.sln-mat-menu-span{color:var(--DARK-GREY);font-family:var(--font-medium)}.sln-ul-hover:hover{background-color:var(--LIGHT-GRAY)!important}.sln-ul-hover:hover .sln-factoring-settings-text,.sln-ul-hover:hover .sln-item-text{color:var(--BLACK)}.sln-ul-hover:hover:before{left:-5px!important}.sln-ul-hover:hover{background:none!important}.sln-ul-hover:hover .sln-item-text{color:var(--PRIMARY)}.sln-ul-hover:hover:before{content:\"\";border-left:4px solid var(--PRIMARY)!important;position:absolute;height:54px;left:0;z-index:2}.navbar-hover-style{display:block;position:fixed;z-index:99999;animation:showmenu .3s ease-out}@keyframes showmenu{0%{transform:translate(-50px)}to{transform:translate(0)}}.sln-dp-logo-position{background-position:50% 39%;background-size:115px}.sln-dp-blue-logo-position{background-position:center 42%;background-size:30px}.sln-change-role{border:2px solid var(--GRAY-SOFT);border-radius:7px;height:30px;display:flex;align-items:center;justify-content:center;padding:0 5px;cursor:pointer}.sln-change-role .sln-role-text{font-family:var(--font-medium);text-transform:uppercase;font-size:12px;color:var(--MIDLE-GRAY)}#side-menu-hide{height:94%;width:100%}#side-menu-hide img{width:25px!important;margin-left:0;background:#fff}#side-menu-hide .sln-li-hover .nav-label{background-position:center;background-size:26px}.sln-hide-menu{width:75px}.sln-hide-menu .mat-expansion-panel-header-title{margin:0}.sln-hide-menu .sln-li-hover{position:relative!important}.sln-hide-menu .sln-li-hover:hover{height:inherit;background:#f5f5f5}.sln-hide-menu .sln-li-hover:hover:before{content:\"\";position:absolute;left:0;border-left:4px solid var(--PRIMARY);height:54px}.sln-hide-menu .sln-li-hover{display:block!important}\n"] }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: ContextService }, { type: i1$7.Router }, { type: PopupResults }, { type: CoreUserSettingsService }, { type: PageService }, { type: Startup }], propDecorators: { menuAccordeon: [{
                type: ViewChildren,
                args: [MatAccordion]
            }] } });

class SellanChatCommonModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: SellanChatCommonModule, declarations: [SelectedChatUserFilterPipe,
            CoreChatAvatarComponent,
            CoreChatUserComponent,
            SellanChatInputComponent,
            SellanChatSendMessageMenuComponent,
            SellanChatSearchMessageComponent,
            SellanChatHighlighterPipe], imports: [CoreBaseModule,
            CoreDialogModule,
            CoreControlModule,
            CoreMatModule], exports: [SelectedChatUserFilterPipe,
            CoreChatAvatarComponent,
            CoreChatUserComponent,
            SellanChatInputComponent,
            SellanChatSearchMessageComponent,
            SellanChatHighlighterPipe] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatCommonModule, providers: [
            SignalRService
        ], imports: [CoreBaseModule,
            CoreDialogModule,
            CoreControlModule,
            CoreMatModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanChatCommonModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CoreBaseModule,
                        CoreDialogModule,
                        CoreControlModule,
                        CoreMatModule,
                    ],
                    declarations: [
                        SelectedChatUserFilterPipe,
                        CoreChatAvatarComponent,
                        CoreChatUserComponent,
                        SellanChatInputComponent,
                        SellanChatSendMessageMenuComponent,
                        SellanChatSearchMessageComponent,
                        SellanChatHighlighterPipe,
                    ],
                    exports: [
                        SelectedChatUserFilterPipe,
                        CoreChatAvatarComponent,
                        CoreChatUserComponent,
                        SellanChatInputComponent,
                        SellanChatSearchMessageComponent,
                        SellanChatHighlighterPipe,
                    ],
                    providers: [
                        SignalRService
                    ],
                }]
        }] });

class CoreTooltipModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTooltipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreTooltipModule, declarations: [CoreTooltipContainerComponent,
            CoreTooltipDirective], imports: [CoreBaseModule,
            CoreMatModule], exports: [CoreTooltipContainerComponent,
            CoreTooltipDirective] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTooltipModule, imports: [CoreBaseModule,
            CoreMatModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreTooltipModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreTooltipContainerComponent,
                        CoreTooltipDirective
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule
                    ],
                    exports: [
                        CoreTooltipContainerComponent,
                        CoreTooltipDirective
                    ],
                }]
        }] });

class SellanCoreChatModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanCoreChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: SellanCoreChatModule, declarations: [
            //common
            CoreChatRoomComponent,
            CoreChatWidgetBalloonsComponent,
            //drawer ui
            CoreChatListDrawerComponent,
            CoreChatListMenuComponent,
            CoreChatDialodReadingMessageTooltipComponent,
            CoreChatDialogDrawerComponent,
            CoreChatDialogMenuComponent,
            CoreChatMessageMenuComponent,
            CoreChatNewDrawerComponent,
            CoreChatNewGroupDrawerComponent,
            CoreChatProfileDrawerComponent,
            CoreChatForwardDrawerComponent], imports: [CoreBaseModule,
            CoreMatModule,
            CoreDialogModule,
            CoreControlModule,
            CoreUploaderModule,
            SellanChatCommonModule,
            CoreDrawerModule,
            CoreCropperModule,
            CoreTooltipModule], exports: [
            //common
            CoreChatRoomComponent,
            CoreChatWidgetBalloonsComponent,
            //drawer ui
            CoreChatListDrawerComponent,
            CoreChatListMenuComponent,
            CoreChatDialodReadingMessageTooltipComponent,
            CoreChatDialogDrawerComponent,
            CoreChatDialogMenuComponent,
            CoreChatMessageMenuComponent,
            CoreChatNewDrawerComponent,
            CoreChatNewGroupDrawerComponent,
            CoreChatProfileDrawerComponent,
            CoreChatForwardDrawerComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanCoreChatModule, providers: [
            CoreChatService,
            SellanChatNotificationService,
            SellanChatUsersService,
            SellanChatMsgManagerService,
            CoreAvatarService
        ], imports: [CoreBaseModule,
            CoreMatModule,
            CoreDialogModule,
            CoreControlModule,
            CoreUploaderModule,
            SellanChatCommonModule,
            CoreDrawerModule,
            CoreCropperModule,
            CoreTooltipModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SellanCoreChatModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        //common
                        CoreChatRoomComponent,
                        CoreChatWidgetBalloonsComponent,
                        //drawer ui
                        CoreChatListDrawerComponent,
                        CoreChatListMenuComponent,
                        CoreChatDialodReadingMessageTooltipComponent,
                        CoreChatDialogDrawerComponent,
                        CoreChatDialogMenuComponent,
                        CoreChatMessageMenuComponent,
                        CoreChatNewDrawerComponent,
                        CoreChatNewGroupDrawerComponent,
                        CoreChatProfileDrawerComponent,
                        CoreChatForwardDrawerComponent
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreDialogModule,
                        CoreControlModule,
                        CoreUploaderModule,
                        SellanChatCommonModule,
                        CoreDrawerModule,
                        CoreCropperModule,
                        CoreTooltipModule
                    ],
                    providers: [
                        CoreChatService,
                        SellanChatNotificationService,
                        SellanChatUsersService,
                        SellanChatMsgManagerService,
                        CoreAvatarService
                    ],
                    exports: [
                        //common
                        CoreChatRoomComponent,
                        CoreChatWidgetBalloonsComponent,
                        //drawer ui
                        CoreChatListDrawerComponent,
                        CoreChatListMenuComponent,
                        CoreChatDialodReadingMessageTooltipComponent,
                        CoreChatDialogDrawerComponent,
                        CoreChatDialogMenuComponent,
                        CoreChatMessageMenuComponent,
                        CoreChatNewDrawerComponent,
                        CoreChatNewGroupDrawerComponent,
                        CoreChatProfileDrawerComponent,
                        CoreChatForwardDrawerComponent
                    ]
                }]
        }] });

class CorePageTitleComponent extends CoreTitlePage {
    constructor(injector) {
        super(injector);
        this._storage = injector.get(BrowserLocalStorage);
        this._router = injector.get(Router);
        this._menuLoadedListener = injector.get(EventBrokerService).listenDom(MENU_ITEMS_LOADED_EVENT, () => this._applyMenuTitle());
    }
    ngOnInit() {
        super.ngOnInit();
        this._applyMenuTitle();
        this._router.events
            .pipe(filter(event => event instanceof NavigationEnd), this.takeUntilDestroyed())
            .subscribe(() => this._applyMenuTitle());
    }
    ngOnDestroy() {
        this._menuLoadedListener?.ignore();
        super.ngOnDestroy();
    }
    _applyMenuTitle() {
        const menuTitle = getMenuItemTitleForLastLoaded(this._storage);
        this._title = menuTitle ?? this._pageM.getTitle();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePageTitleComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CorePageTitleComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<span class=\"sln-h6\">{{ _title }}</span>" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CorePageTitleComponent, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<span class=\"sln-h6\">{{ _title }}</span>" }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

class AgentService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    // сохранение организации агента (создание альтернативной роли)
    saveAsAgent(organizationId) {
        // post
        const url = this._startUp.apiRoot('organizations/agent/' + organizationId, 'core');
        return this._ajaxM.post({ url: url });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AgentService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AgentService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AgentService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class CoreLayoutModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreLayoutModule, declarations: [SortLinksPipe,
            CorePage,
            CorePageTitleComponent,
            CoreErrorPage,
            CoreForbiddenPage,
            CoreNotFoundPage,
            CorePageContentComponent,
            CoreMiniDraftDialogWindow,
            CorePageTooltipVirtualAccountComponent,
            CoreMenuSettingDialogWindow,
            CoreRigthMenuComponent], imports: [CorePipeModule,
            CoreBaseModule,
            SellanCoreChatModule,
            CoreMatModule,
            CoreControlModule,
            CoreOrganizationModule,
            CoreDialogModule,
            CoreDrawerModule,
            CoreTooltipModule,
            CoreNotificationModule], exports: [CorePage,
            CorePageTitleComponent,
            CorePageContentComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLayoutModule, providers: [
            SortLinksPipe,
            MenuService,
            CoreUserSettingsService,
            MiniDraftService,
            AgentService
        ], imports: [CorePipeModule,
            CoreBaseModule,
            SellanCoreChatModule,
            CoreMatModule,
            CoreControlModule,
            CoreOrganizationModule,
            CoreDialogModule,
            CoreDrawerModule,
            CoreTooltipModule,
            CoreNotificationModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLayoutModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        SortLinksPipe,
                        CorePage,
                        CorePageTitleComponent,
                        CoreErrorPage,
                        CoreForbiddenPage,
                        CoreNotFoundPage,
                        CorePageContentComponent,
                        CoreMiniDraftDialogWindow,
                        CorePageTooltipVirtualAccountComponent,
                        CoreMenuSettingDialogWindow,
                        CoreRigthMenuComponent
                    ],
                    imports: [
                        CorePipeModule,
                        CoreBaseModule,
                        SellanCoreChatModule,
                        CoreMatModule,
                        CoreControlModule,
                        CoreOrganizationModule,
                        CoreDialogModule,
                        CoreDrawerModule,
                        CoreTooltipModule,
                        CoreNotificationModule,
                    ],
                    providers: [
                        SortLinksPipe,
                        MenuService,
                        CoreUserSettingsService,
                        MiniDraftService,
                        AgentService
                    ],
                    exports: [
                        CorePage,
                        CorePageTitleComponent,
                        CorePageContentComponent
                    ],
                }]
        }] });

class Address {
    constructor() {
        this.addressId = 0;
        this.addressType = { id: 1, text: 'Юридический адрес', description: null };
        this.enabled = true;
    }
}

class CoreAddressCardComponent extends CoreAbstractComponent {
    get isEmptyValue() {
        return Utility.isEmpty(this.item) || Utility.isEmpty(this.item.postIndex);
    }
    get isDisabled() {
        return this.readonly || this.isEmptyValue === false;
    }
    get districtTitle() {
        return this.item.districtType + ' ' + this.item.district;
    }
    get localityTitle() {
        return this.item.localityType + ' ' + this.item.locality;
    }
    get streetTitle() {
        return this.item.streetType + ' ' + this.item.street;
    }
    constructor() {
        super();
        this.valueChange = new EventEmitter();
        this.dadataConfig = { type: DadataType.address };
        this.item = new Address();
    }
    ngOnInit() {
        if (!Utility.isEmpty(this.config))
            this.dadataConfig = this.config;
    }
    onAddressSelected(event) {
        const addressData = event.data;
        if (addressData) {
            if (Utility.isEmpty(this.item))
                this.item = {};
            this.item.fiasId = addressData.fias_id;
            this.item.fiasCode = addressData.fias_code;
            this.item.kladrCode = addressData.kladr_id;
            this.item.okato = addressData.okato;
            this.item.oktmo = addressData.oktmo;
            this.item.postIndex = addressData.postal_code;
            this.item.country = { id: addressData.country_iso_code, text: addressData.country, description: null };
            this.item.regionFiasId = addressData.region_fias_id;
            this.item.region = { id: addressData.region_kladr_id.slice(0, 2), text: addressData.region, description: null };
            this.item.districtFiasId = addressData.area_fias_id;
            this.item.district = addressData.area;
            this.item.districtType = addressData.area_type;
            this.item.cityFiasId = addressData.city_fias_id;
            if (addressData.region !== addressData.city) {
                this.item.city = addressData.city;
            }
            else {
                this.item.city = '';
            }
            this.item.localityFiasId = addressData.settlement_fias_id;
            this.item.locality = addressData.settlement;
            this.item.localityType = addressData.settlement_type;
            this.item.streetFiasId = addressData.street_fias_id;
            this.item.street = addressData.street;
            this.item.streetType = addressData.street_type;
            this.item.house = addressData.house;
            if (!Utility.isEmpty(addressData.block_type) && !Utility.isEmpty(addressData.block)) {
                this.item.house += ' ' + addressData.block_type + ' ' + addressData.block;
            }
            if (!Utility.isEmpty(addressData.flat_type) && !Utility.isEmpty(addressData.flat)) {
                this.item.roomType = addressData.flat_type;
                this.item.room = addressData.flat;
            }
        }
        else {
            this.item = null;
        }
    }
    onValuesChange($event) {
        this.valueChange.emit($event);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAddressCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreAddressCardComponent, isStandalone: false, selector: "core-address-card", inputs: { readonly: "readonly", item: "item", config: "config" }, outputs: { valueChange: "valueChange" }, usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"grid\">\n    @if (readonly === false) {\n      <div class=\"row\">\n        <div class=\"col-md-12 sln-dadata-search sln-padding-left sln-padding-right\">\n          <core-dadata-search [config]=\"config\" placeholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u0434\u043B\u044F \u0430\u0432\u0442\u043E\u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F\"\n          (selected)=\"onAddressSelected($event)\"></core-dadata-search>\n        </div>\n      </div>\n    }\n    @if (isEmptyValue === false) {\n      <div>\n        @if (item.addressId !== 0 && readonly) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"item.fullAddress\" name=\"fullAddress\" fieldName=\"fullAddress\"\n                placeholder=\"\u041F\u043E\u043B\u043D\u044B\u0439 \u0430\u0434\u0440\u0435\u0441\" [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        <div class=\"row\">\n          <div class=\"col-md-6 sln-padding-left\">\n            <div class=\"form-group\">\n              <core-field-string [ngModel]=\"item.postIndex\" name=\"postIndex\" fieldName=\"postIndex\" placeholder=\"\u0418\u043D\u0434\u0435\u043A\u0441\"\n                [settings]=\"{ useMask: true, maskExpression: '000000' }\"\n              [disabled]=\"true\"></core-field-string>\n            </div>\n          </div>\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">\n              <core-field-combobox [ngModel]=\"item.region\" name=\"region\" fieldName=\"region\" placeholder=\"\u0420\u0435\u0433\u0438\u043E\u043D\"\n                [settings]=\"{ sourceCode:'Regions'}\" [disabled]=\"true\"\n              class=\"sln-core-field-combobox\"></core-field-combobox>\n            </div>\n          </div>\n        </div>\n        @if (item.district) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"districtTitle\" name=\"district\" fieldName=\"district\" placeholder=\"\u0420\u0430\u0439\u043E\u043D\"\n                [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        @if (item.city) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"item.city\" name=\"city\" fieldName=\"city\" placeholder=\"\u0413\u043E\u0440\u043E\u0434\"\n                [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        @if (item.locality) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"localityTitle\" name=\"locality\" fieldName=\"locality\"\n                placeholder=\"\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442\" [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        @if (item.street) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"streetTitle\" name=\"street\" fieldName=\"street\" placeholder=\"\u0423\u043B\u0438\u0446\u0430\"\n                [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        <div class=\"row\">\n          <div class=\"col-md-4 sln-padding-left\">\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"item.house\" name=\"house\" fieldName=\"house\" placeholder=\"\u0414\u043E\u043C\"\n              [disabled]=\"readonly\" [settings]=\"{ isRequired: true }\"></core-field-string>\n            </div>\n          </div>\n          <div class=\"col-md-4  sln-padding-left\">\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"item.roomType\" name=\"roomType\" fieldName=\"roomType\" placeholder=\"\u041F\u043E\u043C\u0435\u0449\u0435\u043D\u0438\u0435\"\n              [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n            </div>\n          </div>\n          <div class=\"col-md-4 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"item.room\" name=\"room\" fieldName=\"room\" placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u043F\u043E\u043C\u0435\u0449\u0435\u043D\u0438\u044F\"\n              [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n            </div>\n          </div>\n        </div>\n      </div>\n    }\n  </div>\n</div>\n", styles: ["mat-toolbar.mat-toolbar-single-row{width:98%!important}.grid{width:99%;margin:0 auto}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"], dependencies: [{ kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreDadataSearchComponent, selector: "core-dadata-search", inputs: ["config", "disabled", "type", "limit", "placeholder", "locations", "address"], outputs: ["configChanged", "selectedSuggestion", "selected"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAddressCardComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-address-card', standalone: false, template: "<div provideParentForm>\n  <div class=\"grid\">\n    @if (readonly === false) {\n      <div class=\"row\">\n        <div class=\"col-md-12 sln-dadata-search sln-padding-left sln-padding-right\">\n          <core-dadata-search [config]=\"config\" placeholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u0434\u043B\u044F \u0430\u0432\u0442\u043E\u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F\"\n          (selected)=\"onAddressSelected($event)\"></core-dadata-search>\n        </div>\n      </div>\n    }\n    @if (isEmptyValue === false) {\n      <div>\n        @if (item.addressId !== 0 && readonly) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"item.fullAddress\" name=\"fullAddress\" fieldName=\"fullAddress\"\n                placeholder=\"\u041F\u043E\u043B\u043D\u044B\u0439 \u0430\u0434\u0440\u0435\u0441\" [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        <div class=\"row\">\n          <div class=\"col-md-6 sln-padding-left\">\n            <div class=\"form-group\">\n              <core-field-string [ngModel]=\"item.postIndex\" name=\"postIndex\" fieldName=\"postIndex\" placeholder=\"\u0418\u043D\u0434\u0435\u043A\u0441\"\n                [settings]=\"{ useMask: true, maskExpression: '000000' }\"\n              [disabled]=\"true\"></core-field-string>\n            </div>\n          </div>\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">\n              <core-field-combobox [ngModel]=\"item.region\" name=\"region\" fieldName=\"region\" placeholder=\"\u0420\u0435\u0433\u0438\u043E\u043D\"\n                [settings]=\"{ sourceCode:'Regions'}\" [disabled]=\"true\"\n              class=\"sln-core-field-combobox\"></core-field-combobox>\n            </div>\n          </div>\n        </div>\n        @if (item.district) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"districtTitle\" name=\"district\" fieldName=\"district\" placeholder=\"\u0420\u0430\u0439\u043E\u043D\"\n                [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        @if (item.city) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"item.city\" name=\"city\" fieldName=\"city\" placeholder=\"\u0413\u043E\u0440\u043E\u0434\"\n                [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        @if (item.locality) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"localityTitle\" name=\"locality\" fieldName=\"locality\"\n                placeholder=\"\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442\" [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        @if (item.street) {\n          <div class=\"row\">\n            <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n              <div class=\"form-group\">\n                <core-field-string [ngModel]=\"streetTitle\" name=\"street\" fieldName=\"street\" placeholder=\"\u0423\u043B\u0438\u0446\u0430\"\n                [disabled]=\"true\"></core-field-string>\n              </div>\n            </div>\n          </div>\n        }\n        <div class=\"row\">\n          <div class=\"col-md-4 sln-padding-left\">\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"item.house\" name=\"house\" fieldName=\"house\" placeholder=\"\u0414\u043E\u043C\"\n              [disabled]=\"readonly\" [settings]=\"{ isRequired: true }\"></core-field-string>\n            </div>\n          </div>\n          <div class=\"col-md-4  sln-padding-left\">\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"item.roomType\" name=\"roomType\" fieldName=\"roomType\" placeholder=\"\u041F\u043E\u043C\u0435\u0449\u0435\u043D\u0438\u0435\"\n              [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n            </div>\n          </div>\n          <div class=\"col-md-4 sln-padding-left sln-padding-right\">\n            <div class=\"form-group\">\n              <core-field-string [(ngModel)]=\"item.room\" name=\"room\" fieldName=\"room\" placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u043F\u043E\u043C\u0435\u0449\u0435\u043D\u0438\u044F\"\n              [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n            </div>\n          </div>\n        </div>\n      </div>\n    }\n  </div>\n</div>\n", styles: ["mat-toolbar.mat-toolbar-single-row{width:98%!important}.grid{width:99%;margin:0 auto}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"] }]
        }], ctorParameters: () => [], propDecorators: { readonly: [{
                type: Input
            }], item: [{
                type: Input
            }], config: [{
                type: Input
            }], valueChange: [{
                type: Output
            }] } });

class IAddressDialogOptions {
}
class CoreAddressDialogWindow extends CoreAbstractComponent {
    constructor(dialogRef, data) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
    }
    save() {
        this._getFullAddress(this.data.item);
        const row = this.data.item;
        if (this.data.organizationId) {
            row.organizationId = this.data.organizationId;
        }
        if (this.data.personId) {
            row.personId = this.data.personId;
        }
        this.dialogRef.close(row);
    }
    _getFullAddress(item) {
        let address = new Array();
        if (!Utility.isEmpty(item.region.text)) {
            address.push(item.region.text);
        }
        if (!Utility.isEmpty(item.district)) {
            address.push(item.districtType + ' ' + item.district);
        }
        if (!Utility.isEmpty(item.city) && item.region.text !== item.city) {
            address.push(item.city);
        }
        if (!Utility.isEmpty(item.locality)) {
            address.push(item.localityType + ' ' + item.locality);
        }
        if (!Utility.isEmpty(item.street)) {
            address.push(item.streetType + ' ' + item.street);
        }
        if (!Utility.isEmpty(item.house)) {
            address.push(item.house);
        }
        let str = '';
        for (let index = 0; index < address.length; index++) {
            if (index === 0) {
                str = address[index];
            }
            else {
                str += ',' + address[index];
            }
        }
        item.fullAddress = str;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAddressDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreAddressDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u0430\u0434\u0440\u0435\u0441\u0430\" width=\"700\">\n  <div body>\n    <form #newAddressForm=\"ngForm\" novalidate class=\"sln-adresses-form\">\n      <core-address-card [config]=\"data.config\" [item]=\"data.item\" [readonly]=\"data.readonlyMode\"></core-address-card>\n    </form>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newAddressForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-adresses-form{padding:5px 0}\n"], dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: CoreAddressCardComponent, selector: "core-address-card", inputs: ["readonly", "item", "config"], outputs: ["valueChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAddressDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u0430\u0434\u0440\u0435\u0441\u0430\" width=\"700\">\n  <div body>\n    <form #newAddressForm=\"ngForm\" novalidate class=\"sln-adresses-form\">\n      <core-address-card [config]=\"data.config\" [item]=\"data.item\" [readonly]=\"data.readonlyMode\"></core-address-card>\n    </form>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newAddressForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-adresses-form{padding:5px 0}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: IAddressDialogOptions, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class CoreFieldAddressComponent extends CoreAbstractAccessorComponent {
    get isImageEmpty() {
        return Utility.isEmpty(this.value?.fullAddress) ||
            Utility.isEmpty(this.value?.house);
    }
    constructor(_dialog) {
        super();
        this._dialog = _dialog;
        this.dadataConfig = {
            type: DadataType.address,
            division: Division.administrative
        };
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return null;
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    setDefault() {
        super.setDefault();
    }
    editValue() {
        const dialogRef = this._dialog.open(CoreAddressDialogWindow, {
            data: { item: this.value ? this.value : new Address(), readonlyMode: this.disabled ?? false, config: this.dadataConfig }
        });
        const sub = dialogRef.afterClosed().subscribe((result) => {
            if (result && result.state !== DialogReason.cancel) {
                if (result !== this.value) {
                    this.onValueChange(result);
                }
                this.valueChange.emit(this.value);
            }
            sub.unsubscribe();
        });
    }
    // implements Validator
    validate(control) {
        if (this.settings?.isRequired) {
            if (control.value === null || control.value === undefined) {
                return { 'required': true };
            }
        }
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldAddressComponent, deps: [{ token: i1$8.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldAddressComponent, isStandalone: false, selector: "core-field-address", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldAddressComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFieldAddressComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"sln-field-address\">\n    <div class=\"complex-field\">\n      <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n        <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n        @if (value?.fullAddress) {\n          <h2>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.fullAddress }} {{ value?.roomType }} {{ value?.room }}</span>\n          </h2>\n        }\n      </div>\n      <button (click)=\"editValue()\" style=\"min-width: 20px;\">\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (!disabled && isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @if (!disabled && !isImageEmpty) {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (disabled) {\n            <div class=\"sln-control-eye\"></div>\n          }\n        </div>\n      </button>\n    </div>\n    <mat-form-field style=\"display: none;\">\n      <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n    </mat-form-field>\n  </div>\n</div>\n\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: CopyClipboardDirective, selector: "[copyClipboard]", inputs: ["tooltip", "delay"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldAddressComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-address', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldAddressComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFieldAddressComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm>\n  <div class=\"sln-field-address\">\n    <div class=\"complex-field\">\n      <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n        <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n        @if (value?.fullAddress) {\n          <h2>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.fullAddress }} {{ value?.roomType }} {{ value?.room }}</span>\n          </h2>\n        }\n      </div>\n      <button (click)=\"editValue()\" style=\"min-width: 20px;\">\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (!disabled && isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @if (!disabled && !isImageEmpty) {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (disabled) {\n            <div class=\"sln-control-eye\"></div>\n          }\n        </div>\n      </button>\n    </div>\n    <mat-form-field style=\"display: none;\">\n      <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n    </mat-form-field>\n  </div>\n</div>\n\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }] });

class CoreAddressModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAddressModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreAddressModule, declarations: [CoreAddressCardComponent,
            CoreFieldAddressComponent,
            CoreAddressDialogWindow], imports: [CoreMatModule,
            CoreBaseModule,
            CoreControlModule,
            CoreDaDataModule,
            CoreDialogModule,
            CoreDirectiveModule], exports: [CoreFieldAddressComponent,
            CoreAddressCardComponent,
            CoreAddressDialogWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAddressModule, imports: [CoreMatModule,
            CoreBaseModule,
            CoreControlModule,
            CoreDaDataModule,
            CoreDialogModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAddressModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreAddressCardComponent,
                        CoreFieldAddressComponent,
                        CoreAddressDialogWindow
                    ],
                    imports: [
                        CoreMatModule,
                        CoreBaseModule,
                        CoreControlModule,
                        CoreDaDataModule,
                        CoreDialogModule,
                        CoreDirectiveModule
                    ],
                    exports: [
                        CoreFieldAddressComponent,
                        CoreAddressCardComponent,
                        CoreAddressDialogWindow
                    ]
                }]
        }] });

class RegistrationService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    // регистрация нового пользователя системы
    registrate(data) {
        // post
        const url = this._startUp.apiRoot('registration', 'oauth');
        return this._ajaxM.post({ url: url, data: data });
    }
    // получение регистрационных документов
    registrateDocument(data) {
        // post
        const url = this._startUp.apiRoot('registration/documents', 'oauth');
        return this._ajaxM.post({ url: url, data: data });
    }
    // получение регистрационных данных из подписи
    registrateSignData(signature, attorneyId) {
        // post
        const url = this._startUp.apiRoot('registration/sign', 'oauth');
        return this._ajaxM.post({ url: url, data: { signature, attorneyId } });
    }
    // восстановление пароля
    recover(email) {
        // post
        const url = this._startUp.apiRoot('registration/recover', 'oauth');
        return this._ajaxM.post({ url: url, data: { text: email } });
    }
    // изменение пароля пользователя
    changePassword(model) {
        const url = this._startUp.apiRoot('registration/password', 'oauth');
        return this._ajaxM.post({
            url: url,
            data: model
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RegistrationService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RegistrationService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RegistrationService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class RegistrationDocumentService {
    constructor(_dialog, _service, _cryptoM, _popUp) {
        this._dialog = _dialog;
        this._service = _service;
        this._cryptoM = _cryptoM;
        this._popUp = _popUp;
    }
    singRegistrateDocument(data, callFunction) {
        this._service.registrateDocument(data).subscribe((docResponse) => this._popUp.HandleIEntityResponse({
            response: docResponse,
            successCallback: (entity) => {
                const files = new Array();
                entity.forEach((file) => {
                    files.push({ fileId: file.fileId, multiOrganizationId: 1 }); // 1 - системная организация
                });
                const options = {
                    fileType: FileTypeEnum.SystemReglament,
                    previewTitle: 'Предпросмотр документа',
                    previewText: 'Перед подтверждением действия проверьте содержимое сформированных документов. Документы после подписания будут добавлены в хранилище организации',
                    files: entity,
                    callback: (metadata) => {
                        this._cryptoM.signFiles(files, true, (sing) => {
                            if (metadata.dialogRefs?.length > 0) {
                                metadata.dialogRefs.forEach(dialogRef => {
                                    dialogRef.close();
                                });
                            }
                        });
                    }
                };
                const currentRef = this._dialog.open(CoreFilePreviewDialogWindow, { data: options });
                const sub = currentRef.afterClosed().subscribe(_ => { callFunction(); sub.unsubscribe(); });
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RegistrationDocumentService, deps: [{ token: i1$8.MatDialog }, { token: RegistrationService }, { token: CryptoSignService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RegistrationDocumentService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RegistrationDocumentService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }, { type: RegistrationService }, { type: CryptoSignService }, { type: PopupResults }] });

class CoreAuthModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreAuthModule, imports: [CoreMatModule,
            CoreBaseModule,
            CoreOrganizationModule,
            CoreDialogModule,
            CoreDirectiveModule,
            CoreUploaderModule,
            CoreCryptoModule,
            CoreControlModule,
            CorePipeModule,
            NgxMaskDirective,
            NgxMaskPipe,
            CoreContactVerificationModule,
            AuthBlockedUserInstructionDialogWindow,
            MfaDialogWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAuthModule, providers: [
            provideNgxMask({
                decimalMarker: ','
            }),
            RegistrationDocumentService,
            RegistrationService,
            CoreComboboxService,
            { provide: 'ComboboxUriDescriptionService', useClass: DefaultComboboxUriDescriptionService },
            {
                provide: HTTP_INTERCEPTORS,
                useClass: UnauthorizedInterceptor,
                multi: true
            },
        ], imports: [CoreMatModule,
            CoreBaseModule,
            CoreOrganizationModule,
            CoreDialogModule,
            CoreDirectiveModule,
            CoreUploaderModule,
            CoreCryptoModule,
            CoreControlModule,
            CorePipeModule,
            CoreContactVerificationModule,
            AuthBlockedUserInstructionDialogWindow,
            MfaDialogWindow] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAuthModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [],
                    imports: [
                        CoreMatModule,
                        CoreBaseModule,
                        CoreOrganizationModule,
                        CoreDialogModule,
                        CoreDirectiveModule,
                        CoreUploaderModule,
                        CoreCryptoModule,
                        CoreControlModule,
                        CorePipeModule,
                        NgxMaskDirective,
                        NgxMaskPipe,
                        CoreContactVerificationModule,
                        AuthBlockedUserInstructionDialogWindow,
                        MfaDialogWindow
                    ],
                    providers: [
                        provideNgxMask({
                            decimalMarker: ','
                        }),
                        RegistrationDocumentService,
                        RegistrationService,
                        CoreComboboxService,
                        { provide: 'ComboboxUriDescriptionService', useClass: DefaultComboboxUriDescriptionService },
                        {
                            provide: HTTP_INTERCEPTORS,
                            useClass: UnauthorizedInterceptor,
                            multi: true
                        },
                    ]
                }]
        }] });

class CoreRouteDescription {
    // маршруты системных страниц
    // 500 ошибка
    static { this.route500 = {
        path: 'error',
        data: { title: 'Ошибка' },
        children: [
            {
                path: '',
                component: CorePageTitleComponent,
                outlet: 'pageTitle'
            },
            {
                path: '',
                component: CoreErrorPage,
                outlet: 'pageContent'
            }
        ]
    }; }
    // 403 ошибка
    static { this.route403 = {
        path: 'forbidden',
        data: { title: 'Доступ ограничен' },
        children: [
            {
                path: '',
                component: CorePageTitleComponent,
                outlet: 'pageTitle'
            },
            {
                path: '',
                component: CoreForbiddenPage,
                outlet: 'pageContent'
            }
        ]
    }; }
    // 404 для всех страниц не по шаблону маршрутов
    static { this.route404 = {
        path: '**',
        data: { title: 'Страница не найдена' },
        children: [
            {
                path: '',
                component: CorePageTitleComponent,
                outlet: 'pageTitle'
            },
            {
                path: '',
                component: CoreNotFoundPage,
                outlet: 'pageContent'
            }
        ]
    }; }
}

class SlnBaseAuthRecoveryDoneComponent extends CoreBasePage {
    constructor(injector, _router, _route, _registrationService, _popupResult) {
        super(injector);
        this._router = _router;
        this._route = _route;
        this._registrationService = _registrationService;
        this._popupResult = _popupResult;
        this.model = { password: { password: '', confirm: '' } };
    }
    changePassword() {
        const token = this._route.snapshot.queryParams['token'];
        this._changePassword(token);
    }
    _changePassword(token) {
        this.model.userToken = token;
        this._registrationService
            .changePassword(this.model)
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => {
            this._popupResult.HandleIEntityResponse({
                response: response,
                successCallback: () => {
                    if (Utility.isEmpty(token)) {
                        window.location.reload();
                    }
                    else {
                        this._router.navigate(['/']);
                    }
                }
            });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SlnBaseAuthRecoveryDoneComponent, deps: [{ token: i0.Injector }, { token: i1$7.Router }, { token: i1$7.ActivatedRoute }, { token: RegistrationService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: SlnBaseAuthRecoveryDoneComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SlnBaseAuthRecoveryDoneComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: i1$7.Router }, { type: i1$7.ActivatedRoute }, { type: RegistrationService }, { type: PopupResults }] });

class SlnBaseAuthRecoveryComponent extends CoreBasePage {
    constructor(injector, _registrationService) {
        super(injector);
        this._registrationService = _registrationService;
        this.done = false;
        this.errors = '';
    }
    recoverPassword() {
        this._registrationService.recover(this.email)
            .pipe(this.takeUntilDestroyed())
            .subscribe((result) => {
            this.done = result.isSuccess;
            if (result.isSuccess === false) {
                this.errors = result.message;
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SlnBaseAuthRecoveryComponent, deps: [{ token: i0.Injector }, { token: RegistrationService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: SlnBaseAuthRecoveryComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SlnBaseAuthRecoveryComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: RegistrationService }] });

// модель авторизационных данных для входа в приложение
class LoginModel {
}

var RegistrationType;
(function (RegistrationType) {
    RegistrationType["PhysicalPerson"] = "PhysicalPerson";
    RegistrationType["Juridical"] = "Juridical";
    RegistrationType["Individual"] = "Individual";
})(RegistrationType || (RegistrationType = {}));
var RegistrationMethod;
(function (RegistrationMethod) {
    RegistrationMethod["Password"] = "Password";
    RegistrationMethod["Mobile"] = "Mobile";
    RegistrationMethod["Signature"] = "Signature";
})(RegistrationMethod || (RegistrationMethod = {}));
class RegistrationData {
    constructor() {
        // согласие на обработку персональных данных
        this.consent = false;
        this.password = { password: '', confirm: '' };
    }
    cleenOrganizationData() {
        this.organizationId = 0;
        this.organizationName = '';
        this.organizationShortName = '';
        this.inn = '';
        this.kpp = '';
        this.ogrn = '';
        this.okopf = undefined;
    }
}

class SlnBaseAuthSigninComponent extends CoreSimplePage {
    get loginByPhoneEnabled() {
        return !!!this.VM?.Setting?.common?.isPhoneAuthorizationAllowed;
    }
    constructor(injector, _route, _authService, _cryptoM, _dialog, _service, _router, _documentService, _popUp, _sessionStorage) {
        super(injector);
        this._route = _route;
        this._authService = _authService;
        this._cryptoM = _cryptoM;
        this._dialog = _dialog;
        this._service = _service;
        this._router = _router;
        this._documentService = _documentService;
        this._popUp = _popUp;
        this._sessionStorage = _sessionStorage;
        this.dynamicMask = '';
        this.loginInputTitle = 'Email';
        this.loginByPhone = false;
        this.hidePassword = false;
    }
    ngOnInit() {
        super.ngOnInit();
        this.user = new LoginModel();
        this.returnUrl = this._route.snapshot.queryParams['returnUrl'] || '/dashboard';
    }
    login() {
        // стираем контент подписи, если перед авторизацией по логину/паролю была попытка авторизации по ЭП (неудачаная)
        this.user.signature = undefined;
        if (this.loginByPhone) {
            this.handlePhoneNumberLoginLogic();
        }
        else {
            this.handleLoginLogic();
        }
    }
    loginByCert(needRegister, cert) {
        this._cryptoM.verification((signature, certificate) => {
            this.user.signature = signature.signature;
            this._authService.login(decodeURIComponent(this.returnUrl), this.user, () => {
                if (needRegister) {
                    this._register(signature, certificate);
                }
            });
        }, !needRegister, undefined, cert);
    }
    _register(signature, certificate) {
        this._service.registrateSignData(signature.signature, certificate.attorneyId).subscribe((response) => this._popUp.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                let data = entity;
                data.registrationType = RegistrationType.Juridical;
                data.registrationMethod = RegistrationMethod.Signature;
                data.isBroker = false;
                data.attorneyId = certificate.attorneyId;
                data.text = signature.signature;
                this._registerInternal(data);
            }
        }));
    }
    _registerInternal(data) {
        this._service.registrate(data).subscribe((regResponse) => this._popUp.HandleIEntityResponse({
            response: regResponse,
            successCallback: () => {
                const user = new LoginModel();
                user.signature = data.text;
                this._authService.loginShadow(user, () => {
                    this._documentService.singRegistrateDocument(data, () => {
                        const url = this._sessionStorage.getItem('returnUrl');
                        this._sessionStorage.removeItem('returnUrl');
                        if (Utility.isEmpty(url))
                            this._router.navigate(['/']);
                        else
                            this._router.navigate([url]);
                    });
                });
            }
        }));
    }
    handlePhoneNumberLoginLogic() {
        const mfaRequest = { destination: this.user.login };
        const dialogRef = this._dialog.open(MfaDialogWindow, {
            data: mfaRequest
        });
        const sub = dialogRef.afterClosed().subscribe((result) => {
            if (result && result.state !== DialogReason.cancel && !Utility.isEmpty(result.challenge)) {
                const login = {
                    login: this.user.login.slice(-10)
                };
                this._authService.mobileLogin(decodeURIComponent(this.returnUrl), login, result.challenge);
            }
            sub.unsubscribe();
        });
    }
    handleLoginLogic(errorCallback) {
        if (this.VM.Setting.common.isTwoFactorEnabled) {
            this._authService.twoFactorLogin(decodeURIComponent(this.returnUrl), this.user, errorCallback);
        }
        else {
            this._authService.login(decodeURIComponent(this.returnUrl), this.user, errorCallback);
        }
    }
    handleCheckbox($event) {
        this.loginByPhone = !!$event?.checked;
        if (this.loginByPhone) {
            this.dynamicMask = '0 (000) 000-00-00';
            this.loginInputTitle = 'Мобильный телефон';
        }
        else {
            this.loginInputTitle = 'Email';
            this.dynamicMask = '';
        }
        this.user.login = '';
        this.user.password = '';
    }
    handleButton($event) {
        this.loginByPhone = true;
        this.dynamicMask = '0 (000) 000-00-00';
        this.loginInputTitle = 'Мобильный телефон';
        this.user.login = '';
        this.user.password = '';
    }
    handleButtonChange($event) {
        this.handleButton($event);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SlnBaseAuthSigninComponent, deps: [{ token: i0.Injector }, { token: i1$7.ActivatedRoute }, { token: AuthorizationService }, { token: CryptoSignService }, { token: i1$8.MatDialog }, { token: RegistrationService }, { token: i1$7.Router }, { token: RegistrationDocumentService }, { token: PopupResults }, { token: BrowserSessionStorage }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: SlnBaseAuthSigninComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: SlnBaseAuthSigninComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: i1$7.ActivatedRoute }, { type: AuthorizationService }, { type: CryptoSignService }, { type: i1$8.MatDialog }, { type: RegistrationService }, { type: i1$7.Router }, { type: RegistrationDocumentService }, { type: PopupResults }, { type: BrowserSessionStorage }] });

// уровни доступа
var AccessLvl;
(function (AccessLvl) {
    AccessLvl[AccessLvl["V"] = 0] = "V";
    AccessLvl[AccessLvl["A"] = 1] = "A";
    AccessLvl[AccessLvl["E"] = 2] = "E";
    AccessLvl[AccessLvl["D"] = 3] = "D"; // удаление
})(AccessLvl || (AccessLvl = {}));
// описание объета и уровня проверяки доступа к нему
class RouteAccessParam {
}

class CoreAbstractDictionaryCommonComponent extends CoreAbstractComponent {
    get isSystem() {
        return this.session?.organizations?.currentLink?.detail?.globalRoleId === RolesEnum.System;
    }
    constructor(injector) {
        super();
        this.detail = false;
        this.session = undefined;
        this.isFirstLoading = true;
        this.prefix = "";
        this.finish = new EventEmitter();
        this.valuesChange = new EventEmitter();
        const _cookieService = injector.get(BrowserLocalStorage);
        this.session = _cookieService.getTyped('user_session');
    }
    onNameChange($event) {
        if (this.loaded === true) {
            if (this.isFirstLoading === false) {
                if (!Utility.isEmpty($event)) {
                    this.item.key = StringExtension.translate($event);
                }
                else {
                    this.item.key = '';
                }
                this.onValuesChange($event);
            }
            else {
                this.isFirstLoading = false;
            }
        }
    }
    onValuesChange($event) {
        this.valuesChange.emit(this.item);
    }
    showDetail() {
        this.detail = !this.detail;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAbstractDictionaryCommonComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreAbstractDictionaryCommonComponent, isStandalone: false, selector: "ng-component", inputs: { loaded: "loaded", prefix: "prefix", item: "item" }, outputs: { finish: "finish", valuesChange: "valuesChange" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAbstractDictionaryCommonComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { loaded: [{
                type: Input
            }], prefix: [{
                type: Input
            }], item: [{
                type: Input
            }], finish: [{
                type: Output
            }], valuesChange: [{
                type: Output
            }] } });

class CoreDictionaryCommonComponent extends CoreAbstractDictionaryCommonComponent {
    ngOnInit() {
        if (!this.item) {
            this.item = new EditDictionaryItem();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryCommonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreDictionaryCommonComponent, isStandalone: false, selector: "core-dictionary-common", usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"form-group\" style=\"display: flex;\">\n    <core-field-string [(ngModel)]=\"item.name\" name=\"{{prefix}}name\" fieldName=\"{{prefix}}name\" placeholder=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\"\n    [settings]=\"{ isRequired: true, maxLength: 100 }\" (valueChange)=\"onNameChange($event)\" class=\"sln-max-width\"></core-field-string>\n    <ng-content></ng-content>\n  </div>\n  <div class=\"form-group\">\n    <core-field-textarea [(ngModel)]=\"item.description\" name=\"{{prefix}}description\" fieldName=\"{{prefix}}description\" placeholder=\"\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435\"\n    [settings]=\"{ maxLength: 500 }\" (valueChange)=\"onValuesChange($event)\"></core-field-textarea>\n  </div>\n  <div class=\"sln-dic-common-settings\">\n    <p class=\"sln-dic-common-settings-modal\">\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438:\n      <p (click)=\"showDetail()\" class=\"sln-dic-common-detail-modal sln-dic-common-detail-link\">{{ detail === true ? '\u0421\u043A\u0440\u044B\u0442\u044C': '\u041E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C' }}</p>\n    </div>\n    <div [hidden]=\"detail !== true\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.key\" name=\"{{prefix}}key\" fieldName=\"{{prefix}}key\" placeholder=\"\u041A\u043B\u044E\u0447\"\n        [settings]=\"{ isRequired: true, maxLength: 100, useInformer: true, informerText: '\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430 \u043A\u043B\u044E\u0447 \u0437\u0430\u043F\u0438\u0441\u0438' }\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n      <div style=\"display:flex\">\n        <div class=\"form-group\">\n          <core-field-bool [(ngModel)]=\"item.useSetedKey\" name=\"{{prefix}}useSetedKey\" fieldName=\"{{prefix}}useSetedKey\" placeholder=\"\u041D\u0435 \u0438\u0437\u043C\u0435\u043D\u044F\u0442\u044C \u043A\u043B\u044E\u0447\"\n          [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n        </div>\n        @if (isSystem) {\n          <div class=\"form-group\">\n            <core-field-bool [(ngModel)]=\"item.useForAll\" name=\"{{prefix}}useForAll\" fieldName=\"{{prefix}}useForAll\" placeholder=\"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432\u0441\u0435\u043C\"\n            [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n          </div>\n        }\n      </div>\n    </div>\n  </div>", styles: [""], dependencies: [{ kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldTypeTextareaComponent, selector: "core-field-textarea" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryCommonComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-dictionary-common', standalone: false, template: "<div provideParentForm>\n  <div class=\"form-group\" style=\"display: flex;\">\n    <core-field-string [(ngModel)]=\"item.name\" name=\"{{prefix}}name\" fieldName=\"{{prefix}}name\" placeholder=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\"\n    [settings]=\"{ isRequired: true, maxLength: 100 }\" (valueChange)=\"onNameChange($event)\" class=\"sln-max-width\"></core-field-string>\n    <ng-content></ng-content>\n  </div>\n  <div class=\"form-group\">\n    <core-field-textarea [(ngModel)]=\"item.description\" name=\"{{prefix}}description\" fieldName=\"{{prefix}}description\" placeholder=\"\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435\"\n    [settings]=\"{ maxLength: 500 }\" (valueChange)=\"onValuesChange($event)\"></core-field-textarea>\n  </div>\n  <div class=\"sln-dic-common-settings\">\n    <p class=\"sln-dic-common-settings-modal\">\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438:\n      <p (click)=\"showDetail()\" class=\"sln-dic-common-detail-modal sln-dic-common-detail-link\">{{ detail === true ? '\u0421\u043A\u0440\u044B\u0442\u044C': '\u041E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C' }}</p>\n    </div>\n    <div [hidden]=\"detail !== true\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.key\" name=\"{{prefix}}key\" fieldName=\"{{prefix}}key\" placeholder=\"\u041A\u043B\u044E\u0447\"\n        [settings]=\"{ isRequired: true, maxLength: 100, useInformer: true, informerText: '\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430 \u043A\u043B\u044E\u0447 \u0437\u0430\u043F\u0438\u0441\u0438' }\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n      <div style=\"display:flex\">\n        <div class=\"form-group\">\n          <core-field-bool [(ngModel)]=\"item.useSetedKey\" name=\"{{prefix}}useSetedKey\" fieldName=\"{{prefix}}useSetedKey\" placeholder=\"\u041D\u0435 \u0438\u0437\u043C\u0435\u043D\u044F\u0442\u044C \u043A\u043B\u044E\u0447\"\n          [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n        </div>\n        @if (isSystem) {\n          <div class=\"form-group\">\n            <core-field-bool [(ngModel)]=\"item.useForAll\" name=\"{{prefix}}useForAll\" fieldName=\"{{prefix}}useForAll\" placeholder=\"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432\u0441\u0435\u043C\"\n            [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n          </div>\n        }\n      </div>\n    </div>\n  </div>" }]
        }] });

class CoreDictionaryFileTypeComponent extends CoreAbstractDictionaryCommonComponent {
    ngOnInit() {
        if (!this.item) {
            this.item = new FileTypeItem();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryFileTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreDictionaryFileTypeComponent, isStandalone: false, selector: "core-dictionary-file-type", usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"form-group\" style=\"display: flex;\">\n    <core-field-string [(ngModel)]=\"item.name\" name=\"{{prefix}}name\" fieldName=\"{{prefix}}name\" placeholder=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\"\n    [settings]=\"{ isRequired: true, maxLength: 100 }\" (valueChange)=\"onNameChange($event)\" class=\"sln-max-width\"></core-field-string>\n    <ng-content></ng-content>\n  </div>\n  <div class=\"form-group\">\n    <core-field-textarea [(ngModel)]=\"item.description\" name=\"{{prefix}}description\" fieldName=\"{{prefix}}description\" placeholder=\"\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435\"\n    [settings]=\"{  isRequired: true, maxLength: 500 }\" (valueChange)=\"onValuesChange($event)\"></core-field-textarea>\n  </div>\n  <div class=\"sln-dic-common-settings\">\n    <p class=\"sln-dic-common-settings-modal\">\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438:\n      <p (click)=\"showDetail()\" class=\"sln-dic-common-detail-modal sln-dic-common-detail-link\">{{ detail === true ? '\u0421\u043A\u0440\u044B\u0442\u044C': '\u041E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C' }}</p>\n    </div>\n    <div [hidden]=\"detail !== true\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.key\" name=\"{{prefix}}key\" fieldName=\"{{prefix}}key\" placeholder=\"\u041A\u043B\u044E\u0447\"\n        [settings]=\"{ isRequired: true, maxLength: 100, useInformer: true, informerText: '\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430 \u043A\u043B\u044E\u0447 \u0437\u0430\u043F\u0438\u0441\u0438' }\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n      <div class=\"sln-additional-settings-key\">\n        <div class=\"form-group\">\n          <core-field-bool [(ngModel)]=\"item.useSetedKey\" name=\"{{prefix}}useSetedKey\" fieldName=\"{{prefix}}useSetedKey\" placeholder=\"\u041D\u0435 \u0438\u0437\u043C\u0435\u043D\u044F\u0442\u044C \u043A\u043B\u044E\u0447\"\n          [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n        </div>\n        @if (isSystem) {\n          <div class=\"form-group\">\n            <core-field-bool [(ngModel)]=\"item.useForAll\" name=\"{{prefix}}useForAll\" fieldName=\"{{prefix}}useForAll\" placeholder=\"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432\u0441\u0435\u043C\"\n            [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n          </div>\n        }\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.isVersioned\" name=\"{{prefix}}isVersioned\" fieldName=\"{{prefix}}isVersioned\" placeholder=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u0435\u0440\u0441\u0438\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      @if (item.isVersioned) {\n        <div class=\"form-group\" style=\"margin-top: 10px;\">\n          <core-field-combobox [(ngModel)]=\"item.versionLevel\" name=\"{{prefix}}versionLevel\" fieldName=\"{{prefix}}versionLevel\" placeholder=\"\u0423\u0440\u043E\u0432\u0435\u043D\u044C \u0432\u0435\u0440\u0441\u0438\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\"\n          [settings]=\"{ sourceCode:'Local_VersionLevels', isRequired: item.isVersioned }\" (valueChange)=\"onValuesChange($event)\" class=\"sln-core-field-combobox\"></core-field-combobox>\n        </div>\n      }\n      @if (item.isVersioned) {\n        <div class=\"form-group\">\n          <core-field-bool [(ngModel)]=\"item.isMultiVersioned\" name=\"{{prefix}}isMultiVersioned\" fieldName=\"{{prefix}}isMultiVersioned\" placeholder=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043C\u0443\u043B\u044C\u0442\u0438\u0432\u0435\u0440\u0441\u0438\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\"\n          [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n        </div>\n      }\n    </div>\n  </div>", dependencies: [{ kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldTypeTextareaComponent, selector: "core-field-textarea" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryFileTypeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-dictionary-file-type', standalone: false, template: "<div provideParentForm>\n  <div class=\"form-group\" style=\"display: flex;\">\n    <core-field-string [(ngModel)]=\"item.name\" name=\"{{prefix}}name\" fieldName=\"{{prefix}}name\" placeholder=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\"\n    [settings]=\"{ isRequired: true, maxLength: 100 }\" (valueChange)=\"onNameChange($event)\" class=\"sln-max-width\"></core-field-string>\n    <ng-content></ng-content>\n  </div>\n  <div class=\"form-group\">\n    <core-field-textarea [(ngModel)]=\"item.description\" name=\"{{prefix}}description\" fieldName=\"{{prefix}}description\" placeholder=\"\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435\"\n    [settings]=\"{  isRequired: true, maxLength: 500 }\" (valueChange)=\"onValuesChange($event)\"></core-field-textarea>\n  </div>\n  <div class=\"sln-dic-common-settings\">\n    <p class=\"sln-dic-common-settings-modal\">\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438:\n      <p (click)=\"showDetail()\" class=\"sln-dic-common-detail-modal sln-dic-common-detail-link\">{{ detail === true ? '\u0421\u043A\u0440\u044B\u0442\u044C': '\u041E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C' }}</p>\n    </div>\n    <div [hidden]=\"detail !== true\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.key\" name=\"{{prefix}}key\" fieldName=\"{{prefix}}key\" placeholder=\"\u041A\u043B\u044E\u0447\"\n        [settings]=\"{ isRequired: true, maxLength: 100, useInformer: true, informerText: '\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430 \u043A\u043B\u044E\u0447 \u0437\u0430\u043F\u0438\u0441\u0438' }\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n      <div class=\"sln-additional-settings-key\">\n        <div class=\"form-group\">\n          <core-field-bool [(ngModel)]=\"item.useSetedKey\" name=\"{{prefix}}useSetedKey\" fieldName=\"{{prefix}}useSetedKey\" placeholder=\"\u041D\u0435 \u0438\u0437\u043C\u0435\u043D\u044F\u0442\u044C \u043A\u043B\u044E\u0447\"\n          [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n        </div>\n        @if (isSystem) {\n          <div class=\"form-group\">\n            <core-field-bool [(ngModel)]=\"item.useForAll\" name=\"{{prefix}}useForAll\" fieldName=\"{{prefix}}useForAll\" placeholder=\"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432\u0441\u0435\u043C\"\n            [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n          </div>\n        }\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.isVersioned\" name=\"{{prefix}}isVersioned\" fieldName=\"{{prefix}}isVersioned\" placeholder=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u0435\u0440\u0441\u0438\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      @if (item.isVersioned) {\n        <div class=\"form-group\" style=\"margin-top: 10px;\">\n          <core-field-combobox [(ngModel)]=\"item.versionLevel\" name=\"{{prefix}}versionLevel\" fieldName=\"{{prefix}}versionLevel\" placeholder=\"\u0423\u0440\u043E\u0432\u0435\u043D\u044C \u0432\u0435\u0440\u0441\u0438\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\"\n          [settings]=\"{ sourceCode:'Local_VersionLevels', isRequired: item.isVersioned }\" (valueChange)=\"onValuesChange($event)\" class=\"sln-core-field-combobox\"></core-field-combobox>\n        </div>\n      }\n      @if (item.isVersioned) {\n        <div class=\"form-group\">\n          <core-field-bool [(ngModel)]=\"item.isMultiVersioned\" name=\"{{prefix}}isMultiVersioned\" fieldName=\"{{prefix}}isMultiVersioned\" placeholder=\"\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043C\u0443\u043B\u044C\u0442\u0438\u0432\u0435\u0440\u0441\u0438\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F\"\n          [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n        </div>\n      }\n    </div>\n  </div>" }]
        }] });

class StatusItem extends EditDictionaryItem {
    constructor() {
        super();
        this.metadata = new StatusMetadata();
    }
}
class StatusMetadata {
    constructor() {
        this.hidden = { forCustomer: false, forBroker: false, forProvider: false };
    }
}

class CoreDictionaryStatusComponent extends CoreAbstractDictionaryCommonComponent {
    ngOnInit() {
        if (!this.item) {
            this.item = new StatusItem();
        }
        if (!this.item.metadata) {
            this.item.metadata = new StatusMetadata();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryStatusComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreDictionaryStatusComponent, isStandalone: false, selector: "core-dictionary-status", usesInheritance: true, ngImport: i0, template: "<div provideParentForm class=\"sln-dictionary-status-modal\">\n  <div class=\"form-group\" style=\"display: flex;\">\n    <core-field-string [(ngModel)]=\"item.name\" name=\"{{prefix}}name\" fieldName=\"{{prefix}}name\" placeholder=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\"\n    [settings]=\"{ isRequired: true, maxLength: 100 }\" (valueChange)=\"onNameChange($event)\" class=\"sln-max-width\"></core-field-string>\n    <ng-content></ng-content>\n  </div>\n  <div class=\"form-group\">\n    <core-field-textarea [(ngModel)]=\"item.description\" name=\"{{prefix}}description\" fieldName=\"{{prefix}}description\" placeholder=\"\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435\"\n    [settings]=\"{  isRequired: true, maxLength: 500 }\" (valueChange)=\"onValuesChange($event)\"></core-field-textarea>\n  </div>\n  <div class=\"form-group\">\n    <core-field-combobox [(ngModel)]=\"item.statusGroup\" name=\"{{prefix}}statusGroup\" fieldName=\"{{prefix}}statusGroup\" placeholder=\"\u0413\u0440\u0443\u043F\u043F\u0430 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u043E\u0432\"\n    [settings]=\"{ sourceCode:'StatusesGroup', isRequired: true }\" (valueChange)=\"onValuesChange($event)\" class=\"sln-core-field-combobox\"></core-field-combobox>\n  </div>\n  <div class=\"sln-dic-common-settings\">\n    <p class=\"sln-dic-common-settings-modal\">\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438:\n      <p (click)=\"showDetail()\" class=\"sln-dic-common-detail-modal sln-dic-common-detail-link\">{{ detail === true ? '\u0421\u043A\u0440\u044B\u0442\u044C': '\u041E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C' }}</p>\n    </div>\n    <div [hidden]=\"detail !== true\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.key\" name=\"{{prefix}}key\" fieldName=\"{{prefix}}key\" placeholder=\"\u041A\u043B\u044E\u0447\"\n        [settings]=\"{ isRequired: true, maxLength: 100, useInformer: true, informerText: '\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430 \u043A\u043B\u044E\u0447 \u0437\u0430\u043F\u0438\u0441\u0438' }\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n      <div style=\"display:flex\">\n        <div class=\"form-group\">\n          <core-field-bool [(ngModel)]=\"item.useSetedKey\" name=\"{{prefix}}useSetedKey\" fieldName=\"{{prefix}}useSetedKey\" placeholder=\"\u041D\u0435 \u0438\u0437\u043C\u0435\u043D\u044F\u0442\u044C \u043A\u043B\u044E\u0447\"\n          [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n        </div>\n        @if (isSystem) {\n          <div class=\"form-group\">\n            <core-field-bool [(ngModel)]=\"item.useForAll\" name=\"{{prefix}}useForAll\" fieldName=\"{{prefix}}useForAll\" placeholder=\"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432\u0441\u0435\u043C\"\n            [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n          </div>\n        }\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.needComment\" name=\"{{prefix}}needComment\" fieldName=\"{{prefix}}needComment\" placeholder=\"\u0422\u0440\u0435\u0431\u043E\u0432\u0430\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.brokerEditable\" name=\"{{prefix}}brokerEditable\" fieldName=\"{{prefix}}brokerEditable\" placeholder=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u0443\u0435\u043C\u044B\u0439 \u0431\u0440\u043E\u043A\u0435\u0440\u043E\u043C\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-color [(ngModel)]=\"item.metadata.foregroundColor\" name=\"{{prefix}}foregroundColor\" fieldName=\"{{prefix}}foregroundColor\" placeholder=\"\u0426\u0432\u0435\u0442 \u0442\u0435\u043A\u0441\u0442\u0430\"\n        [settings]=\"{ mode: 'Color' }\" (valueChange)=\"onValuesChange($event)\"></core-field-color>\n      </div>\n      <div class=\"form-group\">\n        <core-field-color [(ngModel)]=\"item.metadata.backgroundColor\" name=\"{{prefix}}backgroundColor\" fieldName=\"{{prefix}}backgroundColor\" placeholder=\"\u0426\u0432\u0435\u0442 \u0444\u043E\u043D\u0430\"\n        [settings]=\"{ mode: 'Color' }\" (valueChange)=\"onValuesChange($event)\"></core-field-color>\n      </div>\n\n\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.hidden.forCustomer\" name=\"{{prefix}}hidden_forCustomer\" fieldName=\"{{prefix}}hidden_forCustomer\" placeholder=\"\u0421\u043A\u0440\u044B\u0442\u044C \u041F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u044E\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.hidden.forBroker\" name=\"{{prefix}}hidden_forBroker\" fieldName=\"{{prefix}}hidden_forBroker\" placeholder=\"\u0421\u043A\u0440\u044B\u0442\u044C \u0411\u0440\u043E\u043A\u0435\u0440\u0443\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.hidden.forProvider\" name=\"{{prefix}}hidden_forProvider\" fieldName=\"{{prefix}}hidden_forProvider\" placeholder=\"\u0421\u043A\u0440\u044B\u0442\u044C \u041F\u043E\u0441\u0442\u0430\u0432\u0449\u0438\u043A\u0443\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-number [(ngModel)]=\"item.sort\" name=\"{{prefix}}sort\" fieldName=\"{{prefix}}sort\" placeholder=\"\u041F\u043E\u0440\u044F\u0434\u043E\u043A \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438\"\n        [settings]=\"{ decimals: 2 }\"></core-field-number>\n      </div>\n    </div>\n  </div>", styles: [""], dependencies: [{ kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeNumberComponent, selector: "core-field-number", inputs: ["isInt"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldTypeTextareaComponent, selector: "core-field-textarea" }, { kind: "component", type: CoreFieldColorComponent, selector: "core-field-color" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryStatusComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-dictionary-status', standalone: false, template: "<div provideParentForm class=\"sln-dictionary-status-modal\">\n  <div class=\"form-group\" style=\"display: flex;\">\n    <core-field-string [(ngModel)]=\"item.name\" name=\"{{prefix}}name\" fieldName=\"{{prefix}}name\" placeholder=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\"\n    [settings]=\"{ isRequired: true, maxLength: 100 }\" (valueChange)=\"onNameChange($event)\" class=\"sln-max-width\"></core-field-string>\n    <ng-content></ng-content>\n  </div>\n  <div class=\"form-group\">\n    <core-field-textarea [(ngModel)]=\"item.description\" name=\"{{prefix}}description\" fieldName=\"{{prefix}}description\" placeholder=\"\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435\"\n    [settings]=\"{  isRequired: true, maxLength: 500 }\" (valueChange)=\"onValuesChange($event)\"></core-field-textarea>\n  </div>\n  <div class=\"form-group\">\n    <core-field-combobox [(ngModel)]=\"item.statusGroup\" name=\"{{prefix}}statusGroup\" fieldName=\"{{prefix}}statusGroup\" placeholder=\"\u0413\u0440\u0443\u043F\u043F\u0430 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u043E\u0432\"\n    [settings]=\"{ sourceCode:'StatusesGroup', isRequired: true }\" (valueChange)=\"onValuesChange($event)\" class=\"sln-core-field-combobox\"></core-field-combobox>\n  </div>\n  <div class=\"sln-dic-common-settings\">\n    <p class=\"sln-dic-common-settings-modal\">\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438:\n      <p (click)=\"showDetail()\" class=\"sln-dic-common-detail-modal sln-dic-common-detail-link\">{{ detail === true ? '\u0421\u043A\u0440\u044B\u0442\u044C': '\u041E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C' }}</p>\n    </div>\n    <div [hidden]=\"detail !== true\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.key\" name=\"{{prefix}}key\" fieldName=\"{{prefix}}key\" placeholder=\"\u041A\u043B\u044E\u0447\"\n        [settings]=\"{ isRequired: true, maxLength: 100, useInformer: true, informerText: '\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430 \u043A\u043B\u044E\u0447 \u0437\u0430\u043F\u0438\u0441\u0438' }\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n      <div style=\"display:flex\">\n        <div class=\"form-group\">\n          <core-field-bool [(ngModel)]=\"item.useSetedKey\" name=\"{{prefix}}useSetedKey\" fieldName=\"{{prefix}}useSetedKey\" placeholder=\"\u041D\u0435 \u0438\u0437\u043C\u0435\u043D\u044F\u0442\u044C \u043A\u043B\u044E\u0447\"\n          [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n        </div>\n        @if (isSystem) {\n          <div class=\"form-group\">\n            <core-field-bool [(ngModel)]=\"item.useForAll\" name=\"{{prefix}}useForAll\" fieldName=\"{{prefix}}useForAll\" placeholder=\"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432\u0441\u0435\u043C\"\n            [settings]=\"{ mode: 'Checkbox' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n          </div>\n        }\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.needComment\" name=\"{{prefix}}needComment\" fieldName=\"{{prefix}}needComment\" placeholder=\"\u0422\u0440\u0435\u0431\u043E\u0432\u0430\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.brokerEditable\" name=\"{{prefix}}brokerEditable\" fieldName=\"{{prefix}}brokerEditable\" placeholder=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u0443\u0435\u043C\u044B\u0439 \u0431\u0440\u043E\u043A\u0435\u0440\u043E\u043C\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-color [(ngModel)]=\"item.metadata.foregroundColor\" name=\"{{prefix}}foregroundColor\" fieldName=\"{{prefix}}foregroundColor\" placeholder=\"\u0426\u0432\u0435\u0442 \u0442\u0435\u043A\u0441\u0442\u0430\"\n        [settings]=\"{ mode: 'Color' }\" (valueChange)=\"onValuesChange($event)\"></core-field-color>\n      </div>\n      <div class=\"form-group\">\n        <core-field-color [(ngModel)]=\"item.metadata.backgroundColor\" name=\"{{prefix}}backgroundColor\" fieldName=\"{{prefix}}backgroundColor\" placeholder=\"\u0426\u0432\u0435\u0442 \u0444\u043E\u043D\u0430\"\n        [settings]=\"{ mode: 'Color' }\" (valueChange)=\"onValuesChange($event)\"></core-field-color>\n      </div>\n\n\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.hidden.forCustomer\" name=\"{{prefix}}hidden_forCustomer\" fieldName=\"{{prefix}}hidden_forCustomer\" placeholder=\"\u0421\u043A\u0440\u044B\u0442\u044C \u041F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u044E\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.hidden.forBroker\" name=\"{{prefix}}hidden_forBroker\" fieldName=\"{{prefix}}hidden_forBroker\" placeholder=\"\u0421\u043A\u0440\u044B\u0442\u044C \u0411\u0440\u043E\u043A\u0435\u0440\u0443\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-bool [(ngModel)]=\"item.metadata.hidden.forProvider\" name=\"{{prefix}}hidden_forProvider\" fieldName=\"{{prefix}}hidden_forProvider\" placeholder=\"\u0421\u043A\u0440\u044B\u0442\u044C \u041F\u043E\u0441\u0442\u0430\u0432\u0449\u0438\u043A\u0443\"\n        [settings]=\"{ mode: 'Slide' }\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n      </div>\n      <div class=\"form-group\">\n        <core-field-number [(ngModel)]=\"item.sort\" name=\"{{prefix}}sort\" fieldName=\"{{prefix}}sort\" placeholder=\"\u041F\u043E\u0440\u044F\u0434\u043E\u043A \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438\"\n        [settings]=\"{ decimals: 2 }\"></core-field-number>\n      </div>\n    </div>\n  </div>" }]
        }] });

var InlineDictionaryAction;
(function (InlineDictionaryAction) {
    InlineDictionaryAction["Add"] = "add";
    InlineDictionaryAction["Cancel"] = "cancel";
    InlineDictionaryAction["Save"] = "save";
})(InlineDictionaryAction || (InlineDictionaryAction = {}));
class CoreEditInlineDictionaryComponent extends CoreBaseDestroyComponent {
    constructor(_injector, _ajaxM, _popup) {
        super();
        this._injector = _injector;
        this._ajaxM = _ajaxM;
        this._popup = _popup;
        this.loaded = true;
        this.editMode = false;
        this.item = {};
        this.conf = { type: 'default', saved: '' };
        this.editEv = new EventEmitter();
    }
    ngOnInit() {
        if (this.conf?.item) {
            this.item = this.conf.item;
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this.method = InlineDictionaryAction.Cancel;
        this.editEv.emit({ method: this.method });
    }
    add() {
        this.editMode = true;
        this.method = InlineDictionaryAction.Add;
        this.editEv.emit({ method: this.method });
    }
    cancel() {
        this.editMode = false;
        this.item = {};
        this.method = InlineDictionaryAction.Cancel;
        this.editEv.emit({ method: this.method });
    }
    save() {
        if (!Utility.isEmpty(this.conf?.saved)) {
            if (!this.item.organization) {
                const _cookieService = this._injector.get(BrowserLocalStorage);
                const session = _cookieService.getTyped('user_session');
                if (session) {
                    this.item.organization = { id: session.organizations?.currentLink?.organizationId, text: null, description: null };
                }
            }
            if (Utility.isEmpty(this.item.useSetedKey)) {
                this.item.useSetedKey = false;
            }
            if (Utility.isEmpty(this.item.useForAll)) {
                this.item.useForAll = false;
            }
            this._ajaxM
                .post({ url: this.conf.saved, data: this.item })
                .pipe(this.takeUntilDestroyed())
                .subscribe(response => this._popup.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this.editMode = false;
                    this.method = InlineDictionaryAction.Save;
                    this.editEv.emit({ method: this.method, item: entity });
                    this.item = {};
                }
            }));
        }
        else {
            console.error('Не передан URL для сохранения данных.');
        }
    }
    onValuesChange($event) {
        this.item = $event;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreEditInlineDictionaryComponent, deps: [{ token: i0.Injector }, { token: AjaxService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreEditInlineDictionaryComponent, isStandalone: false, selector: "core-inline-dic-item", inputs: { conf: "conf" }, outputs: { editEv: "editEv" }, usesInheritance: true, ngImport: i0, template: "@if (!editMode) {\n  <div class=\"sln-edit-inline-dic-btn\" matTooltip=\"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043D\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\" matTooltipPosition=\"above\"  >\n    <button  class=\"sln-add-button\" (click)=\"add()\">\n      <div class=\"sln-add-plus sln-add-plus-position\"></div>\n    </button>\n  </div>\n}\n@if (editMode) {\n  <div>\n    <core-field-string [hidden]=\"true\" [(ngModel)]=\"inlineAdd\" name=\"inline_status\" fieldName=\"inline_status\" [settings]=\"{ isRequired: true }\"></core-field-string>\n    <div>\n      @switch (conf.type) {\n        @case ('status') {\n          <core-dictionary-status prefix=\"inline-add-\" [item]=\"item\" [loaded]=\"loaded\" (valuesChange)=\"onValuesChange($event)\">\n            <div class=\"sln-edit-inline-dic-btn sln-edit-inline-dic-action-btn\">\n              <div  matTooltip=\"\u041E\u0442\u043C\u0435\u043D\u0430\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-cancel-btn\">\n                  <div class=\"sln-dictionary-cancel sln-dictionary-cancel-position\" (click)=\"cancel()\"></div>\n                </button>\n              </div>\n              <div  matTooltip=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-save-btn\">\n                  <div class=\"sln-dictionary-save sln-dictionary-save-position\" (click)=\"save()\"></div>\n                </button>\n              </div>\n            </div>\n          </core-dictionary-status>\n        }\n        @case ('file-type') {\n          <core-dictionary-file-type prefix=\"inline-add-\" [item]=\"item\" [loaded]=\"loaded\" (valuesChange)=\"onValuesChange($event)\">\n            <div class=\"sln-edit-inline-dic-btn sln-edit-inline-dic-action-btn\">\n              <div  matTooltip=\"\u041E\u0442\u043C\u0435\u043D\u0430\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-cancel-btn\">\n                  <div class=\"sln-dictionary-cancel sln-dictionary-cancel-position\" (click)=\"cancel()\"></div>\n                </button>\n              </div>\n              <div  matTooltip=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-save-btn\">\n                  <div class=\"sln-dictionary-save sln-dictionary-save-position\" (click)=\"save()\"></div>\n                </button>\n              </div>\n            </div>\n          </core-dictionary-file-type>\n        }\n        @default {\n          <core-dictionary-common prefix=\"inline-add-\" [item]=\"item\" [loaded]=\"loaded\" (valuesChange)=\"onValuesChange($event)\">\n            <div class=\"sln-edit-inline-dic-btn sln-edit-inline-dic-action-btn\">\n              <div  matTooltip=\"\u041E\u0442\u043C\u0435\u043D\u0430\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-cancel-btn\">\n                  <div class=\"sln-dictionary-cancel sln-dictionary-cancel-position\" (click)=\"cancel()\"></div>\n                </button>\n              </div>\n              <div  matTooltip=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-save-btn\">\n                  <div class=\"sln-dictionary-save sln-dictionary-save-position\" (click)=\"save()\"></div>\n                </button>\n              </div>\n            </div>\n          </core-dictionary-common>\n        }\n      }\n    </div>\n  </div>\n}", styles: [".sln-edit-inline-dic-btn>button{margin-top:18px;margin-left:10px;margin-right:0}.sln-edit-inline-dic-action-btn{display:inline-flex;height:100%;margin-top:5px}.sln-cancel-btn{margin-left:10px}\n"], dependencies: [{ kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreDictionaryCommonComponent, selector: "core-dictionary-common" }, { kind: "component", type: CoreDictionaryFileTypeComponent, selector: "core-dictionary-file-type" }, { kind: "component", type: CoreDictionaryStatusComponent, selector: "core-dictionary-status" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreEditInlineDictionaryComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-inline-dic-item', standalone: false, template: "@if (!editMode) {\n  <div class=\"sln-edit-inline-dic-btn\" matTooltip=\"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043D\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\" matTooltipPosition=\"above\"  >\n    <button  class=\"sln-add-button\" (click)=\"add()\">\n      <div class=\"sln-add-plus sln-add-plus-position\"></div>\n    </button>\n  </div>\n}\n@if (editMode) {\n  <div>\n    <core-field-string [hidden]=\"true\" [(ngModel)]=\"inlineAdd\" name=\"inline_status\" fieldName=\"inline_status\" [settings]=\"{ isRequired: true }\"></core-field-string>\n    <div>\n      @switch (conf.type) {\n        @case ('status') {\n          <core-dictionary-status prefix=\"inline-add-\" [item]=\"item\" [loaded]=\"loaded\" (valuesChange)=\"onValuesChange($event)\">\n            <div class=\"sln-edit-inline-dic-btn sln-edit-inline-dic-action-btn\">\n              <div  matTooltip=\"\u041E\u0442\u043C\u0435\u043D\u0430\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-cancel-btn\">\n                  <div class=\"sln-dictionary-cancel sln-dictionary-cancel-position\" (click)=\"cancel()\"></div>\n                </button>\n              </div>\n              <div  matTooltip=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-save-btn\">\n                  <div class=\"sln-dictionary-save sln-dictionary-save-position\" (click)=\"save()\"></div>\n                </button>\n              </div>\n            </div>\n          </core-dictionary-status>\n        }\n        @case ('file-type') {\n          <core-dictionary-file-type prefix=\"inline-add-\" [item]=\"item\" [loaded]=\"loaded\" (valuesChange)=\"onValuesChange($event)\">\n            <div class=\"sln-edit-inline-dic-btn sln-edit-inline-dic-action-btn\">\n              <div  matTooltip=\"\u041E\u0442\u043C\u0435\u043D\u0430\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-cancel-btn\">\n                  <div class=\"sln-dictionary-cancel sln-dictionary-cancel-position\" (click)=\"cancel()\"></div>\n                </button>\n              </div>\n              <div  matTooltip=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-save-btn\">\n                  <div class=\"sln-dictionary-save sln-dictionary-save-position\" (click)=\"save()\"></div>\n                </button>\n              </div>\n            </div>\n          </core-dictionary-file-type>\n        }\n        @default {\n          <core-dictionary-common prefix=\"inline-add-\" [item]=\"item\" [loaded]=\"loaded\" (valuesChange)=\"onValuesChange($event)\">\n            <div class=\"sln-edit-inline-dic-btn sln-edit-inline-dic-action-btn\">\n              <div  matTooltip=\"\u041E\u0442\u043C\u0435\u043D\u0430\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-cancel-btn\">\n                  <div class=\"sln-dictionary-cancel sln-dictionary-cancel-position\" (click)=\"cancel()\"></div>\n                </button>\n              </div>\n              <div  matTooltip=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\" matTooltipPosition=\"above\"  >\n                <button class=\"sln-save-btn\">\n                  <div class=\"sln-dictionary-save sln-dictionary-save-position\" (click)=\"save()\"></div>\n                </button>\n              </div>\n            </div>\n          </core-dictionary-common>\n        }\n      }\n    </div>\n  </div>\n}", styles: [".sln-edit-inline-dic-btn>button{margin-top:18px;margin-left:10px;margin-right:0}.sln-edit-inline-dic-action-btn{display:inline-flex;height:100%;margin-top:5px}.sln-cancel-btn{margin-left:10px}\n"] }]
        }], ctorParameters: () => [{ type: i0.Injector }, { type: AjaxService }, { type: PopupResults }], propDecorators: { conf: [{
                type: Input
            }], editEv: [{
                type: Output
            }] } });

class CoreDictionaryModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryModule, declarations: [CoreEditInlineDictionaryComponent,
            CoreDictionaryCommonComponent,
            CoreDictionaryFileTypeComponent,
            CoreDictionaryStatusComponent], imports: [CoreMatModule,
            CoreDialogModule,
            CoreControlModule,
            CoreBaseModule], exports: [CoreEditInlineDictionaryComponent,
            CoreDictionaryCommonComponent,
            CoreDictionaryFileTypeComponent,
            CoreDictionaryStatusComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryModule, imports: [CoreMatModule,
            CoreDialogModule,
            CoreControlModule,
            CoreBaseModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreDictionaryModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreEditInlineDictionaryComponent,
                        CoreDictionaryCommonComponent,
                        CoreDictionaryFileTypeComponent,
                        CoreDictionaryStatusComponent
                    ],
                    imports: [
                        CoreMatModule,
                        CoreDialogModule,
                        CoreControlModule,
                        CoreBaseModule
                    ],
                    exports: [
                        CoreEditInlineDictionaryComponent,
                        CoreDictionaryCommonComponent,
                        CoreDictionaryFileTypeComponent,
                        CoreDictionaryStatusComponent
                    ]
                }]
        }] });

var SystemObjectSelectedType;
(function (SystemObjectSelectedType) {
    // Получать только внутренние системные объекты
    SystemObjectSelectedType[SystemObjectSelectedType["OnlySystem"] = 1] = "OnlySystem";
    // Получать только пользовательские системные объекты
    SystemObjectSelectedType[SystemObjectSelectedType["NotSystem"] = 2] = "NotSystem";
    // Получать все типы системных объектов
    SystemObjectSelectedType[SystemObjectSelectedType["All"] = 3] = "All";
})(SystemObjectSelectedType || (SystemObjectSelectedType = {}));

var NationalityEnum;
(function (NationalityEnum) {
    NationalityEnum["Russian"] = "Russian";
    NationalityEnum["NoCitizenship"] = "NoCitizenship";
    NationalityEnum["Other"] = "Other";
})(NationalityEnum || (NationalityEnum = {}));
var DocumentTypeEnum;
(function (DocumentTypeEnum) {
    DocumentTypeEnum[DocumentTypeEnum["None"] = 1] = "None";
    DocumentTypeEnum[DocumentTypeEnum["Passport"] = 2] = "Passport";
    DocumentTypeEnum[DocumentTypeEnum["InternationalPassport"] = 3] = "InternationalPassport";
    DocumentTypeEnum[DocumentTypeEnum["MigrationCard"] = 18] = "MigrationCard";
    DocumentTypeEnum[DocumentTypeEnum["Visa"] = 19] = "Visa";
    DocumentTypeEnum[DocumentTypeEnum["TemporaryResidencePermits"] = 20] = "TemporaryResidencePermits";
    DocumentTypeEnum[DocumentTypeEnum["ResidencePermits"] = 21] = "ResidencePermits";
})(DocumentTypeEnum || (DocumentTypeEnum = {}));
let Document$1 = class Document {
    get toString() {
        if (Utility.isEmpty(this.serial) && Utility.isEmpty(this.number) && Utility.isEmpty(this.issueDate) && Utility.isEmpty(this.authority)) {
            return '';
        }
        const type = this.documentType?.id === 1 ? this.otherDocumentType : this.documentType?.text;
        let document = type + ' cерия: ' + this.serial + ', номер: ' + this.number + ', выдан: ' + DateExtension?.format(this.issueDate, 'DD.MM.YYYY') + ', кем: ' + this.authority;
        if (!Utility.isEmpty(this.code)) {
            document += ' код подразделения: ' + this.code;
        }
        if (!Utility.isEmpty(this.dateFrom) && !Utility.isEmpty(this.dateTo)) {
            document += ' срок действия: с ' + DateExtension.format(this.dateFrom, 'DD.MM.YYYY') + ' по ' + DateExtension.format(this.dateTo, 'DD.MM.YYYY');
        }
        return document;
    }
};
class IdentificationDocument {
    constructor() {
        this.personIdentificationDocumentId = 0;
        this.isNeedResidencePermitDocument = false;
        this.nationalityCountry = { id: 'RU', text: '', description: null };
        this.identificationDocument = new Document$1();
        this.identificationDocument.documentType = { id: Number(DocumentTypeEnum.Passport), text: '', description: null };
        this.residencePermitDocument = new Document$1();
        this.residencePermitDocument.documentType = { id: null, text: null, description: null };
    }
}

class CoreIdentificationDocCardComponent extends CoreAbstractComponent {
    constructor() {
        super(...arguments);
        this.valueChange = new EventEmitter();
        this.russianIdentificationDocumentIds = [1, 2];
        this.noCitizenshipIdentificationDocumentIds = [1, 20, 21];
        this.otherIdentificationDocumentIds = [1, 3];
    }
    get nowDate() {
        return new Date();
    }
    get minDate() {
        return new Date(1920, 0, 1);
    }
    ngOnInit() {
        if (this.item) {
            this.identificationDocumentConfig = new UploaderConfig(FileTypeEnum.Passport);
            this.identificationDocumentConfig.typeName = 'Документ удостоверяющий личность';
            this.identificationDocumentConfig.isNeedSign = false;
            this.identificationDocumentConfig.isRequired = true;
            this.residencePermitDocumentConfig = new UploaderConfig(FileTypeEnum.TemporaryResidencePermits);
            this.residencePermitDocumentConfig.typeName = 'Документ на право пребывания';
            this.residencePermitDocumentConfig.isNeedSign = false;
            this.residencePermitDocumentConfig.isRequired = true;
            if (Utility.isEmpty(this.item.nationalityCountry)) {
                this.nationality = NationalityEnum.NoCitizenship;
            }
            else {
                switch (this.item.nationalityCountry.id) {
                    case 'RU': {
                        this.nationality = NationalityEnum.Russian;
                        break;
                    }
                    case 'EMPTY': {
                        this.nationality = NationalityEnum.NoCitizenship;
                        break;
                    }
                    default: {
                        this.nationality = NationalityEnum.Other;
                        break;
                    }
                }
                this.onNationalityChange(this.nationality);
                this.onIdentificationDocumentTypeChange(this.item.identificationDocument.documentType.id);
            }
        }
    }
    onNationalityChange(value) {
        this._changeNationalityLogic(value);
        this.onValuesChange(value);
    }
    onIdentificationDocumentTypeChange(value) {
        this._changeDocumentTypeLogic(value);
        this.onValuesChange(value);
    }
    _changeNationalityLogic(nationality) {
        let documentType = this.item.identificationDocument.documentType;
        switch (nationality) {
            case NationalityEnum.Russian: {
                this.item.nationalityCountry = { id: 'RU', text: 'Россия', description: null };
                if (documentType == undefined || !this.russianIdentificationDocumentIds.find(x => x == documentType.id)) {
                    const defaultType = DocumentTypeEnum.Passport;
                    this.item.identificationDocument.documentType = { id: Number(defaultType), text: '', description: null };
                }
                this.item.isNeedResidencePermitDocument = false;
                this._resetOtherDocumentType(documentType.id);
                break;
            }
            case NationalityEnum.NoCitizenship: {
                this.item.nationalityCountry = { id: 'EMPTY', text: 'Без гражданства', description: null };
                this.item.isNeedResidencePermitDocument = false;
                if (documentType == undefined || !this.noCitizenshipIdentificationDocumentIds.find(x => x == documentType.id)) {
                    const defaultType = DocumentTypeEnum.TemporaryResidencePermits;
                    this.item.identificationDocument.documentType = { id: Number(defaultType), text: '', description: null };
                }
                else if (documentType.id === DocumentTypeEnum.None) {
                    this.item.isNeedResidencePermitDocument = true;
                    if (!this.item.residencePermitDocument) {
                        this.item.residencePermitDocument = new Document$1();
                        this.item.residencePermitDocument.documentType = { id: Number(DocumentTypeEnum.None), text: '', description: null };
                    }
                }
                this._resetOtherDocumentType(documentType.id);
                break;
            }
            case NationalityEnum.Other: {
                if (this.item.nationalityCountry.id === 'RU'
                    || this.item.nationalityCountry.id === 'EMPTY') {
                    this.item.nationalityCountry = { id: '', text: null, description: null };
                }
                if (documentType === undefined || !this.otherIdentificationDocumentIds.find(x => x == documentType.id)) {
                    const defaultType = DocumentTypeEnum.InternationalPassport;
                    this.item.identificationDocument.documentType = { id: Number(defaultType), text: '', description: null };
                }
                this.item.isNeedResidencePermitDocument = true;
                if (!this.item.residencePermitDocument) {
                    this.item.residencePermitDocument = new Document$1();
                    this.item.residencePermitDocument.documentType = { id: Number(DocumentTypeEnum.None), text: '', description: null };
                }
                break;
            }
        }
    }
    _changeDocumentTypeLogic(documentType) {
        switch (this.nationality) {
            case NationalityEnum.Russian: {
                this._resetOtherDocumentType(documentType);
                break;
            }
            case NationalityEnum.NoCitizenship: {
                if (documentType === DocumentTypeEnum.None) {
                    this.item.isNeedResidencePermitDocument = true;
                    if (!this.item.residencePermitDocument) {
                        this.item.residencePermitDocument = new Document$1();
                        this.item.residencePermitDocument.documentType = { id: Number(DocumentTypeEnum.None), text: '', description: null };
                    }
                }
                this._resetOtherDocumentType(documentType);
                break;
            }
            case NationalityEnum.Other: {
                break;
            }
        }
    }
    _resetOtherDocumentType(documentType) {
        if (documentType && documentType !== DocumentTypeEnum.None) {
            this.item.identificationDocument.otherDocumentType = null;
            this.item.residencePermitDocument = null;
        }
    }
    onResinencePermitDocumentChanged($event) {
        if (this.item.residencePermitDocument && this.item.residencePermitDocument.documentType.id !== 1) {
            this.item.residencePermitDocument.otherDocumentType = null;
            this.onValuesChange($event);
        }
    }
    onFmsUnitSelected($event) {
        const data = $event.data;
        if (data) {
            this.item.identificationDocument.authority = data.name;
            this.item.identificationDocument.code = data.code;
        }
    }
    onValuesChange($event) {
        if ($event != null)
            this.valueChange.emit($event);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreIdentificationDocCardComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreIdentificationDocCardComponent, isStandalone: false, selector: "core-identification-doc-card", inputs: { readonly: "readonly", section: "section", item: "item", passportDataMode: "passportDataMode" }, outputs: { valueChange: "valueChange" }, usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  @if (!passportDataMode) {\n    <div class=\"sln-doc-card-row sln-identification-docs\">\n      <div class=\"col-md-12 sln-doc-nationality\">\n        <span class=\"sln-nationality-span\">\u0413\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E</span>\n        <mat-radio-group [(ngModel)]=\"nationality\" (ngModelChange)=\"onNationalityChange($event)\" name=\"nationality\" [disabled]=\"readonly\" class=\"gorizontal-radio-group\">\n          <mat-radio-button [value]=\"'Russian'\" class=\"sln-mat-radio-button\">\u0420\u043E\u0441\u0441\u0438\u0439\u0441\u043A\u0430\u044F \u0424\u0435\u0434\u0435\u0440\u0430\u0446\u0438\u044F</mat-radio-button>\n          <mat-radio-button [value]=\"'NoCitizenship'\" class=\"sln-mat-radio-button\">\u0411\u0435\u0437 \u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u0430</mat-radio-button>\n          <mat-radio-button [value]=\"'Other'\" class=\"sln-mat-radio-button\">\u0418\u043D\u043E\u0435</mat-radio-button>\n        </mat-radio-group>\n      </div>\n      @if (nationality === 'Other') {\n        <div class=\"col-md-12\">\n          <core-field-combobox [(ngModel)]=\"item.nationalityCountry\" name=\"nationalityCountry\" fieldName=\"nationalityCountry\" placeholder=\"\u0418\u043D\u043E\u0435 \u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"\n            [settings]=\"{ sourceCode:'Countries', isRequired: true }\"\n          class=\"sln-core-field-combobox\"></core-field-combobox>\n        </div>\n      }\n      <div class=\"sln-birth-day\">\n        <div class=\"sln-padding-left col-md-4\">\n          <core-field-date [(ngModel)]=\"item.birthDay\" [disabled]=\"readonly\" name=\"birthDay\" fieldName=\"birthDay\" placeholder=\"\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F\" [section]=\"section\"\n          [settings]=\"{ isRequired: true, maxD: nowDate }\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n        </div>\n        <div class=\"col-md-8 sln-padding-right\">\n          <core-field-string [(ngModel)]=\"item.birthPlace\" [disabled]=\"readonly\" name=\"birthPlace\" fieldName=\"birthPlace\" placeholder=\"\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F\" [section]=\"section\"\n            [settings]=\"{ isRequired: true, maxLength: 200, useInformer: true, informerText:'\u0423\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441\u0442\u0440\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u043E \u043F\u0430\u0441\u043F\u043E\u0440\u0442\u0443 (\u0441\u043E\u043A\u0440\u0430\u0449\u0435\u043D\u0438\u044F/\u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0434\u043E\u043F\u0443\u0441\u043A\u0430\u044E\u0442\u0441\u044F)' }\"\n          (valueChange)=\"onValuesChange($event)\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n\n  <div class=\"sln-docs-row\">\n    <div class=\"sln-doc-card-row  identificationDocument sln-identification-docs\">\n      <div class=\"col-md-12 sln-doc-document\">\n        @if (!passportDataMode) {\n          <div>\n            <span class=\"sln-doc-document-span\">\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0439 \u043B\u0438\u0447\u043D\u043E\u0441\u0442\u044C</span>\n            <mat-radio-group [(ngModel)]=\"item.identificationDocument.documentType.id\" name=\"identificationDocument.documentType\" (ngModelChange)=\"onIdentificationDocumentTypeChange($event)\" [disabled]=\"readonly\" class=\"gorizontal-radio-group doc\">\n              @if (nationality==='Russian') {\n                <mat-radio-button [value]=\"2\" style=\"margin-right: 20px;\" class=\"sln-mat-radio-button\">\u041F\u0430\u0441\u043F\u043E\u0440\u0442 \u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0438\u043D\u0430</mat-radio-button>\n              }\n              @if (nationality==='Other') {\n                <mat-radio-button [value]=\"3\" class=\"sln-mat-radio-button\">\u041F\u0430\u0441\u043F\u043E\u0440\u0442 \u0438\u043D\u043E\u0441\u0442\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0438\u043D\u0430</mat-radio-button>\n              }\n              @if (nationality==='NoCitizenship') {\n                <mat-radio-button [value]=\"20\" class=\"sln-mat-radio-button\" tid=\"residencePermit\">\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u043D\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0435 \u043F\u0440\u043E\u0436\u0438\u0432\u0430\u043D\u0438\u0435</mat-radio-button>\n              }\n              @if (nationality==='NoCitizenship') {\n                <mat-radio-button [value]=\"21\" class=\"sln-mat-radio-button\" tid=\"residentCard\">\u0412\u0438\u0434 \u043D\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u043E</mat-radio-button>\n              }\n              <mat-radio-button [value]=\"1\" tid=\"otherDocs\">\u0418\u043D\u043E\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442</mat-radio-button>\n            </mat-radio-group>\n          </div>\n        }\n        @if (item.identificationDocument.documentType.id===1) {\n          <div class=\"\">\n            <div class=\"col-md-12\">\n                        <core-field-string [(ngModel)]=\"item.identificationDocument.otherDocumentType\" name=\"otherDocumentType\" fieldName=\"otherDocumentType\" placeholder=\"\u0418\u043D\u043E\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\" [section]=\"section\" [settings]=\"{ isRequired: item.identificationDocument.documentType.id===1\n                            , maxLength: 200 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"otherDocumentType\"></core-field-string>\n            </div>\n          </div>\n        }\n        @if (!passportDataMode && identificationDocumentConfig) {\n          <div class=\"col-md-12 sln-core-file-uploader-doc-card\">\n            <core-file-uploader [config]=\"identificationDocumentConfig\" [(ngModel)]=\"item.identificationDocument.files\" placeholder=\"\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0439 \u043B\u0438\u0447\u043D\u043E\u0441\u0442\u044C\" name=\"files\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" [requiredFile]=\"true\" ></core-file-uploader>\n          </div>\n        }\n        <div class=\"sln-id-docs-core-field-string\">\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n                        <core-field-string [(ngModel)]=\"item.identificationDocument.serial\" name=\"serial\" fieldName=\"serial\" placeholder=\"\u0421\u0435\u0440\u0438\u044F\" [section]=\"section\" (valueChange)=\"onValuesChange($event)\" [settings]=\"{ isRequired: true, maxLength: (nationality==='Russian' ? 5\n                            : 10), useMask: nationality==='Russian' , maskExpression: '00 00' }\" [disabled]=\"readonly\" tid=\"serialID\"></core-field-string>\n          </div>\n          <div class=\"col-md-6 sln-padding-right\">\n                        <core-field-string [(ngModel)]=\"item.identificationDocument.number\" name=\"number\" fieldName=\"number\" placeholder=\"\u041D\u043E\u043C\u0435\u0440\" [section]=\"section\" (valueChange)=\"onValuesChange($event)\" [settings]=\"{ isRequired: true, maxLength: (nationality==='Russian' ? 8\n                            : 50), useMask: nationality==='Russian' , maskExpression: '00 00 00' }\" [disabled]=\"readonly\"  tid=\"numberlID\"></core-field-string>\n          </div>\n        </div>\n        <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n          <core-field-date [(ngModel)]=\"item.identificationDocument.issueDate\" name=\"issueDate\" fieldName=\"issueDate\" placeholder=\"\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438\" [section]=\"section\"\n          [settings]=\"{ isRequired: true, maxD: nowDate }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n        </div>\n        <div class=\"col-md-6 sln-padding-right\">\n          @if (nationality==='Russian') {\n            <core-dadata-fms-code [disabled]=\"readonly\" [(ngModel)]=\"item.identificationDocument.code\" name=\"code\" fieldName=\"code\" [settings]=\"{ isRequired: true }\" (selected)=\"onFmsUnitSelected($event)\" (valueChange)=\"onValuesChange($event)\"></core-dadata-fms-code>\n          }\n        </div>\n        <div class=\"col-md-12\">\n          <core-field-string  [(ngModel)]=\"item.identificationDocument.authority\" name=\"authority\" fieldName=\"authority\" placeholder=\"\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D\" [section]=\"section\" [settings]=\"{ isRequired: true, maxLength: 200 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"authorityID\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  </div>\n\n  @if (item.residencePermitDocument && item.isNeedResidencePermitDocument) {\n    <div>\n      <div class=\"sln-doc-card-row residencePermitDocument sln-identification-docs\">\n        <div class=\"col-md-12 sln-residence-permit-document\">\n          <span class=\"sln-doc-document-span\">\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442, \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044E\u0449\u0438\u0439 \u043F\u0440\u0430\u0432\u043E \u043D\u0430 \u043F\u0440\u0435\u0431\u044B\u0432\u0430\u043D\u0438\u0435 \u0432 \u0441\u0442\u0440\u0430\u043D\u0435</span>\n          <mat-radio-group [(ngModel)]=\"item.residencePermitDocument.documentType.id\" name=\"residencePermitDocument.documentType\" [disabled]=\"readonly\" class=\"gorizontal-radio-group\" (ngModelChange)=\"onResinencePermitDocumentChanged($event)\">\n            <mat-radio-button [value]=\"18\" class=\"sln-mat-radio-button\">\u041C\u0438\u0433\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u0430\u044F \u043A\u0430\u0440\u0442\u0430</mat-radio-button>\n            <mat-radio-button [value]=\"19\" class=\"sln-mat-radio-button\">\u0412\u0438\u0437\u0430</mat-radio-button>\n            <mat-radio-button [value]=\"20\" class=\"sln-mat-radio-button\" tid=\"residencePermitDocResidencePermit\">\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u043D\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0435 \u043F\u0440\u043E\u0436\u0438\u0432\u0430\u043D\u0438\u0435</mat-radio-button>\n            <mat-radio-button [value]=\"21\" class=\"sln-mat-radio-button\" tid=\"residencePermitDocResidentCard\">\u0412\u0438\u0434 \u043D\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u043E</mat-radio-button>\n            <mat-radio-button [value]=\"1\" class=\"sln-mat-radio-button\" tid=\"residencePermitDocOtherDocs\">\u0418\u043D\u043E\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442</mat-radio-button>\n          </mat-radio-group>\n          @if (item.residencePermitDocument.documentType.id===1) {\n            <div class=\"\">\n              <div class=\"col-md-12\">\n                        <core-field-string [(ngModel)]=\"item.residencePermitDocument.otherDocumentType\" name=\"residencePermitDocument_otherDocumentType\" fieldName=\"residencePermitDocument_otherDocumentType\" placeholder=\"\u0418\u043D\u043E\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\" [section]=\"section\" [settings]=\"{ isRequired:\n                        item.residencePermitDocument.documentType.id===1 , maxLength: 200 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"residencePermitDocOtherDocType\"></core-field-string>\n              </div>\n            </div>\n          }\n          <div class=\"col-md-12 sln-core-file-uploader-doc-card\">\n            <core-file-uploader [config]=\"residencePermitDocumentConfig\" placeholder=\"\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0439 \u043B\u0438\u0447\u043D\u043E\u0441\u0442\u044C\" [(ngModel)]=\"item.residencePermitDocument.files\" name=\"residencePermitDocument_files\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" [requiredFile]=\"true\"></core-file-uploader>\n          </div>\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n                    <core-field-string [(ngModel)]=\"item.residencePermitDocument.serial\" name=\"residencePermitDocument_serial\" fieldName=\"residencePermitDocument_serial\" placeholder=\"\u0421\u0435\u0440\u0438\u044F\" [section]=\"section\"  [settings]=\"{ isRequired: item.isNeedResidencePermitDocument,\n                        maxLength: 10 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"residencePermitSerial\"></core-field-string>\n          </div>\n          <div class=\"col-md-6 sln-padding-right\">\n                    <core-field-string [(ngModel)]=\"item.residencePermitDocument.number\" name=\"residencePermitDocument_number\" fieldName=\"residencePermitDocument_number\" placeholder=\"\u041D\u043E\u043C\u0435\u0440\"  [section]=\"section\" [settings]=\"{ isRequired: item.isNeedResidencePermitDocument,\n                        maxLength: 50 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"residencePermitNumber\"></core-field-string>\n          </div>\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n            <core-field-date [(ngModel)]=\"item.residencePermitDocument.dateFrom\" name=\"residencePermitDocument_dateFrom\" fieldName=\"residencePermitDocument_dateFrom\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F\"  [section]=\"section\"\n            [settings]=\"{ isRequired: item.isNeedResidencePermitDocument }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n          </div>\n          <div class=\"col-md-6 sln-padding-right\">\n            <core-field-date [(ngModel)]=\"item.residencePermitDocument.dateTo\" name=\"residencePermitDocument_dateTo\" fieldName=\"residencePermitDocument_dateTo\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F\"  [section]=\"section\"\n            [settings]=\"{ isRequired: item.isNeedResidencePermitDocument }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n          </div>\n          <div class=\"col-md-12\">\n                    <core-field-string [(ngModel)]=\"item.residencePermitDocument.authority\" name=\"residencePermitDocument_authority\" fieldName=\"residencePermitDocument_authority\" placeholder=\"\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D\"  [section]=\"section\" [settings]=\"{ isRequired: true,\n                        maxLength: 200 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"residencePermitAuthority\"></core-field-string>\n          </div>\n        </div>\n      </div>\n    </div>\n  }\n</div>", styles: [".sln-id-docs-core-field-string{display:flex;width:100%;flex-wrap:wrap}\n"], dependencies: [{ kind: "directive", type: i3$3.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i3$3.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeDateTimeComponent, selector: "core-field-date" }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFileUploaderComponent, selector: "core-file-uploader", inputs: ["config", "needUpload", "elementId", "anonymAccessItemId"], outputs: ["valueChange", "autogenerateClick", "filesLoaded"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "component", type: CoreDadataFmsCodeComponent, selector: "core-dadata-fms-code", inputs: ["limit", "locations"], outputs: ["selectedSuggestion", "selected"] }, { kind: "directive", type: RequiredFileValidatorDirective, selector: "[requiredFile]", inputs: ["requiredFile"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreIdentificationDocCardComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-identification-doc-card', standalone: false, template: "<div provideParentForm>\n  @if (!passportDataMode) {\n    <div class=\"sln-doc-card-row sln-identification-docs\">\n      <div class=\"col-md-12 sln-doc-nationality\">\n        <span class=\"sln-nationality-span\">\u0413\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E</span>\n        <mat-radio-group [(ngModel)]=\"nationality\" (ngModelChange)=\"onNationalityChange($event)\" name=\"nationality\" [disabled]=\"readonly\" class=\"gorizontal-radio-group\">\n          <mat-radio-button [value]=\"'Russian'\" class=\"sln-mat-radio-button\">\u0420\u043E\u0441\u0441\u0438\u0439\u0441\u043A\u0430\u044F \u0424\u0435\u0434\u0435\u0440\u0430\u0446\u0438\u044F</mat-radio-button>\n          <mat-radio-button [value]=\"'NoCitizenship'\" class=\"sln-mat-radio-button\">\u0411\u0435\u0437 \u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u0430</mat-radio-button>\n          <mat-radio-button [value]=\"'Other'\" class=\"sln-mat-radio-button\">\u0418\u043D\u043E\u0435</mat-radio-button>\n        </mat-radio-group>\n      </div>\n      @if (nationality === 'Other') {\n        <div class=\"col-md-12\">\n          <core-field-combobox [(ngModel)]=\"item.nationalityCountry\" name=\"nationalityCountry\" fieldName=\"nationalityCountry\" placeholder=\"\u0418\u043D\u043E\u0435 \u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0441\u0442\u0432\u043E\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"\n            [settings]=\"{ sourceCode:'Countries', isRequired: true }\"\n          class=\"sln-core-field-combobox\"></core-field-combobox>\n        </div>\n      }\n      <div class=\"sln-birth-day\">\n        <div class=\"sln-padding-left col-md-4\">\n          <core-field-date [(ngModel)]=\"item.birthDay\" [disabled]=\"readonly\" name=\"birthDay\" fieldName=\"birthDay\" placeholder=\"\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F\" [section]=\"section\"\n          [settings]=\"{ isRequired: true, maxD: nowDate }\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n        </div>\n        <div class=\"col-md-8 sln-padding-right\">\n          <core-field-string [(ngModel)]=\"item.birthPlace\" [disabled]=\"readonly\" name=\"birthPlace\" fieldName=\"birthPlace\" placeholder=\"\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F\" [section]=\"section\"\n            [settings]=\"{ isRequired: true, maxLength: 200, useInformer: true, informerText:'\u0423\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441\u0442\u0440\u043E\u0433\u043E \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u043E \u043F\u0430\u0441\u043F\u043E\u0440\u0442\u0443 (\u0441\u043E\u043A\u0440\u0430\u0449\u0435\u043D\u0438\u044F/\u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0434\u043E\u043F\u0443\u0441\u043A\u0430\u044E\u0442\u0441\u044F)' }\"\n          (valueChange)=\"onValuesChange($event)\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n\n  <div class=\"sln-docs-row\">\n    <div class=\"sln-doc-card-row  identificationDocument sln-identification-docs\">\n      <div class=\"col-md-12 sln-doc-document\">\n        @if (!passportDataMode) {\n          <div>\n            <span class=\"sln-doc-document-span\">\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0439 \u043B\u0438\u0447\u043D\u043E\u0441\u0442\u044C</span>\n            <mat-radio-group [(ngModel)]=\"item.identificationDocument.documentType.id\" name=\"identificationDocument.documentType\" (ngModelChange)=\"onIdentificationDocumentTypeChange($event)\" [disabled]=\"readonly\" class=\"gorizontal-radio-group doc\">\n              @if (nationality==='Russian') {\n                <mat-radio-button [value]=\"2\" style=\"margin-right: 20px;\" class=\"sln-mat-radio-button\">\u041F\u0430\u0441\u043F\u043E\u0440\u0442 \u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0438\u043D\u0430</mat-radio-button>\n              }\n              @if (nationality==='Other') {\n                <mat-radio-button [value]=\"3\" class=\"sln-mat-radio-button\">\u041F\u0430\u0441\u043F\u043E\u0440\u0442 \u0438\u043D\u043E\u0441\u0442\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0433\u0440\u0430\u0436\u0434\u0430\u043D\u0438\u043D\u0430</mat-radio-button>\n              }\n              @if (nationality==='NoCitizenship') {\n                <mat-radio-button [value]=\"20\" class=\"sln-mat-radio-button\" tid=\"residencePermit\">\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u043D\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0435 \u043F\u0440\u043E\u0436\u0438\u0432\u0430\u043D\u0438\u0435</mat-radio-button>\n              }\n              @if (nationality==='NoCitizenship') {\n                <mat-radio-button [value]=\"21\" class=\"sln-mat-radio-button\" tid=\"residentCard\">\u0412\u0438\u0434 \u043D\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u043E</mat-radio-button>\n              }\n              <mat-radio-button [value]=\"1\" tid=\"otherDocs\">\u0418\u043D\u043E\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442</mat-radio-button>\n            </mat-radio-group>\n          </div>\n        }\n        @if (item.identificationDocument.documentType.id===1) {\n          <div class=\"\">\n            <div class=\"col-md-12\">\n                        <core-field-string [(ngModel)]=\"item.identificationDocument.otherDocumentType\" name=\"otherDocumentType\" fieldName=\"otherDocumentType\" placeholder=\"\u0418\u043D\u043E\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\" [section]=\"section\" [settings]=\"{ isRequired: item.identificationDocument.documentType.id===1\n                            , maxLength: 200 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"otherDocumentType\"></core-field-string>\n            </div>\n          </div>\n        }\n        @if (!passportDataMode && identificationDocumentConfig) {\n          <div class=\"col-md-12 sln-core-file-uploader-doc-card\">\n            <core-file-uploader [config]=\"identificationDocumentConfig\" [(ngModel)]=\"item.identificationDocument.files\" placeholder=\"\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0439 \u043B\u0438\u0447\u043D\u043E\u0441\u0442\u044C\" name=\"files\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" [requiredFile]=\"true\" ></core-file-uploader>\n          </div>\n        }\n        <div class=\"sln-id-docs-core-field-string\">\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n                        <core-field-string [(ngModel)]=\"item.identificationDocument.serial\" name=\"serial\" fieldName=\"serial\" placeholder=\"\u0421\u0435\u0440\u0438\u044F\" [section]=\"section\" (valueChange)=\"onValuesChange($event)\" [settings]=\"{ isRequired: true, maxLength: (nationality==='Russian' ? 5\n                            : 10), useMask: nationality==='Russian' , maskExpression: '00 00' }\" [disabled]=\"readonly\" tid=\"serialID\"></core-field-string>\n          </div>\n          <div class=\"col-md-6 sln-padding-right\">\n                        <core-field-string [(ngModel)]=\"item.identificationDocument.number\" name=\"number\" fieldName=\"number\" placeholder=\"\u041D\u043E\u043C\u0435\u0440\" [section]=\"section\" (valueChange)=\"onValuesChange($event)\" [settings]=\"{ isRequired: true, maxLength: (nationality==='Russian' ? 8\n                            : 50), useMask: nationality==='Russian' , maskExpression: '00 00 00' }\" [disabled]=\"readonly\"  tid=\"numberlID\"></core-field-string>\n          </div>\n        </div>\n        <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n          <core-field-date [(ngModel)]=\"item.identificationDocument.issueDate\" name=\"issueDate\" fieldName=\"issueDate\" placeholder=\"\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438\" [section]=\"section\"\n          [settings]=\"{ isRequired: true, maxD: nowDate }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n        </div>\n        <div class=\"col-md-6 sln-padding-right\">\n          @if (nationality==='Russian') {\n            <core-dadata-fms-code [disabled]=\"readonly\" [(ngModel)]=\"item.identificationDocument.code\" name=\"code\" fieldName=\"code\" [settings]=\"{ isRequired: true }\" (selected)=\"onFmsUnitSelected($event)\" (valueChange)=\"onValuesChange($event)\"></core-dadata-fms-code>\n          }\n        </div>\n        <div class=\"col-md-12\">\n          <core-field-string  [(ngModel)]=\"item.identificationDocument.authority\" name=\"authority\" fieldName=\"authority\" placeholder=\"\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D\" [section]=\"section\" [settings]=\"{ isRequired: true, maxLength: 200 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"authorityID\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  </div>\n\n  @if (item.residencePermitDocument && item.isNeedResidencePermitDocument) {\n    <div>\n      <div class=\"sln-doc-card-row residencePermitDocument sln-identification-docs\">\n        <div class=\"col-md-12 sln-residence-permit-document\">\n          <span class=\"sln-doc-document-span\">\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442, \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044E\u0449\u0438\u0439 \u043F\u0440\u0430\u0432\u043E \u043D\u0430 \u043F\u0440\u0435\u0431\u044B\u0432\u0430\u043D\u0438\u0435 \u0432 \u0441\u0442\u0440\u0430\u043D\u0435</span>\n          <mat-radio-group [(ngModel)]=\"item.residencePermitDocument.documentType.id\" name=\"residencePermitDocument.documentType\" [disabled]=\"readonly\" class=\"gorizontal-radio-group\" (ngModelChange)=\"onResinencePermitDocumentChanged($event)\">\n            <mat-radio-button [value]=\"18\" class=\"sln-mat-radio-button\">\u041C\u0438\u0433\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u0430\u044F \u043A\u0430\u0440\u0442\u0430</mat-radio-button>\n            <mat-radio-button [value]=\"19\" class=\"sln-mat-radio-button\">\u0412\u0438\u0437\u0430</mat-radio-button>\n            <mat-radio-button [value]=\"20\" class=\"sln-mat-radio-button\" tid=\"residencePermitDocResidencePermit\">\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u0435 \u043D\u0430 \u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0435 \u043F\u0440\u043E\u0436\u0438\u0432\u0430\u043D\u0438\u0435</mat-radio-button>\n            <mat-radio-button [value]=\"21\" class=\"sln-mat-radio-button\" tid=\"residencePermitDocResidentCard\">\u0412\u0438\u0434 \u043D\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u043E</mat-radio-button>\n            <mat-radio-button [value]=\"1\" class=\"sln-mat-radio-button\" tid=\"residencePermitDocOtherDocs\">\u0418\u043D\u043E\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442</mat-radio-button>\n          </mat-radio-group>\n          @if (item.residencePermitDocument.documentType.id===1) {\n            <div class=\"\">\n              <div class=\"col-md-12\">\n                        <core-field-string [(ngModel)]=\"item.residencePermitDocument.otherDocumentType\" name=\"residencePermitDocument_otherDocumentType\" fieldName=\"residencePermitDocument_otherDocumentType\" placeholder=\"\u0418\u043D\u043E\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\" [section]=\"section\" [settings]=\"{ isRequired:\n                        item.residencePermitDocument.documentType.id===1 , maxLength: 200 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"residencePermitDocOtherDocType\"></core-field-string>\n              </div>\n            </div>\n          }\n          <div class=\"col-md-12 sln-core-file-uploader-doc-card\">\n            <core-file-uploader [config]=\"residencePermitDocumentConfig\" placeholder=\"\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0443\u0434\u043E\u0441\u0442\u043E\u0432\u0435\u0440\u044F\u044E\u0449\u0438\u0439 \u043B\u0438\u0447\u043D\u043E\u0441\u0442\u044C\" [(ngModel)]=\"item.residencePermitDocument.files\" name=\"residencePermitDocument_files\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" [requiredFile]=\"true\"></core-file-uploader>\n          </div>\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n                    <core-field-string [(ngModel)]=\"item.residencePermitDocument.serial\" name=\"residencePermitDocument_serial\" fieldName=\"residencePermitDocument_serial\" placeholder=\"\u0421\u0435\u0440\u0438\u044F\" [section]=\"section\"  [settings]=\"{ isRequired: item.isNeedResidencePermitDocument,\n                        maxLength: 10 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"residencePermitSerial\"></core-field-string>\n          </div>\n          <div class=\"col-md-6 sln-padding-right\">\n                    <core-field-string [(ngModel)]=\"item.residencePermitDocument.number\" name=\"residencePermitDocument_number\" fieldName=\"residencePermitDocument_number\" placeholder=\"\u041D\u043E\u043C\u0435\u0440\"  [section]=\"section\" [settings]=\"{ isRequired: item.isNeedResidencePermitDocument,\n                        maxLength: 50 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"residencePermitNumber\"></core-field-string>\n          </div>\n          <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n            <core-field-date [(ngModel)]=\"item.residencePermitDocument.dateFrom\" name=\"residencePermitDocument_dateFrom\" fieldName=\"residencePermitDocument_dateFrom\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F\"  [section]=\"section\"\n            [settings]=\"{ isRequired: item.isNeedResidencePermitDocument }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n          </div>\n          <div class=\"col-md-6 sln-padding-right\">\n            <core-field-date [(ngModel)]=\"item.residencePermitDocument.dateTo\" name=\"residencePermitDocument_dateTo\" fieldName=\"residencePermitDocument_dateTo\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F\"  [section]=\"section\"\n            [settings]=\"{ isRequired: item.isNeedResidencePermitDocument }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n          </div>\n          <div class=\"col-md-12\">\n                    <core-field-string [(ngModel)]=\"item.residencePermitDocument.authority\" name=\"residencePermitDocument_authority\" fieldName=\"residencePermitDocument_authority\" placeholder=\"\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D\"  [section]=\"section\" [settings]=\"{ isRequired: true,\n                        maxLength: 200 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\" tid=\"residencePermitAuthority\"></core-field-string>\n          </div>\n        </div>\n      </div>\n    </div>\n  }\n</div>", styles: [".sln-id-docs-core-field-string{display:flex;width:100%;flex-wrap:wrap}\n"] }]
        }], propDecorators: { readonly: [{
                type: Input
            }], section: [{
                type: Input
            }], item: [{
                type: Input
            }], passportDataMode: [{
                type: Input
            }], valueChange: [{
                type: Output
            }] } });

class IIdentificationDocumentDialogOptions {
}
class CoreIdentificationDocumentDialogWindow extends CoreAbstractComponent {
    constructor(dialogRef, data) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
    }
    save() {
        const row = this.data.item;
        if (this.data.personId) {
            row.personId = this.data.personId;
        }
        this.dialogRef.close(row);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreIdentificationDocumentDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreIdentificationDocumentDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"{{data.passportDataMode ? '\u041F\u0430\u0441\u043F\u043E\u0440\u0442' : '\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B'}}\" [width]=\"800\">\n  <div body>\n    <div class=\"sln-scrollbar\">\n      <form #newForm=\"ngForm\" novalidate>\n        <core-identification-doc-card [item]=\"data.item\" [readonly]=\"data.readonlyMode\" [passportDataMode]=\"data.passportDataMode\"></core-identification-doc-card>\n      </form>\n    </div>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" tid=\"save\" [disabled]=\"newForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-scrollbar{max-height:564px;overflow:scroll}\n"], dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreIdentificationDocCardComponent, selector: "core-identification-doc-card", inputs: ["readonly", "section", "item", "passportDataMode"], outputs: ["valueChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreIdentificationDocumentDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"{{data.passportDataMode ? '\u041F\u0430\u0441\u043F\u043E\u0440\u0442' : '\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B'}}\" [width]=\"800\">\n  <div body>\n    <div class=\"sln-scrollbar\">\n      <form #newForm=\"ngForm\" novalidate>\n        <core-identification-doc-card [item]=\"data.item\" [readonly]=\"data.readonlyMode\" [passportDataMode]=\"data.passportDataMode\"></core-identification-doc-card>\n      </form>\n    </div>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" tid=\"save\" [disabled]=\"newForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n", styles: [".sln-scrollbar{max-height:564px;overflow:scroll}\n"] }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: IIdentificationDocumentDialogOptions, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class CoreFieldIdentificationDocComponent extends CoreAbstractAccessorComponent {
    get isImageEmpty() {
        return Utility.isEmpty(this.value);
    }
    constructor(_dialog) {
        super();
        this._dialog = _dialog;
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return null;
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    setDefault() {
        super.setDefault();
    }
    editValue() {
        if (!this.value) {
            this.value = new IdentificationDocument();
            this.value.identificationDocument.documentType.id = 2;
            this.value.identificationDocument.documentType.text = '';
            this.value.nationalityCountry.id = 'RU';
            this.value.nationalityCountry.text = 'Россия';
            this.value.nationalityCountry.description = null;
            this.value.personIdentificationDocumentId = 0;
        }
        this.isDialogOppened = true;
        const dialogRef = this._dialog.open(CoreIdentificationDocumentDialogWindow, {
            data: { item: this.value, readonlyMode: this.disabled ?? false, passportDataMode: this.passportDataMode }
        });
        const sub = dialogRef.afterClosed().subscribe((result) => {
            this.isDialogOppened = false;
            if (result && result.state !== DialogReason.cancel) {
                this.isValueSaved = true;
                if (result !== this.value) {
                    this.onValueChange(result);
                }
                this.valueChange.emit(this.value);
            }
            else if (!this.isValueSaved) {
                this.value = null;
            }
            sub.unsubscribe();
        });
    }
    // implements Validator
    validate(control) {
        if (this.settings?.isRequired) {
            if (!control.value) {
                return { 'required': true };
            }
        }
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldIdentificationDocComponent, deps: [{ token: i1$8.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldIdentificationDocComponent, isStandalone: false, selector: "core-field-identification-doc", inputs: { passportDataMode: "passportDataMode" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldIdentificationDocComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFieldIdentificationDocComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"\">\n    <div class=\"complex-field sln-invalid-rule-row\">\n      <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n        <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n        @if (value?.identificationDocument) {\n          <h2>\n            @if (!isDialogOppened) {\n              <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.identificationDocument?.toString }}</span>\n            }\n          </h2>\n        }\n      </div>\n      <button (click)=\"editValue()\" style=\"min-width: 20px;\">\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (!disabled && isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @if (!disabled && !isImageEmpty) {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (disabled) {\n            <div class=\"sln-control-eye\"></div>\n          }\n        </div>\n      </button>\n    </div>\n    <mat-form-field  style=\"display: none;\">\n      <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n    </mat-form-field>\n  </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: CopyClipboardDirective, selector: "[copyClipboard]", inputs: ["tooltip", "delay"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldIdentificationDocComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-identification-doc', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldIdentificationDocComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFieldIdentificationDocComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm>\n  <div class=\"\">\n    <div class=\"complex-field sln-invalid-rule-row\">\n      <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n        <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n        @if (value?.identificationDocument) {\n          <h2>\n            @if (!isDialogOppened) {\n              <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.identificationDocument?.toString }}</span>\n            }\n          </h2>\n        }\n      </div>\n      <button (click)=\"editValue()\" style=\"min-width: 20px;\">\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (!disabled && isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @if (!disabled && !isImageEmpty) {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (disabled) {\n            <div class=\"sln-control-eye\"></div>\n          }\n        </div>\n      </button>\n    </div>\n    <mat-form-field  style=\"display: none;\">\n      <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n    </mat-form-field>\n  </div>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }], propDecorators: { passportDataMode: [{
                type: Input
            }] } });

class CoreIdentificationDocumentModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreIdentificationDocumentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreIdentificationDocumentModule, declarations: [CoreIdentificationDocumentDialogWindow,
            CoreIdentificationDocCardComponent,
            CoreFieldIdentificationDocComponent], imports: [CoreMatModule,
            CoreDialogModule,
            CoreControlModule,
            CoreUploaderModule,
            CoreBaseModule,
            CoreDaDataModule,
            CoreDirectiveModule], exports: [CoreIdentificationDocumentDialogWindow,
            CoreIdentificationDocCardComponent,
            CoreFieldIdentificationDocComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreIdentificationDocumentModule, imports: [CoreMatModule,
            CoreDialogModule,
            CoreControlModule,
            CoreUploaderModule,
            CoreBaseModule,
            CoreDaDataModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreIdentificationDocumentModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreIdentificationDocumentDialogWindow,
                        CoreIdentificationDocCardComponent,
                        CoreFieldIdentificationDocComponent
                    ],
                    imports: [
                        CoreMatModule,
                        CoreDialogModule,
                        CoreControlModule,
                        CoreUploaderModule,
                        CoreBaseModule,
                        CoreDaDataModule,
                        CoreDirectiveModule
                    ],
                    exports: [
                        CoreIdentificationDocumentDialogWindow,
                        CoreIdentificationDocCardComponent,
                        CoreFieldIdentificationDocComponent
                    ]
                }]
        }] });

class License {
    constructor() {
        this.licenseId = 0;
    }
}

class CoreLicenseCardComponent extends CoreAbstractComponent {
    constructor() {
        super(...arguments);
        this.valueChange = new EventEmitter();
    }
    onValuesChange($event) {
        this.valueChange.emit($event);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLicenseCardComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreLicenseCardComponent, isStandalone: false, selector: "core-license-card", inputs: { readonly: "readonly", item: "item" }, outputs: { valueChange: "valueChange" }, usesInheritance: true, ngImport: i0, template: "<div provideParentForm class=\"sln-license-card-wrap\">\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.kindOfActivity\" name=\"kindOfActivity\" fieldName=\"kindOfActivity\" placeholder=\"\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438\"\n        [settings]=\"{ isRequired: true, maxLength: 255 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.number\" name=\"number\" fieldName=\"number\" placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"\n        [settings]=\"{ isRequired: true, maxLength: 100 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n    </div>\n    <div class=\"col-md-6 sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-date [(ngModel)]=\"item.issueDate\" name=\"issueDate\" fieldName=\"issueDate\"  placeholder=\"\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"\n        [settings]=\"{ isRequired: true }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n      </div>\n    </div>\n  </div>\n  <div class=\"row sln-license-btn\">\n    <div class=\"col-md-12 form-group sln-padding-left sln-padding-right\">\n      <core-field-bool [(ngModel)]=\"item.isIndefinite\" name=\"isIndefinite\" fieldName=\"isIndefinite\" placeholder=\"\u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0431\u0435\u0441\u0441\u0440\u043E\u0447\u043D\u043E\u0439\"\n      [settings]=\"{  mode: 'Slide' }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n    </div>\n  </div>\n  @if (!item.isIndefinite) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-date [(ngModel)]=\"item.dateFrom\" name=\"dateFrom\" fieldName=\"dateFrom\"  placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"\n          [settings]=\"{ isRequired: !item.isIndefinite }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right \">\n        <div class=\"form-group\">\n          <core-field-date [(ngModel)]=\"item.dateTo\" name=\"dateTo\" fieldName=\"dateTo\"  placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"\n          [settings]=\"{ isRequired: !item.isIndefinite }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n        </div>\n      </div>\n    </div>\n  }\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.authority\" name=\"authority\" fieldName=\"authority\" placeholder=\"\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D\u0430 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u044F\"\n        [settings]=\"{ isRequired: true, maxLength: 255 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-textarea [(ngModel)]=\"item.description\" name=\"description\" fieldName=\"description\" placeholder=\"\u041F\u0435\u0440\u0435\u0447\u0435\u043D\u044C \u0432\u0438\u0434\u043E\u0432 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0440\u0443\u0435\u043C\u043E\u0439 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438\"\n        [settings]=\"{ isRequired: true, maxLength: 500 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-textarea>\n      </div>\n    </div>\n  </div>\n</div>", styles: [".sln-licenses-title{font-family:var(--font-medium);color:var(--DARK-GREY);font-size:15px}.sln-license-card-wrap{padding-bottom:5px}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"], dependencies: [{ kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }, { kind: "component", type: CoreFieldTypeDateTimeComponent, selector: "core-field-date" }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldTypeTextareaComponent, selector: "core-field-textarea" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLicenseCardComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-license-card', standalone: false, template: "<div provideParentForm class=\"sln-license-card-wrap\">\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.kindOfActivity\" name=\"kindOfActivity\" fieldName=\"kindOfActivity\" placeholder=\"\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438\"\n        [settings]=\"{ isRequired: true, maxLength: 255 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.number\" name=\"number\" fieldName=\"number\" placeholder=\"\u041D\u043E\u043C\u0435\u0440 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"\n        [settings]=\"{ isRequired: true, maxLength: 100 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n    </div>\n    <div class=\"col-md-6 sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-date [(ngModel)]=\"item.issueDate\" name=\"issueDate\" fieldName=\"issueDate\"  placeholder=\"\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"\n        [settings]=\"{ isRequired: true }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n      </div>\n    </div>\n  </div>\n  <div class=\"row sln-license-btn\">\n    <div class=\"col-md-12 form-group sln-padding-left sln-padding-right\">\n      <core-field-bool [(ngModel)]=\"item.isIndefinite\" name=\"isIndefinite\" fieldName=\"isIndefinite\" placeholder=\"\u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0431\u0435\u0441\u0441\u0440\u043E\u0447\u043D\u043E\u0439\"\n      [settings]=\"{  mode: 'Slide' }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-bool>\n    </div>\n  </div>\n  @if (!item.isIndefinite) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-date [(ngModel)]=\"item.dateFrom\" name=\"dateFrom\" fieldName=\"dateFrom\"  placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"\n          [settings]=\"{ isRequired: !item.isIndefinite }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-right \">\n        <div class=\"form-group\">\n          <core-field-date [(ngModel)]=\"item.dateTo\" name=\"dateTo\" fieldName=\"dateTo\"  placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"\n          [settings]=\"{ isRequired: !item.isIndefinite }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-date>\n        </div>\n      </div>\n    </div>\n  }\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.authority\" name=\"authority\" fieldName=\"authority\" placeholder=\"\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D\u0430 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u044F\"\n        [settings]=\"{ isRequired: true, maxLength: 255 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n      <div class=\"form-group\">\n        <core-field-textarea [(ngModel)]=\"item.description\" name=\"description\" fieldName=\"description\" placeholder=\"\u041F\u0435\u0440\u0435\u0447\u0435\u043D\u044C \u0432\u0438\u0434\u043E\u0432 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0440\u0443\u0435\u043C\u043E\u0439 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438\"\n        [settings]=\"{ isRequired: true, maxLength: 500 }\" [disabled]=\"readonly\" (valueChange)=\"onValuesChange($event)\"></core-field-textarea>\n      </div>\n    </div>\n  </div>\n</div>", styles: [".sln-licenses-title{font-family:var(--font-medium);color:var(--DARK-GREY);font-size:15px}.sln-license-card-wrap{padding-bottom:5px}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}\n"] }]
        }], propDecorators: { readonly: [{
                type: Input
            }], item: [{
                type: Input
            }], valueChange: [{
                type: Output
            }] } });

class ILicenseDialogOptions {
}
class CoreLicenseDialogWindow extends CoreAbstractComponent {
    constructor(dialogRef, data) {
        super();
        this.dialogRef = dialogRef;
        this.data = data;
    }
    save() {
        const row = this.data.item;
        if (this.data.organizationId) {
            row.organizationId = this.data.organizationId;
        }
        this.dialogRef.close(row);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLicenseDialogWindow, deps: [{ token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreLicenseDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"  width=\"700\">\n  <div body style=\"padding: 0 1px 0 0;\">\n    <form #newForm=\"ngForm\" novalidate>\n      <core-license-card [item]=\"data.item\" [readonly]=\"data.readonlyMode\"></core-license-card>\n    </form>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n", dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: CoreLicenseCardComponent, selector: "core-license-card", inputs: ["readonly", "item"], outputs: ["valueChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLicenseDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438\"  width=\"700\">\n  <div body style=\"padding: 0 1px 0 0;\">\n    <form #newForm=\"ngForm\" novalidate>\n      <core-license-card [item]=\"data.item\" [readonly]=\"data.readonlyMode\"></core-license-card>\n    </form>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialogRef }, { type: ILicenseDialogOptions, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class CoreFieldLicenseComponent extends CoreAbstractAccessorComponent {
    get isImageEmpty() {
        if (this.value?.isIndefinite) {
            return Utility.isEmpty(this.value?.kindOfActivity) ||
                Utility.isEmpty(this.value?.number) ||
                Utility.isEmpty(this.value?.issueDate) ||
                Utility.isEmpty(this.value?.authority) ||
                Utility.isEmpty(this.value?.description);
        }
        else {
            return Utility.isEmpty(this.value?.kindOfActivity) ||
                Utility.isEmpty(this.value?.number) ||
                Utility.isEmpty(this.value?.issueDate) ||
                Utility.isEmpty(this.value?.dateFrom) || Utility.isEmpty(this.value?.dateTo) ||
                Utility.isEmpty(this.value?.authority) ||
                Utility.isEmpty(this.value?.description);
        }
    }
    constructor(_dialog) {
        super();
        this._dialog = _dialog;
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return null;
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    setDefault() {
        super.setDefault();
    }
    editValue() {
        const dialogRef = this._dialog.open(CoreLicenseDialogWindow, {
            data: { item: this.value ? this.value : new License(), readonlyMode: this.disabled ?? false }
        });
        const sub = dialogRef.afterClosed().subscribe((result) => {
            if (result && result.state !== DialogReason.cancel) {
                if (result !== this.value) {
                    this.onValueChange(result);
                }
                this.valueChange.emit(this.value);
            }
            sub.unsubscribe();
        });
    }
    // implements Validator
    validate(control) {
        if (this.settings?.isRequired) {
            if (control.value === null || control.value === undefined) {
                return { 'required': true };
            }
        }
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldLicenseComponent, deps: [{ token: i1$8.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldLicenseComponent, isStandalone: false, selector: "core-field-license", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldLicenseComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFieldLicenseComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"\">\n    <div class=\"complex-field sln-invalid-rule-row\">\n      <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n        <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n        @if (value?.number) {\n          <h2>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.number }} \u043E\u0442 {{ value?.issueDate | dateRu }}</span>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.kindOfActivity }}</span>\n          </h2>\n        }\n      </div>\n      <button (click)=\"editValue()\" class=\"\" style=\"min-width: 20px;\">\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (!disabled && isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @if (!disabled && !isImageEmpty) {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (disabled) {\n            <div class=\"sln-control-eye\"></div>\n          }\n        </div>\n      </button>\n    </div>\n    <mat-form-field style=\"display: none;\">\n      <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n    </mat-form-field>\n  </div>\n</div>\n", dependencies: [{ kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: CopyClipboardDirective, selector: "[copyClipboard]", inputs: ["tooltip", "delay"] }, { kind: "pipe", type: RuDatePipe, name: "dateRu" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldLicenseComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-license', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldLicenseComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFieldLicenseComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm>\n  <div class=\"\">\n    <div class=\"complex-field sln-invalid-rule-row\">\n      <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n        <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n        @if (value?.number) {\n          <h2>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.number }} \u043E\u0442 {{ value?.issueDate | dateRu }}</span>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.kindOfActivity }}</span>\n          </h2>\n        }\n      </div>\n      <button (click)=\"editValue()\" class=\"\" style=\"min-width: 20px;\">\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (!disabled && isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @if (!disabled && !isImageEmpty) {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (disabled) {\n            <div class=\"sln-control-eye\"></div>\n          }\n        </div>\n      </button>\n    </div>\n    <mat-form-field style=\"display: none;\">\n      <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n    </mat-form-field>\n  </div>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }] });

class CoreLicenseModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLicenseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreLicenseModule, declarations: [CoreLicenseCardComponent,
            CoreLicenseDialogWindow,
            CoreFieldLicenseComponent], imports: [CoreBaseModule,
            CoreMatModule,
            CoreDialogModule,
            CoreDirectiveModule,
            CoreControlModule,
            CorePipeModule], exports: [CoreLicenseDialogWindow,
            CoreLicenseCardComponent,
            CoreFieldLicenseComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLicenseModule, imports: [CoreBaseModule,
            CoreMatModule,
            CoreDialogModule,
            CoreDirectiveModule,
            CoreControlModule,
            CorePipeModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreLicenseModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreLicenseCardComponent,
                        CoreLicenseDialogWindow,
                        CoreFieldLicenseComponent,
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreDialogModule,
                        CoreDirectiveModule,
                        CoreControlModule,
                        CorePipeModule,
                    ],
                    exports: [
                        CoreLicenseDialogWindow,
                        CoreLicenseCardComponent,
                        CoreFieldLicenseComponent
                    ]
                }]
        }] });

class CoreRequisiteCardComponent extends CoreAbstractComponent {
    constructor() {
        super(...arguments);
        this.configBank = { type: DadataType.bank };
        this.valueChange = new EventEmitter();
    }
    ngOnInit() {
        if (this.item?.bankName) {
            this.selected = true;
        }
    }
    onBankSelected(event) {
        const bankData = event.data;
        if (bankData) {
            this.item.bik = bankData.bic;
            this.item.correspondentAccount = bankData.correspondent_account;
            this.item.bankName = bankData.name.payment;
            this.item.bankAddress = bankData.address.unrestricted_value;
            this.item.inn = bankData.inn;
            this.item.kpp = bankData.kpp;
            this.selected = true;
        }
    }
    onValuesChange($event) {
        this.valueChange.emit($event);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRequisiteCardComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreRequisiteCardComponent, isStandalone: false, selector: "core-requisite-card", inputs: { readonly: "readonly", item: "item", selected: "selected" }, outputs: { valueChange: "valueChange" }, usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  @if (item.organizationName) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"item.organizationName\" name=\"organizationName\" fieldName=\"organizationName\" placeholder=\"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F\"\n          (valueChange)=\"onValuesChange($event)\" [disabled]=\"readonly\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n  @if (item.organizationInn) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left\">\n        <div class=\"form-group\">\n          <core-field-inn [(ngModel)]=\"item.organizationInn\" name=\"organizationInn\" fieldName=\"organizationInn\" placeholder=\"\u0418\u041D\u041D \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F\"\n          [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-inn>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-kpp [(ngModel)]=\"item.organizationKpp\" name=\"organizationKpp\" fieldName=\"organizationKpp\" placeholder=\"\u041A\u041F\u041F \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F\"\n          [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-kpp>\n        </div>\n      </div>\n    </div>\n  }\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-account\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.account\" name=\"account\" fieldName=\"account\" placeholder=\"\u0421\u0447\u0435\u0442\" (valueChange)=\"onValuesChange($event)\" [settings]=\"{ isRequired: true, useMask: true, maskExpression: '00000 000 0 000 0000 0000'}\" [disabled]=\"readonly\" class=\"sln-core-field-string-account\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  @if (readonly === false) {\n    <div class=\"row\">\n      <core-dadata-search [config]=\"configBank\" placeholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0438\u043B\u0438 \u0411\u0418\u041A \u0434\u043B\u044F \u0430\u0432\u0442\u043E\u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F\" (selected)=\"onBankSelected($event)\"></core-dadata-search>\n    </div>\n  }\n  @if (selected) {\n    <div class=\"sln-info-selected\">\n      <div class=\"row\">\n        <div class=\"col-md-6\">\n          <div class=\"form-group\">\n            <core-field-string [(ngModel)]=\"item.bik\" name=\"bik\" fieldName=\"bik\" placeholder=\"\u0411\u0418\u041A \u0431\u0430\u043D\u043A\u0430\" [settings]=\"{ isRequired: true }\" [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n          </div>\n        </div>\n        <div class=\"col-md-6 sln-padding-right\">\n          <div class=\"form-group\">\n            <core-field-string [(ngModel)]=\"item.correspondentAccount\" name=\"correspondentAccount\" fieldName=\"correspondentAccount\" placeholder=\"\u041A\u043E\u0440. \u0441\u0447\u0435\u0442\" [settings]=\"{ isRequired: true }\" [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n          </div>\n        </div>\n      </div>\n      <div class=\"row\">\n        <div class=\"col-md-6\">\n          <div class=\"form-group\">\n            <core-field-string [(ngModel)]=\"item.bankName\" name=\"bankName\" fieldName=\"bankName\" placeholder=\"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0431\u0430\u043D\u043A\u0430\" [settings]=\"{ isRequired: true }\" [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n          </div>\n        </div>\n        <div class=\"col-md-6 sln-padding-right\">\n          <div class=\"form-group\">\n            <core-field-string [(ngModel)]=\"item.bankAddress\" name=\"bankAddress\" fieldName=\"bankAddress\" placeholder=\"\u0410\u0434\u0440\u0435\u0441 \u0431\u0430\u043D\u043A\u0430\" [settings]=\"{ isRequired: true }\" [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n          </div>\n        </div>\n      </div>\n      @if (item.inn) {\n        <div class=\"row\">\n          <div class=\"col-md-6 sln-padding-left sln-item-inn\">\n            <div class=\"form-group\">\n              <core-field-inn [(ngModel)]=\"item.inn\" name=\"inn\" placeholder=\"\u0418\u041D\u041D \u0431\u0430\u043D\u043A\u0430\" fieldName=\"inn\"\n              [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-inn>\n            </div>\n          </div>\n          <div class=\"col-md-6 sln-padding-right\">\n            <div class=\"form-group\">\n              <core-field-kpp [(ngModel)]=\"item.kpp\" name=\"kpp\" placeholder=\"\u041A\u041F\u041F \u0431\u0430\u043D\u043A\u0430\" fieldName=\"kpp\"\n              [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-kpp>\n            </div>\n          </div>\n        </div>\n      }\n    </div>\n  }\n</div>", styles: [".sln-info-selected .col-md-6{padding-left:0}.sln-padding-right{padding-right:0}.sln-padding-left{padding-left:0}.sln-account{padding:0}\n"], dependencies: [{ kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "component", type: CoreFieldInnComponent, selector: "core-field-inn" }, { kind: "component", type: CoreFieldKppComponent, selector: "core-field-kpp" }, { kind: "component", type: CoreDadataSearchComponent, selector: "core-dadata-search", inputs: ["config", "disabled", "type", "limit", "placeholder", "locations", "address"], outputs: ["configChanged", "selectedSuggestion", "selected"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRequisiteCardComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-requisite-card', standalone: false, template: "<div provideParentForm>\n  @if (item.organizationName) {\n    <div class=\"row\">\n      <div class=\"col-md-12 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-string [(ngModel)]=\"item.organizationName\" name=\"organizationName\" fieldName=\"organizationName\" placeholder=\"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F\"\n          (valueChange)=\"onValuesChange($event)\" [disabled]=\"readonly\"></core-field-string>\n        </div>\n      </div>\n    </div>\n  }\n  @if (item.organizationInn) {\n    <div class=\"row\">\n      <div class=\"col-md-6 sln-padding-left\">\n        <div class=\"form-group\">\n          <core-field-inn [(ngModel)]=\"item.organizationInn\" name=\"organizationInn\" fieldName=\"organizationInn\" placeholder=\"\u0418\u041D\u041D \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F\"\n          [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-inn>\n        </div>\n      </div>\n      <div class=\"col-md-6 sln-padding-left sln-padding-right\">\n        <div class=\"form-group\">\n          <core-field-kpp [(ngModel)]=\"item.organizationKpp\" name=\"organizationKpp\" fieldName=\"organizationKpp\" placeholder=\"\u041A\u041F\u041F \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F\"\n          [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-kpp>\n        </div>\n      </div>\n    </div>\n  }\n  <div class=\"row\">\n    <div class=\"col-md-12 sln-account\">\n      <div class=\"form-group\">\n        <core-field-string [(ngModel)]=\"item.account\" name=\"account\" fieldName=\"account\" placeholder=\"\u0421\u0447\u0435\u0442\" (valueChange)=\"onValuesChange($event)\" [settings]=\"{ isRequired: true, useMask: true, maskExpression: '00000 000 0 000 0000 0000'}\" [disabled]=\"readonly\" class=\"sln-core-field-string-account\"></core-field-string>\n      </div>\n    </div>\n  </div>\n  @if (readonly === false) {\n    <div class=\"row\">\n      <core-dadata-search [config]=\"configBank\" placeholder=\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0438\u043B\u0438 \u0411\u0418\u041A \u0434\u043B\u044F \u0430\u0432\u0442\u043E\u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F\" (selected)=\"onBankSelected($event)\"></core-dadata-search>\n    </div>\n  }\n  @if (selected) {\n    <div class=\"sln-info-selected\">\n      <div class=\"row\">\n        <div class=\"col-md-6\">\n          <div class=\"form-group\">\n            <core-field-string [(ngModel)]=\"item.bik\" name=\"bik\" fieldName=\"bik\" placeholder=\"\u0411\u0418\u041A \u0431\u0430\u043D\u043A\u0430\" [settings]=\"{ isRequired: true }\" [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n          </div>\n        </div>\n        <div class=\"col-md-6 sln-padding-right\">\n          <div class=\"form-group\">\n            <core-field-string [(ngModel)]=\"item.correspondentAccount\" name=\"correspondentAccount\" fieldName=\"correspondentAccount\" placeholder=\"\u041A\u043E\u0440. \u0441\u0447\u0435\u0442\" [settings]=\"{ isRequired: true }\" [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n          </div>\n        </div>\n      </div>\n      <div class=\"row\">\n        <div class=\"col-md-6\">\n          <div class=\"form-group\">\n            <core-field-string [(ngModel)]=\"item.bankName\" name=\"bankName\" fieldName=\"bankName\" placeholder=\"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0431\u0430\u043D\u043A\u0430\" [settings]=\"{ isRequired: true }\" [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n          </div>\n        </div>\n        <div class=\"col-md-6 sln-padding-right\">\n          <div class=\"form-group\">\n            <core-field-string [(ngModel)]=\"item.bankAddress\" name=\"bankAddress\" fieldName=\"bankAddress\" placeholder=\"\u0410\u0434\u0440\u0435\u0441 \u0431\u0430\u043D\u043A\u0430\" [settings]=\"{ isRequired: true }\" [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-string>\n          </div>\n        </div>\n      </div>\n      @if (item.inn) {\n        <div class=\"row\">\n          <div class=\"col-md-6 sln-padding-left sln-item-inn\">\n            <div class=\"form-group\">\n              <core-field-inn [(ngModel)]=\"item.inn\" name=\"inn\" placeholder=\"\u0418\u041D\u041D \u0431\u0430\u043D\u043A\u0430\" fieldName=\"inn\"\n              [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-inn>\n            </div>\n          </div>\n          <div class=\"col-md-6 sln-padding-right\">\n            <div class=\"form-group\">\n              <core-field-kpp [(ngModel)]=\"item.kpp\" name=\"kpp\" placeholder=\"\u041A\u041F\u041F \u0431\u0430\u043D\u043A\u0430\" fieldName=\"kpp\"\n              [disabled]=\"true\" (valueChange)=\"onValuesChange($event)\"></core-field-kpp>\n            </div>\n          </div>\n        </div>\n      }\n    </div>\n  }\n</div>", styles: [".sln-info-selected .col-md-6{padding-left:0}.sln-padding-right{padding-right:0}.sln-padding-left{padding-left:0}.sln-account{padding:0}\n"] }]
        }], propDecorators: { readonly: [{
                type: Input
            }], item: [{
                type: Input
            }], selected: [{
                type: Input
            }], valueChange: [{
                type: Output
            }] } });

class IRequisiteDialogOptions {
}
class CoreRequisiteDialogWindow extends CoreAbstractComponent {
    constructor(_dialog, dialogRef, data) {
        super();
        this._dialog = _dialog;
        this.dialogRef = dialogRef;
        this.data = data;
        const row = this.data.item;
        if (!row.accountType) {
            row.accountType = { id: 1, text: 'Расчетный счет', description: null };
        }
    }
    checkRequisiteAccount(account, mode) {
        const acc = account?.replace(/\s/g, '');
        if (!acc || acc.length < 5) {
            return 'Некорректный номер счета';
        }
        const prefix = acc.substring(0, 5);
        if (mode === RequisitsMode.Fiz && prefix !== '40817') {
            return 'Счёт физлица должен начинаться с 40817';
        }
        if (mode === RequisitsMode.Jur && !(acc.startsWith('407') || prefix === '40802')) {
            return 'Счёт юрлица или ИП должен начинаться с 407 или 40802';
        }
        return null;
    }
    save() {
        const account = this.data.item?.account;
        const mode = this.data.requisitesMode ?? 'All';
        const error = this.checkRequisiteAccount(account, mode);
        if (error) {
            this._dialog.open(CoreInfoDialogWindow, { data: new InfoDiologConfig(InfoType.Danger, error) });
            return;
        }
        if (this.data.item?.bik && this.data.item.account && this.isValid(this.data.item)) {
            const row = this.data.item;
            if (this.data.organizationId) {
                row.organizationId = this.data.organizationId;
            }
            this.dialogRef.close(row);
        }
        else {
            this._dialog.open(CoreInfoDialogWindow, { data: new InfoDiologConfig(InfoType.Danger, 'Ошибка валидации счета по БИК. Убедитесь в корректности введенных данных.') });
        }
    }
    isValid(item) {
        if (!item?.bik || !item.account)
            return false;
        const accountButch = item.bik.substring(6, 9) + item.account;
        let sum = 0;
        // весовые коэффициенты
        const weight = [7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1];
        for (let i = 0; i <= 22; i++) {
            sum = sum + ((Number(accountButch[i]) * weight[i]) % 10);
        }
        // сравниваем остаток от деления контрольной суммы на 10 с нулём
        return sum % 10 === 0;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRequisiteDialogWindow, deps: [{ token: i1$8.MatDialog }, { token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreRequisiteDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u043E\u0432\" width=\"700\">\n  <div body>\n    <form #newRequisiteForm=\"ngForm\" novalidate>\n      <core-requisite-card [item]=\"data.item\" [readonly]=\"data.readonlyMode\"></core-requisite-card>\n    </form>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newRequisiteForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n", dependencies: [{ kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreRequisiteCardComponent, selector: "core-requisite-card", inputs: ["readonly", "item", "selected"], outputs: ["valueChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRequisiteDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u0414\u0430\u043D\u043D\u044B\u0435 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u043E\u0432\" width=\"700\">\n  <div body>\n    <form #newRequisiteForm=\"ngForm\" novalidate>\n      <core-requisite-card [item]=\"data.item\" [readonly]=\"data.readonlyMode\"></core-requisite-card>\n    </form>\n  </div>\n  <div footer>\n    @if (!data.readonlyMode) {\n      <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newRequisiteForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    }\n  </div>\n</core-dialog>\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }, { type: i1$8.MatDialogRef }, { type: IRequisiteDialogOptions, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });

class Requisites {
    constructor() {
        this.requisiteId = 0;
        this.enabled = true;
    }
}

class CoreFieldRequisiteComponent extends CoreAbstractAccessorComponent {
    get isImageEmpty() {
        return Utility.isEmpty(this.value?.account);
    }
    constructor(_dialog) {
        super();
        this._dialog = _dialog;
    }
    ngOnInit() {
        if (!this.settings) {
            this.settings = {};
        }
        this.setDefault();
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return null;
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    setDefault() {
        super.setDefault();
    }
    editValue() {
        const mode = this.settings?.requisitesMode;
        const dialogRef = this._dialog.open(CoreRequisiteDialogWindow, {
            data: {
                item: JSON.parse(JSON.stringify(this.value ? this.value : new Requisites())),
                readonlyMode: this.disabled ?? false,
                requisitesMode: mode
            }
        });
        const sub = dialogRef.afterClosed().subscribe((result) => {
            if (result && result.state !== DialogReason.cancel) {
                if (result !== this.value) {
                    this.onValueChange(result);
                }
                this.onUnfocused(result);
                this.valueChange.emit(this.value);
            }
            sub.unsubscribe();
        });
    }
    // implements Validator
    validate(control) {
        if (this.settings?.isRequired) {
            if (control.value === null || control.value === undefined) {
                return { 'required': true };
            }
        }
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldRequisiteComponent, deps: [{ token: i1$8.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldRequisiteComponent, isStandalone: false, selector: "core-field-requisite", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldRequisiteComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFieldRequisiteComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div provideParentForm>\n  <div class=\"\">\n    <div class=\"complex-field sln-invalid-rule-row\">\n      <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n        <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n        @if (value?.account) {\n          <h2>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.account | mask: '00000 000 0 000 0000 0000' }}</span>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.bankName }} \u0411\u0418\u041A: {{ value?.bik }}</span>\n          </h2>\n        }\n      </div>\n      <button (click)=\"editValue()\" style=\"min-width: 20px;\">\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (!disabled && isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @if (!disabled && !isImageEmpty) {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (disabled) {\n            <div class=\"sln-control-eye\"></div>\n          }\n        </div>\n      </button>\n    </div>\n    <mat-form-field style=\"display: none;\">\n      <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n    </mat-form-field>\n  </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i4$1.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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: CopyClipboardDirective, selector: "[copyClipboard]", inputs: ["tooltip", "delay"] }, { kind: "pipe", type: MaskPipe, name: "mask" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldRequisiteComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-requisite', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldRequisiteComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFieldRequisiteComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div provideParentForm>\n  <div class=\"\">\n    <div class=\"complex-field sln-invalid-rule-row\">\n      <div class=\"col-md-12 {{ disabled ? 'complex-field-info-readony': 'complex-field-info' }}\">\n        <span class=\"{{ !disabled && settings.isRequired ? 'required' : '' }} sln-complex-field__title\">{{ placeholder }}</span>\n        @if (value?.account) {\n          <h2>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.account | mask: '00000 000 0 000 0000 0000' }}</span>\n            <span copyClipboard class=\"sln-complex-field-copy\">{{ value?.bankName }} \u0411\u0418\u041A: {{ value?.bik }}</span>\n          </h2>\n        }\n      </div>\n      <button (click)=\"editValue()\" style=\"min-width: 20px;\">\n        <div matTooltip=\"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (!disabled && isImageEmpty) {\n            <div class=\"sln-control-empty-edit sln-control-empty-edit-position\"></div>\n          }\n          @if (!disabled && !isImageEmpty) {\n            <div class=\"sln-control-edit sln-control-edit-position\"></div>\n          }\n        </div>\n        <div matTooltip=\"\u0421\u043C\u043E\u0442\u0440\u0435\u0442\u044C\" matTooltipPosition=\"above\"  >\n          @if (disabled) {\n            <div class=\"sln-control-eye\"></div>\n          }\n        </div>\n      </button>\n    </div>\n    <mat-form-field style=\"display: none;\">\n      <input matInput [ngModel]=\"value\" [placeholder]=\"placeholder\" [required]=\"settings.isRequired\" [attr.fieldName]=\"fieldName\" name=\"{{ fieldName }}\" />\n    </mat-form-field>\n  </div>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i1$8.MatDialog }] });

class CoreRequisiteModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRequisiteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreRequisiteModule, declarations: [CoreRequisiteDialogWindow,
            CoreRequisiteCardComponent,
            CoreFieldRequisiteComponent], imports: [CorePipeModule,
            CoreMatModule,
            CoreControlModule,
            CoreDaDataModule,
            CoreDialogModule,
            CoreBaseModule,
            CoreDirectiveModule], exports: [CoreRequisiteDialogWindow,
            CoreRequisiteCardComponent,
            CoreFieldRequisiteComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRequisiteModule, providers: [
            provideNgxMask({
                decimalMarker: ','
            })
        ], imports: [CorePipeModule,
            CoreMatModule,
            CoreControlModule,
            CoreDaDataModule,
            CoreDialogModule,
            CoreBaseModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreRequisiteModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreRequisiteDialogWindow,
                        CoreRequisiteCardComponent,
                        CoreFieldRequisiteComponent
                    ],
                    imports: [
                        CorePipeModule,
                        CoreMatModule,
                        CoreControlModule,
                        CoreDaDataModule,
                        CoreDialogModule,
                        CoreBaseModule,
                        CoreDirectiveModule
                    ],
                    providers: [
                        provideNgxMask({
                            decimalMarker: ','
                        })
                    ],
                    exports: [
                        CoreRequisiteDialogWindow,
                        CoreRequisiteCardComponent,
                        CoreFieldRequisiteComponent
                    ]
                }]
        }] });

class RequisiteService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    // получение одной записи по идентификатору
    getSimple(itemId) {
        // get
        const url = this._startUp.apiRoot('requisites', 'core') + '/' + itemId;
        return this._ajaxM.get({ url: url });
    }
    // сохранение данных
    save(item) {
        // post
        const url = this._startUp.apiRoot('requisites', 'core');
        return this._ajaxM.post({ url: url, data: item });
    }
    isValid(item) {
        if (!item?.bik || !item.account)
            return false;
        const accountButch = item.bik.substring(6, 9) + item.account;
        let sum = 0;
        // весовые коэффициенты
        const weight = [7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1];
        for (let i = 0; i <= 22; i++) {
            sum = sum + ((Number(accountButch[i]) * weight[i]) % 10);
        }
        // сравниваем остаток от деления контрольной суммы на 10 с нулём
        return sum % 10 === 0;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RequisiteService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RequisiteService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: RequisiteService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

var DeleteStatus;
(function (DeleteStatus) {
    DeleteStatus[DeleteStatus["NotDeleted"] = 0] = "NotDeleted";
    DeleteStatus[DeleteStatus["DeletedForAuthor"] = 1] = "DeletedForAuthor";
    DeleteStatus[DeleteStatus["DeletedForEveryone"] = 2] = "DeletedForEveryone";
})(DeleteStatus || (DeleteStatus = {}));

class CompositeAccessSchemaService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    getGlobalItems(isGlobal, organizationId) {
        let query = '';
        if (isGlobal !== true) {
            query = '&organizationId=' + organizationId;
        }
        const url = this._startUp.apiRoot('roles/access-schemas?isGlobal=' + isGlobal + query, 'core');
        return this._ajaxM.get({ url: url });
    }
    getRedefinitionItems(organizationId) {
        const url = this._startUp.apiRoot('roles/redefinition?organizationId=' + organizationId, 'core');
        return this._ajaxM.get({ url: url });
    }
    setRedefinitionItems(items, organizationId) {
        const url = this._startUp.apiRoot('roles/redefinition?organizationId=' + organizationId, 'core');
        return this._ajaxM.post({ url: url, data: items });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CompositeAccessSchemaService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CompositeAccessSchemaService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CompositeAccessSchemaService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class BaseAccessSchemaComponent extends CoreBaseDestroyComponent {
    /** Общая загрузка по ключу: один HTTP на страницу, остальные экземпляры подписываются на shareReplay и читают из sessionStorage после записи первым. */
    static { this.sharedLoads = new Map(); }
    constructor(_storage, _service, _popup) {
        super();
        this._storage = _storage;
        this._service = _service;
        this._popup = _popup;
        this.isGlobal = true;
        /** Явные начальные значения — иначе `undefined` в @if меняется после loadCoreAccessSchema и даёт NG0100. */
        this.isInherited = false; // bitPosition = 1
        this.isUseEveryone = false; // bitPosition = 2
    }
    ngOnInit() {
        this.STORAGE_KEY = Utility.isEmpty(this.storageKey) ? 'PROCESS_ACCESS_SCHEMA_GLOBAL' : this.storageKey;
    }
    _getItems() {
        if (this.getItemFunction) {
            return this.getItemFunction();
        }
        else {
            return this._service.getGlobalItems(this.isGlobal, this.organizationId);
        }
    }
    /**
     * AjaxService.get / кастомный getItemFunction часто отдают тело ответа без оболочки IEntityResponse.
     * Тогда isSuccess не определён, HandleIEntityResponse считает ответ ошибкой, показывает пустой toast и не вызывает successCallback — sessionStorage не заполняется.
     */
    _normalizeGetItemsResponse(raw) {
        if (raw != null && typeof raw === 'object' && typeof raw.isSuccess === 'boolean') {
            return raw;
        }
        return {
            isSuccess: true,
            message: '',
            entity: raw
        };
    }
    loadCoreAccessSchema() {
        const cached = this._storage.getItem(this.STORAGE_KEY);
        if (cached) {
            this.items = JSON.parse(cached);
            this.recalculateSchema();
            return;
        }
        let shared$ = BaseAccessSchemaComponent.sharedLoads.get(this.STORAGE_KEY);
        if (!shared$) {
            const storageKey = this.STORAGE_KEY;
            shared$ = this._getItems().pipe(take$1(1), mergeMap(response => new Observable(subscriber => {
                this._popup.HandleIEntityResponse({
                    response: this._normalizeGetItemsResponse(response),
                    successCallback: (entity) => {
                        this._storage.setItem(storageKey, JSON.stringify(entity));
                        subscriber.next(entity);
                        subscriber.complete();
                    },
                    failCallback: () => subscriber.complete()
                });
            })), shareReplay({ bufferSize: 1, refCount: true }), finalize$1(() => BaseAccessSchemaComponent.sharedLoads.delete(storageKey)));
            BaseAccessSchemaComponent.sharedLoads.set(this.STORAGE_KEY, shared$);
        }
        shared$.pipe(this.takeUntilDestroyed()).subscribe(entity => {
            this.items = JSON.parse(JSON.stringify(entity));
            // Отложить до следующего цикла: иначе ответ HTTP прилетает во время dev-проверки представления → NG0100.
            setTimeout(() => this.recalculateSchema(), 0);
        });
    }
    recalculateSchema() {
        if (!Utility.isEmpty(this.getData()) && !Utility.isEmpty(this.items) && this.items.length > 0) {
            const bin = StringExtension.padLeft(this.getData().toString(2), this.items.length + 2, '0')
                .split('').reverse().join('');
            this.isInherited = bin[0] === '1';
            this.isUseEveryone = bin[1] === '1';
            this.items.forEach(x => {
                x.value = bin[x.bitPosition - 1] === '1';
            });
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BaseAccessSchemaComponent, deps: [{ token: BrowserSessionStorage }, { token: CompositeAccessSchemaService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: BaseAccessSchemaComponent, isStandalone: false, selector: "ng-component", inputs: { isGlobal: "isGlobal", organizationId: "organizationId", storageKey: "storageKey", getItemFunction: "getItemFunction" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: BaseAccessSchemaComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], ctorParameters: () => [{ type: BrowserSessionStorage }, { type: CompositeAccessSchemaService }, { type: PopupResults }], propDecorators: { isGlobal: [{
                type: Input
            }], organizationId: [{
                type: Input
            }], storageKey: [{
                type: Input
            }], getItemFunction: [{
                type: Input
            }] } });

class CoreCompositeAccessSchemaEditComponent extends BaseAccessSchemaComponent {
    get // использовать дискрету доступа для всех
     canUseEveryone() {
        return !this.canInherited;
    }
    constructor(storage, service, popup) {
        super(storage, service, popup);
        this.valueChange = new EventEmitter();
    }
    ngOnInit() {
        if (Utility.isEmpty(this.canInherited)) {
            this.canInherited = true;
        }
        super.ngOnInit();
        this.loadCoreAccessSchema();
    }
    getData() {
        return this.data;
    }
    makeName(item) {
        let text = '';
        if (item.systemRole) {
            text += item.systemRole.text + ': ';
        }
        if (item.department) {
            text += item.department.text + ': ';
        }
        if (item.participationType) {
            text += item.participationType.text;
        }
        return text;
    }
    onValueChange() {
        let bin = this._iml(this.isInherited) + this._iml(this.isUseEveryone);
        // сортируем по возрастанию разряда и добавляем значение к строке
        this.items
            .sort((a, b) => (a.bitPosition > b.bitPosition) ? 1 : -1)
            .forEach(x => {
            bin += this._iml(x.value, x.enabled);
        });
        const result = Number.parseInt(bin.split('').reverse().join(''), 2);
        this.valueChange.emit(result);
    }
    _iml(val, enabled = true) {
        if (enabled !== true) {
            return '0';
        }
        return val ? '1' : '0';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCompositeAccessSchemaEditComponent, deps: [{ token: BrowserSessionStorage }, { token: CompositeAccessSchemaService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreCompositeAccessSchemaEditComponent, isStandalone: false, selector: "core-access-schema", inputs: { data: "data", canInherited: "canInherited" }, outputs: { valueChange: "valueChange" }, usesInheritance: true, ngImport: i0, template: "<label>\u0414\u043E\u0441\u0442\u0443\u043F</label>\n@if (canInherited) {\n  <core-field-bool [(ngModel)]=\"isInherited\" name=\"isInherited\" fieldName=\"isInherited\" placeholder=\"\u041D\u0430\u0441\u043B\u0435\u0434\u0443\u0435\u0442\u0441\u044F \u043E\u0442 \u0448\u0430\u0433\u0430\" [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onValueChange()\"></core-field-bool>\n}\n@if (canUseEveryone) {\n  <core-field-bool [(ngModel)]=\"isUseEveryone\" name=\"isUseEveryone\" fieldName=\"isUseEveryone\" placeholder=\"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0432\u0441\u0435\u043C\" [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onValueChange()\"></core-field-bool>\n}\n@if ((canInherited === true && isInherited !== true) || (canUseEveryone === true && isUseEveryone !== true)) {\n  <div>\n    @for (item of items; track item; let i = $index) {\n      <core-field-bool\n        [(ngModel)]=\"item.value\" name=\"access_item_{{i}}\" fieldName=\"access_item_{{i}}\" placeholder=\"{{ makeName(item) }}\"\n      [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onValueChange()\"></core-field-bool>\n    }\n  </div>\n}", dependencies: [{ kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreFieldTypeBoolComponent, selector: "core-field-bool" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCompositeAccessSchemaEditComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-access-schema', standalone: false, template: "<label>\u0414\u043E\u0441\u0442\u0443\u043F</label>\n@if (canInherited) {\n  <core-field-bool [(ngModel)]=\"isInherited\" name=\"isInherited\" fieldName=\"isInherited\" placeholder=\"\u041D\u0430\u0441\u043B\u0435\u0434\u0443\u0435\u0442\u0441\u044F \u043E\u0442 \u0448\u0430\u0433\u0430\" [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onValueChange()\"></core-field-bool>\n}\n@if (canUseEveryone) {\n  <core-field-bool [(ngModel)]=\"isUseEveryone\" name=\"isUseEveryone\" fieldName=\"isUseEveryone\" placeholder=\"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0432\u0441\u0435\u043C\" [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onValueChange()\"></core-field-bool>\n}\n@if ((canInherited === true && isInherited !== true) || (canUseEveryone === true && isUseEveryone !== true)) {\n  <div>\n    @for (item of items; track item; let i = $index) {\n      <core-field-bool\n        [(ngModel)]=\"item.value\" name=\"access_item_{{i}}\" fieldName=\"access_item_{{i}}\" placeholder=\"{{ makeName(item) }}\"\n      [settings]=\"{ mode:'Checkbox' }\" (valueChange)=\"onValueChange()\"></core-field-bool>\n    }\n  </div>\n}" }]
        }], ctorParameters: () => [{ type: BrowserSessionStorage }, { type: CompositeAccessSchemaService }, { type: PopupResults }], propDecorators: { data: [{
                type: Input
            }], canInherited: [{
                type: Input
            }], valueChange: [{
                type: Output
            }] } });

class CoreCompositeAccessSchemaLabelComponent extends BaseAccessSchemaComponent {
    get data() {
        return this._data;
    }
    set data(v) {
        if (v !== undefined && v !== this._data) {
            this._data = v;
            // Смена data часто приходит во время CD родителя; отложить после dev-проверки (см. NG0100).
            setTimeout(() => this.recalculateSchema(), 0);
        }
    }
    recalculateSchema() {
        super.recalculateSchema();
        this.rebuildMixItems();
    }
    rebuildMixItems() {
        if (!this.items || this.items.length === 0) {
            this.mixItems = [];
            return;
        }
        function unique(value, index, array) {
            return array.indexOf(value) === index;
        }
        const titles = this.isGlobal
            ? this.items.map(x => x.systemRole.text).filter(unique)
            : this.items.map(x => x.department.text).filter(unique);
        const next = [];
        titles.forEach((x) => {
            next.push({
                title: x,
                objs: this.isGlobal
                    ? this.items.filter(e => e.systemRole.text === x)
                    : this.items.filter(e => e.department.text === x),
                value: this.isGlobal
                    ? this.items.filter(e => e.systemRole.text === x).some(e => e.value === true)
                    : this.items.filter(e => e.department.text === x).some(e => e.value === true)
            });
        });
        this.mixItems = next;
    }
    constructor(storage, service, popup) {
        super(storage, service, popup);
        /** Кэш групп для шаблона — геттер нельзя: каждый вызов создавал бы новые объекты и ломал track в @for (NG0100). */
        this.mixItems = [];
    }
    ngOnInit() {
        super.ngOnInit();
        this.loadCoreAccessSchema();
    }
    getData() {
        return this.data;
    }
    makeName(item) {
        let text = item.title + ': ';
        for (let i = 0; i < item.objs.length; i++) {
            if (item.objs[i].participationType) {
                if (item.objs[i].value === true) {
                    if (i > 0) {
                        text += ' / ';
                    }
                    text += item.objs[i].participationType.text;
                }
            }
        }
        return text;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCompositeAccessSchemaLabelComponent, deps: [{ token: BrowserSessionStorage }, { token: CompositeAccessSchemaService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreCompositeAccessSchemaLabelComponent, isStandalone: false, selector: "core-access-schema-label", inputs: { data: "data" }, usesInheritance: true, ngImport: i0, template: "@if (isInherited) {\n  <small>\u0414\u043E\u0441\u0442\u0443\u043F\u044B \u043D\u0430\u0441\u043B\u0435\u0434\u0443\u044E\u0442\u0441\u044F \u043E\u0442 \u0448\u0430\u0433\u0430;</small>\n}\n@if (isUseEveryone) {\n  <small> \u0414\u043E\u0441\u0442\u0443\u043F\u043E \u0434\u043B\u044F \u0432\u0441\u0435\u0445;</small>\n}\n@if (!isInherited && !isUseEveryone) {\n  <div>\n    @for (item of mixItems; track item; let i = $index) {\n      <span>\n        @if (item.value) {\n          <small>{{ makeName(item) }};</small>\n        }\n      </span>\n    }\n  </div>\n}", styles: ["small{display:inline-block;min-width:10px;padding:3px 0;font-size:14px;line-height:1;color:var(--DARK-GREY);text-align:left;border-radius:10px}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCompositeAccessSchemaLabelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-access-schema-label', standalone: false, template: "@if (isInherited) {\n  <small>\u0414\u043E\u0441\u0442\u0443\u043F\u044B \u043D\u0430\u0441\u043B\u0435\u0434\u0443\u044E\u0442\u0441\u044F \u043E\u0442 \u0448\u0430\u0433\u0430;</small>\n}\n@if (isUseEveryone) {\n  <small> \u0414\u043E\u0441\u0442\u0443\u043F\u043E \u0434\u043B\u044F \u0432\u0441\u0435\u0445;</small>\n}\n@if (!isInherited && !isUseEveryone) {\n  <div>\n    @for (item of mixItems; track item; let i = $index) {\n      <span>\n        @if (item.value) {\n          <small>{{ makeName(item) }};</small>\n        }\n      </span>\n    }\n  </div>\n}", styles: ["small{display:inline-block;min-width:10px;padding:3px 0;font-size:14px;line-height:1;color:var(--DARK-GREY);text-align:left;border-radius:10px}\n"] }]
        }], ctorParameters: () => [{ type: BrowserSessionStorage }, { type: CompositeAccessSchemaService }, { type: PopupResults }], propDecorators: { data: [{
                type: Input
            }] } });

var ParticipationDisplayMode;
(function (ParticipationDisplayMode) {
    ParticipationDisplayMode[ParticipationDisplayMode["All"] = 0] = "All";
    ParticipationDisplayMode[ParticipationDisplayMode["System"] = 1] = "System";
})(ParticipationDisplayMode || (ParticipationDisplayMode = {}));
class CoreAccessSchemaSettingsComponent extends CoreBaseDestroyComponent {
    get excludedValues() {
        const byRole = this.items.filter(x => !Utility.isEmpty(x.systemRole)).map(x => x.systemRole);
        const byDepartment = this.items.filter(x => !Utility.isEmpty(x.department)).map(x => x.department);
        return ArrayExtension.distinctBy(byRole.concat(byDepartment), 'id');
    }
    constructor(_context, _service, _popup) {
        super();
        this._service = _service;
        this._popup = _popup;
        this.participationMode = ParticipationDisplayMode.System;
        this.valuesChange = new EventEmitter();
        this.items = new Array();
        this.isSystem = _context.isSystem();
    }
    ngOnInit() {
        if (Utility.isEmpty(this.isGlobal)) {
            this.isGlobal = true;
        }
        this._reloadData();
    }
    onValueChange(_) {
        this.valuesChange.emit(this.items);
    }
    onKeyValueChange(index) {
        console.log(index);
        const item = this.items[index];
        const nextItem = this.items[index + 1];
        if (Utility.isEmpty(item.department)) {
            // роли
            // корректируем второй элемент на основе первого
            nextItem.systemRole = item.systemRole;
        }
        else {
            // департаменты
            // корректируем второй элемент на основе первого
            nextItem.department = item.department;
        }
        ;
        this.onValueChange();
    }
    add() {
        const positions = this.items.map(x => x.bitPosition);
        const lastPosition = positions.length === 0 ? 2 : Math.max(...positions);
        this.items.push({ bitPosition: lastPosition + 1, enabled: true, participationType: { id: 100, text: 'Администратор' } });
        this.items.push({ bitPosition: lastPosition + 2, enabled: true, participationType: { id: 101, text: 'Оператор' } });
        this.onValueChange();
    }
    ban(index) {
        const item = this.items[index];
        const nextItem = this.items[index + 1];
        CoreDialog.confirm(() => {
            item.enabled = !item.enabled;
            nextItem.enabled = !nextItem.enabled;
            this.onValueChange();
        });
    }
    remove(index) {
        const item = this.items[index];
        const nextItem = this.items[index + 1];
        if (!item.id) {
            this.items = this.items.filter(x => x != item && x != nextItem);
            this.onValueChange();
        }
        else {
            CoreNotification.warning('Нельзя удалить сохраненный в системе элемент доступа');
        }
    }
    _reloadData() {
        var observable = this.getDataFunction
            ? this.getDataFunction(this.organizationId)
            : this.isGlobal
                ? this._service.getGlobalItems(this.isGlobal, this.organizationId)
                : this._service.getRedefinitionItems(this.organizationId);
        observable
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popup.HandleIEntityResponse({
            response: response,
            successCallback: (entity) => {
                if ((Utility.isEmpty(entity) || entity.length === 0) && this.isGlobal == false) {
                    this.items = [
                        { bitPosition: 3, department: { id: 1, text: 'Не задано' }, participationType: { id: 100, text: 'Администратор' }, enabled: true },
                        { bitPosition: 4, department: { id: 1, text: 'Не задано' }, participationType: { id: 101, text: 'Оператор' }, enabled: true }
                    ];
                }
                else {
                    this.items = entity;
                }
                this.onValueChange();
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAccessSchemaSettingsComponent, deps: [{ token: ContextService }, { token: CompositeAccessSchemaService }, { token: PopupResults }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreAccessSchemaSettingsComponent, isStandalone: false, selector: "core-access-schema-settings", inputs: { isGlobal: "isGlobal", organizationId: "organizationId", getDataFunction: "getDataFunction" }, outputs: { valuesChange: "valuesChange" }, usesInheritance: true, ngImport: i0, template: "\n<div provideParentForm style=\"height:60vh; overflow: auto;\">\n  <div class=\"sln-schema-settings__items\">\n    @for (item of items; track item; let i = $index) {\n      <div class=\"row\" [class.has-border]=\"(i + 1) % 2 === 0 && (i + 1) < items.length\">\n        @if (isSystem === true) {\n          <div class=\"col-md-3 sln-padding-left\">\n            <core-field-number [(ngModel)]=\"item.bitPosition\" name=\"bitPosition_{{i}}\" fieldName=\"bitPosition_{{i}}\" placeholder=\"\u041F\u043E\u0437\u0438\u0446\u0438\u044F \u0431\u0438\u0442\u0430\"\n            [settings]=\"{ isRequired: true, isReadonly: true, min: 3, decimals: 0 }\" [disabled]=\"true\"></core-field-number>\n          </div>\n        }\n        <div [ngClass]=\"isSystem ? 'col-md-4' : 'col-md-5'\">\n          <core-field-combobox [(ngModel)]=\"item.participationType\" name=\"participarion_{{i}}\" fieldName=\"participarion_{{i}}\" placeholder=\"\u041F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F\"\n          [settings]=\"{ sourceCode:'Participations', expressionD:[{ key:'mode', value: participationMode }] }\" (valueChange)=\"onValueChange($event)\" [disabled]=\"true\"></core-field-combobox>\n        </div>\n        @if (isGlobal) {\n          <div class=\"col-md-4\">\n            @if (i % 2 === 0) {\n              <core-field-combobox [(ngModel)]=\"item.systemRole\" name=\"systemRole_{{i}}\" fieldName=\"systemRole_{{i}}\" placeholder=\"\u0420\u043E\u043B\u044C\" [excludedValues]=\"excludedValues\"\n              [settings]=\"{ sourceCode:'Roles', isRequired: true  }\" (valueChange)=\"onKeyValueChange(i)\" [disabled]=\"item.id\"></core-field-combobox>\n            }\n            <!-- <div style=\"width: 100%; height: 10px;\"></div> -->\n          </div>\n        }\n        @if (!isGlobal) {\n          <div [ngClass]=\"isSystem ? 'col-md-4' : 'col-md-6'\">\n            @if (i % 2 === 0) {\n              <core-field-combobox [(ngModel)]=\"item.department\" name=\"department_{{i}}\" fieldName=\"department_{{i}}\" placeholder=\"\u041F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u0435\" [excludedValues]=\"excludedValues\"\n              [settings]=\"{ sourceCode:'Departments', isRequired: true, expressionD:[{ key:'organizationId', value: organizationId }]  }\" (valueChange)=\"onKeyValueChange(i)\" [disabled]=\"item.id\"></core-field-combobox>\n            }\n            <!-- <div style=\"width: 100%; height: 10px;\"></div> -->\n          </div>\n        }\n        <div class=\"col-md-1\">\n          @if (i % 2 === 0) {\n            @if (item.id) {\n              <button type=\"button\" (click)=\"ban(i)\" class=\"sln-access-schema-settings-button\" matTooltip=\"{{ item.enabled ? '\u0411\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C' : '\u0410\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C' }}\">\n                <div class=\" {{ item.enabled ? 'sln-grid-okay sln-grid-okay-position': 'sln-grid-delete sln-grid-delete-position' }} \"></div>\n              </button>\n            }\n            @if (!item.id) {\n              <button type=\"button\" (click)=\"remove(i)\" class=\"sln-access-schema-settings-button\" matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\">\n                <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n              </button>\n            }\n          }\n        </div>\n      </div>\n    }\n\n    <div class=\"col-md-12 sln-add-access-schema-settings\">\n      <button type=\"button\" class=\"btn-primary\" (click)=\"add()\">\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F</button>\n    </div>\n\n  </div>\n</div>", styles: [".sln-schema-settings .col-md-12{display:flex}.sln-schema-settings .col-md-12 button{margin-right:15px}.sln-schema-settings .sln-schema-settings__items{padding-top:15px}.sln-delete-access-button{background:none;cursor:pointer;border:1px solid;padding:2px 10px 8px}.sln-add-access-button{padding:0}.sln-add-access-button .btn-primary{margin-bottom:5px;float:right}.sln-add-access-schema-settings{margin-top:10px;padding:0;text-align:end}.sln-padding-left{padding-left:0}.sln-access-schema-settings-button{padding:10px;background:none;border-radius:5px}.col-md-1{padding:10px 0 0;height:45px;display:flex;align-items:center;justify-content:flex-end}.col-md-3{padding:0}.col-md-4{padding-right:0}.col-md-5{padding:0}.col-md-6{padding-right:0}.sln-common-action-delete-position{width:22px;height:22px}.row.has-border{border-bottom:1px solid #e2e8ea;padding-bottom:10px;margin-bottom:10px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ProvideParentFormDirective, selector: "[provideParentForm]" }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeNumberComponent, selector: "core-field-number", inputs: ["isInt"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAccessSchemaSettingsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-access-schema-settings', standalone: false, template: "\n<div provideParentForm style=\"height:60vh; overflow: auto;\">\n  <div class=\"sln-schema-settings__items\">\n    @for (item of items; track item; let i = $index) {\n      <div class=\"row\" [class.has-border]=\"(i + 1) % 2 === 0 && (i + 1) < items.length\">\n        @if (isSystem === true) {\n          <div class=\"col-md-3 sln-padding-left\">\n            <core-field-number [(ngModel)]=\"item.bitPosition\" name=\"bitPosition_{{i}}\" fieldName=\"bitPosition_{{i}}\" placeholder=\"\u041F\u043E\u0437\u0438\u0446\u0438\u044F \u0431\u0438\u0442\u0430\"\n            [settings]=\"{ isRequired: true, isReadonly: true, min: 3, decimals: 0 }\" [disabled]=\"true\"></core-field-number>\n          </div>\n        }\n        <div [ngClass]=\"isSystem ? 'col-md-4' : 'col-md-5'\">\n          <core-field-combobox [(ngModel)]=\"item.participationType\" name=\"participarion_{{i}}\" fieldName=\"participarion_{{i}}\" placeholder=\"\u041F\u043E\u043B\u043D\u043E\u043C\u043E\u0447\u0438\u044F\"\n          [settings]=\"{ sourceCode:'Participations', expressionD:[{ key:'mode', value: participationMode }] }\" (valueChange)=\"onValueChange($event)\" [disabled]=\"true\"></core-field-combobox>\n        </div>\n        @if (isGlobal) {\n          <div class=\"col-md-4\">\n            @if (i % 2 === 0) {\n              <core-field-combobox [(ngModel)]=\"item.systemRole\" name=\"systemRole_{{i}}\" fieldName=\"systemRole_{{i}}\" placeholder=\"\u0420\u043E\u043B\u044C\" [excludedValues]=\"excludedValues\"\n              [settings]=\"{ sourceCode:'Roles', isRequired: true  }\" (valueChange)=\"onKeyValueChange(i)\" [disabled]=\"item.id\"></core-field-combobox>\n            }\n            <!-- <div style=\"width: 100%; height: 10px;\"></div> -->\n          </div>\n        }\n        @if (!isGlobal) {\n          <div [ngClass]=\"isSystem ? 'col-md-4' : 'col-md-6'\">\n            @if (i % 2 === 0) {\n              <core-field-combobox [(ngModel)]=\"item.department\" name=\"department_{{i}}\" fieldName=\"department_{{i}}\" placeholder=\"\u041F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u0435\" [excludedValues]=\"excludedValues\"\n              [settings]=\"{ sourceCode:'Departments', isRequired: true, expressionD:[{ key:'organizationId', value: organizationId }]  }\" (valueChange)=\"onKeyValueChange(i)\" [disabled]=\"item.id\"></core-field-combobox>\n            }\n            <!-- <div style=\"width: 100%; height: 10px;\"></div> -->\n          </div>\n        }\n        <div class=\"col-md-1\">\n          @if (i % 2 === 0) {\n            @if (item.id) {\n              <button type=\"button\" (click)=\"ban(i)\" class=\"sln-access-schema-settings-button\" matTooltip=\"{{ item.enabled ? '\u0411\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C' : '\u0410\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C' }}\">\n                <div class=\" {{ item.enabled ? 'sln-grid-okay sln-grid-okay-position': 'sln-grid-delete sln-grid-delete-position' }} \"></div>\n              </button>\n            }\n            @if (!item.id) {\n              <button type=\"button\" (click)=\"remove(i)\" class=\"sln-access-schema-settings-button\" matTooltip=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C\">\n                <div class=\"sln-common-action-delete sln-common-action-delete-position\"></div>\n              </button>\n            }\n          }\n        </div>\n      </div>\n    }\n\n    <div class=\"col-md-12 sln-add-access-schema-settings\">\n      <button type=\"button\" class=\"btn-primary\" (click)=\"add()\">\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F</button>\n    </div>\n\n  </div>\n</div>", styles: [".sln-schema-settings .col-md-12{display:flex}.sln-schema-settings .col-md-12 button{margin-right:15px}.sln-schema-settings .sln-schema-settings__items{padding-top:15px}.sln-delete-access-button{background:none;cursor:pointer;border:1px solid;padding:2px 10px 8px}.sln-add-access-button{padding:0}.sln-add-access-button .btn-primary{margin-bottom:5px;float:right}.sln-add-access-schema-settings{margin-top:10px;padding:0;text-align:end}.sln-padding-left{padding-left:0}.sln-access-schema-settings-button{padding:10px;background:none;border-radius:5px}.col-md-1{padding:10px 0 0;height:45px;display:flex;align-items:center;justify-content:flex-end}.col-md-3{padding:0}.col-md-4{padding-right:0}.col-md-5{padding:0}.col-md-6{padding-right:0}.sln-common-action-delete-position{width:22px;height:22px}.row.has-border{border-bottom:1px solid #e2e8ea;padding-bottom:10px;margin-bottom:10px}\n"] }]
        }], ctorParameters: () => [{ type: ContextService }, { type: CompositeAccessSchemaService }, { type: PopupResults }], propDecorators: { isGlobal: [{
                type: Input
            }], organizationId: [{
                type: Input
            }], getDataFunction: [{
                type: Input
            }], valuesChange: [{
                type: Output
            }] } });

class CoreAccessSchemaSettingsDialogWindow extends CoreBaseDestroyComponent {
    constructor(data, _dialogRef, _service, _popup, _storage) {
        super();
        this.data = data;
        this._dialogRef = _dialogRef;
        this._service = _service;
        this._popup = _popup;
        this._storage = _storage;
    }
    onValueChange($event) {
        this.items = $event;
    }
    save() {
        var observable = this.data.setDataFunction
            ? this.data.setDataFunction(this.items, this.data.organizationId)
            : this._service.setRedefinitionItems(this.items, this.data.organizationId);
        observable
            .pipe(this.takeUntilDestroyed())
            .subscribe((response) => this._popup.HandleIResponse({
            response: response,
            successCallback: () => {
                this._storage.removeItem(this.data.storageKey);
                this._dialogRef.close(this.items);
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAccessSchemaSettingsDialogWindow, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$8.MatDialogRef }, { token: CompositeAccessSchemaService }, { token: PopupResults }, { token: BrowserLocalStorage }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: CoreAccessSchemaSettingsDialogWindow, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<core-dialog dialogTitle=\"\u041D\u0430\u0431\u043E\u0440 \u0440\u043E\u043B\u0435\u0439\" width=\"800\">\n    <div body>\n        <form #newForm=\"ngForm\" novalidate class=\"sln-schema-settings\">\n            <core-access-schema-settings [isGlobal]=\"data.isGlobal\" [organizationId]=\"data.organizationId\" [getDataFunction]=\"data.getDataFunction\" (valuesChange)=\"onValueChange($event)\"></core-access-schema-settings>\n        </form>\n    </div>\n    <div footer>\n        <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    </div>\n</core-dialog>", dependencies: [{ kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "component", type: CoreAccessSchemaSettingsComponent, selector: "core-access-schema-settings", inputs: ["isGlobal", "organizationId", "getDataFunction"], outputs: ["valuesChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreAccessSchemaSettingsDialogWindow, decorators: [{
            type: Component,
            args: [{ standalone: false, template: "<core-dialog dialogTitle=\"\u041D\u0430\u0431\u043E\u0440 \u0440\u043E\u043B\u0435\u0439\" width=\"800\">\n    <div body>\n        <form #newForm=\"ngForm\" novalidate class=\"sln-schema-settings\">\n            <core-access-schema-settings [isGlobal]=\"data.isGlobal\" [organizationId]=\"data.organizationId\" [getDataFunction]=\"data.getDataFunction\" (valuesChange)=\"onValueChange($event)\"></core-access-schema-settings>\n        </form>\n    </div>\n    <div footer>\n        <button type=\"button\" class=\"btn-primary\" (click)=\"save()\" [disabled]=\"newForm.invalid\">\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C</button>\n    </div>\n</core-dialog>" }]
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: i1$8.MatDialogRef }, { type: CompositeAccessSchemaService }, { type: PopupResults }, { type: BrowserLocalStorage }] });

class CoreCompositeAccessSchemaModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCompositeAccessSchemaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreCompositeAccessSchemaModule, declarations: [CoreCompositeAccessSchemaEditComponent,
            CoreCompositeAccessSchemaLabelComponent,
            CoreAccessSchemaSettingsComponent,
            CoreAccessSchemaSettingsDialogWindow], imports: [CoreBaseModule,
            CoreMatModule,
            CoreControlModule,
            CoreDialogModule,
            CoreDirectiveModule], exports: [CoreCompositeAccessSchemaEditComponent,
            CoreCompositeAccessSchemaLabelComponent,
            CoreAccessSchemaSettingsComponent,
            CoreAccessSchemaSettingsDialogWindow] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCompositeAccessSchemaModule, providers: [
            CompositeAccessSchemaService
        ], imports: [CoreBaseModule,
            CoreMatModule,
            CoreControlModule,
            CoreDialogModule,
            CoreDirectiveModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreCompositeAccessSchemaModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreCompositeAccessSchemaEditComponent,
                        CoreCompositeAccessSchemaLabelComponent,
                        CoreAccessSchemaSettingsComponent,
                        CoreAccessSchemaSettingsDialogWindow
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreControlModule,
                        CoreDialogModule,
                        CoreDirectiveModule
                    ],
                    providers: [
                        CompositeAccessSchemaService
                    ],
                    exports: [
                        CoreCompositeAccessSchemaEditComponent,
                        CoreCompositeAccessSchemaLabelComponent,
                        CoreAccessSchemaSettingsComponent,
                        CoreAccessSchemaSettingsDialogWindow
                    ]
                }]
        }] });

class CoreFieldFilterViewComponent extends CoreAbstractComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldFilterViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldFilterViewComponent, isStandalone: false, selector: "core-field-filter-view", inputs: { value: "value" }, usesInheritance: true, ngImport: i0, template: "<div class=\"sln-filters-view\">\n  <div class=\"sln-filters-view__criterion\">\n    <span> \u041A\u0440\u0438\u0442\u0435\u0440\u0438\u0439: <span class=\"sln-filters-view__criterion-value\">{{ value.fieldName?.text }}</span></span>\n    <span class=\"sln-filters-view__criterion-code\">\u041A\u043E\u0434: {{ value.fieldName?.id }}</span>\n  </div>\n  @if (value.condition) {\n    <div class=\"sln-filters-view__condition\">\n      <span>\u0417\u043D\u0430\u043A: <span class=\"sln-filters-view__condition-value\">{{ value.condition?.text }}</span></span>\n      <span class=\"sln-filters-view__condition-code\">\u041A\u043E\u0434: {{ value.condition?.id }}</span>\n    </div>\n  }\n  <div class=\"sln-filters-view__value\">\n    <span>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435: <span class=\"sln-filters-view__value-value\">{{ value.value }}</span></span>\n  </div>\n  @if (value.module?.length > 0) {\n    <div class=\"sln-filters-view__module\">\n      <span>\u041C\u043E\u0434\u0443\u043B\u044C: <span class=\"sln-filters-view__module-value\">{{ value.module }}</span></span>\n    </div>\n  }\n</div>", styles: [".sln-filters-view{margin-top:10px}.sln-filters-view__criterion span,.sln-filters-view__condition span,.sln-filters-view__value span,.sln-filters-view__module span{display:flex;align-items:center;gap:3px;color:var(--DARK-GREY);font-size:15px}.sln-filters-view__criterion-value,.sln-filters-view__condition-value,.sln-filters-view__value-value,.sln-filters-view__module-value{font-family:var(--font-medium)}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldFilterViewComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-filter-view', standalone: false, template: "<div class=\"sln-filters-view\">\n  <div class=\"sln-filters-view__criterion\">\n    <span> \u041A\u0440\u0438\u0442\u0435\u0440\u0438\u0439: <span class=\"sln-filters-view__criterion-value\">{{ value.fieldName?.text }}</span></span>\n    <span class=\"sln-filters-view__criterion-code\">\u041A\u043E\u0434: {{ value.fieldName?.id }}</span>\n  </div>\n  @if (value.condition) {\n    <div class=\"sln-filters-view__condition\">\n      <span>\u0417\u043D\u0430\u043A: <span class=\"sln-filters-view__condition-value\">{{ value.condition?.text }}</span></span>\n      <span class=\"sln-filters-view__condition-code\">\u041A\u043E\u0434: {{ value.condition?.id }}</span>\n    </div>\n  }\n  <div class=\"sln-filters-view__value\">\n    <span>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435: <span class=\"sln-filters-view__value-value\">{{ value.value }}</span></span>\n  </div>\n  @if (value.module?.length > 0) {\n    <div class=\"sln-filters-view__module\">\n      <span>\u041C\u043E\u0434\u0443\u043B\u044C: <span class=\"sln-filters-view__module-value\">{{ value.module }}</span></span>\n    </div>\n  }\n</div>", styles: [".sln-filters-view{margin-top:10px}.sln-filters-view__criterion span,.sln-filters-view__condition span,.sln-filters-view__value span,.sln-filters-view__module span{display:flex;align-items:center;gap:3px;color:var(--DARK-GREY);font-size:15px}.sln-filters-view__criterion-value,.sln-filters-view__condition-value,.sln-filters-view__value-value,.sln-filters-view__module-value{font-family:var(--font-medium)}\n"] }]
        }], propDecorators: { value: [{
                type: Input
            }] } });

class FieldFilter {
    constructor() {
        this.condition = { id: 'EqualTo', text: 'Равно' };
    }
}

class CoreFieldFilterEditComponent extends CoreAbstractAccessorComponent {
    constructor() {
        super();
        this.suffix = '';
        this.showAddition = false;
    }
    ngOnInit() {
        if (Utility.isEmpty(this.value)) {
            this.value = new FieldFilter();
        }
    }
    writeLogic(model) { }
    disabledLogic(isDisabled) { }
    formatValue(model) {
        if (model === null || model === undefined) {
            return new FieldFilter();
        }
        if (typeof model === 'string' && model.startsWith('{') && model.endsWith('}')) {
            model = JSON.parse(model);
        }
        return model;
    }
    onChangeAddtionView($event) {
        this.showAddition = !this.showAddition;
    }
    onInternalValueChange($event) {
        this.valueChange.emit(this.value);
    }
    // implements Validator
    validate(control) {
        if (this.settings?.isRequired) {
            if (control.value === null || control.value === undefined) {
                return { 'required': true };
            }
            const val = control.value;
            let result = Utility.isEmpty(val.fieldName);
            if (!result) {
                return { 'required': true };
            }
            result = Utility.isEmpty(val.value);
            if (!result) {
                return { 'required': true };
            }
        }
        return null;
    }
    // implements Validator
    registerOnValidatorChange(fn) {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldFilterEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreFieldFilterEditComponent, isStandalone: false, selector: "core-field-filter-edit", inputs: { processId: "processId", systemObjectId: "systemObjectId", display: "display", sizeClass: "sizeClass", suffix: "suffix" }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => CoreFieldFilterEditComponent),
                multi: true
            },
            {
                provide: NG_VALIDATORS,
                useExisting: CoreFieldFilterEditComponent,
                multi: true
            }
        ], usesInheritance: true, ngImport: i0, template: "<div class=\"sln-field-filter sln-field-filter-{{ display }}\">\n  <div class=\"sln-filters-addition-value\">\n    <div class=\"sln-sln-filters-addition-fieldName\">\n      <core-field-combobox [(ngModel)]=\"value.fieldName\"  name=\"fieldName{{suffix}}\" fieldName=\"fieldName{{suffix}}\" placeholder=\"\u041F\u043E\u043B\u0435 \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439\"\n        [settings]=\"{ sourceCode:'BpmFields', hideEmpty: true, isRequired: true,  expressionD: [{key: 'systemObjectId', value: systemObjectId },{key: 'processId', value: processId },{ key: 'useComplex', value: true },{ key: 'useParent', value: value.useSearchInParent } ] }\"\n      (valueChange)=\"onInternalValueChange($event)\" class=\"sln-core-field-combobox {{sizeClass}}\"></core-field-combobox>\n    </div>\n    <div class=\"sln-filters-addition-showAddition\">\n      <core-field-string [(ngModel)]=\"value.value\" name=\"value{{suffix}}\" fieldName=\"value{{suffix}}\" placeholder=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u044F\"\n      [settings]=\"{ maxLength: 255, isRequired: true, rightHintHide: true }\" (valueChange)=\"onInternalValueChange($event)\" style=\"width: 100%;\" class=\"{{sizeClass}}\"></core-field-string>\n      <button type=\"button\" class=\"btn-primary sln-field-filter-button {{sizeClass}}\" (click)=\"onChangeAddtionView($event)\">\n        {{ showAddition ? '>' : '<'}}\n      </button>\n    </div>\n  </div>\n\n  @if (showAddition) {\n    <div class=\"form-group sln-field-filter-right{{ '-' + display }}\">\n      <core-field-combobox [(ngModel)]=\"value.condition\"  name=\"condition{{suffix}}\" fieldName=\"condition{{suffix}}\" placeholder=\"\u041A\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438\"\n        [settings]=\"{ sourceCode:'Local_Conditions', selectFirst: true, hideEmpty: true, hideSearch: true }\"\n      (valueChange)=\"onInternalValueChange($event)\" class=\"sln-core-field-combobox {{sizeClass}}\"></core-field-combobox>\n      <core-field-string [(ngModel)]=\"value.module\" name=\"module{{suffix}}\" fieldName=\"module{{suffix}}\" placeholder=\"\u041C\u043E\u0434\u0443\u043B\u044C\"\n      [settings]=\"{ maxLength: 100, rightHintHide: true }\" (valueChange)=\"onInternalValueChange($event)\" class=\"{{sizeClass}}\"></core-field-string>\n    </div>\n  }\n</div>", styles: [".sln-field-filter-flex{display:flex;gap:15px}.sln-field-filter-flex .sln-filters-addition-value{display:flex;align-items:center;width:100%;gap:15px;flex-wrap:wrap}.sln-margin-top{margin-top:5px}.sln-field-filter-col{display:auto}.sln-field-filter-button{padding:0;min-width:0px;height:100%;width:25px;display:flex;align-items:center;justify-content:center}.sln-field-filter-button.sln-input-s{min-height:0px;height:31px}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}.sln-filters-addition-showAddition{display:flex;align-items:center;gap:15px;flex:1}.sln-sln-filters-addition-fieldName{flex:1}.sln-field-filter-right{padding-right:5px}.sln-field-filter-right-flex{display:flex;gap:15px}.sln-field-filter-right-flex core-field-combobox{flex:1}\n"], dependencies: [{ kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldFilterEditComponent, decorators: [{
            type: Component,
            args: [{ selector: 'core-field-filter-edit', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => CoreFieldFilterEditComponent),
                            multi: true
                        },
                        {
                            provide: NG_VALIDATORS,
                            useExisting: CoreFieldFilterEditComponent,
                            multi: true
                        }
                    ], standalone: false, template: "<div class=\"sln-field-filter sln-field-filter-{{ display }}\">\n  <div class=\"sln-filters-addition-value\">\n    <div class=\"sln-sln-filters-addition-fieldName\">\n      <core-field-combobox [(ngModel)]=\"value.fieldName\"  name=\"fieldName{{suffix}}\" fieldName=\"fieldName{{suffix}}\" placeholder=\"\u041F\u043E\u043B\u0435 \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u0439\"\n        [settings]=\"{ sourceCode:'BpmFields', hideEmpty: true, isRequired: true,  expressionD: [{key: 'systemObjectId', value: systemObjectId },{key: 'processId', value: processId },{ key: 'useComplex', value: true },{ key: 'useParent', value: value.useSearchInParent } ] }\"\n      (valueChange)=\"onInternalValueChange($event)\" class=\"sln-core-field-combobox {{sizeClass}}\"></core-field-combobox>\n    </div>\n    <div class=\"sln-filters-addition-showAddition\">\n      <core-field-string [(ngModel)]=\"value.value\" name=\"value{{suffix}}\" fieldName=\"value{{suffix}}\" placeholder=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043A\u0440\u0438\u0442\u0435\u0440\u0438\u044F\"\n      [settings]=\"{ maxLength: 255, isRequired: true, rightHintHide: true }\" (valueChange)=\"onInternalValueChange($event)\" style=\"width: 100%;\" class=\"{{sizeClass}}\"></core-field-string>\n      <button type=\"button\" class=\"btn-primary sln-field-filter-button {{sizeClass}}\" (click)=\"onChangeAddtionView($event)\">\n        {{ showAddition ? '>' : '<'}}\n      </button>\n    </div>\n  </div>\n\n  @if (showAddition) {\n    <div class=\"form-group sln-field-filter-right{{ '-' + display }}\">\n      <core-field-combobox [(ngModel)]=\"value.condition\"  name=\"condition{{suffix}}\" fieldName=\"condition{{suffix}}\" placeholder=\"\u041A\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438\"\n        [settings]=\"{ sourceCode:'Local_Conditions', selectFirst: true, hideEmpty: true, hideSearch: true }\"\n      (valueChange)=\"onInternalValueChange($event)\" class=\"sln-core-field-combobox {{sizeClass}}\"></core-field-combobox>\n      <core-field-string [(ngModel)]=\"value.module\" name=\"module{{suffix}}\" fieldName=\"module{{suffix}}\" placeholder=\"\u041C\u043E\u0434\u0443\u043B\u044C\"\n      [settings]=\"{ maxLength: 100, rightHintHide: true }\" (valueChange)=\"onInternalValueChange($event)\" class=\"{{sizeClass}}\"></core-field-string>\n    </div>\n  }\n</div>", styles: [".sln-field-filter-flex{display:flex;gap:15px}.sln-field-filter-flex .sln-filters-addition-value{display:flex;align-items:center;width:100%;gap:15px;flex-wrap:wrap}.sln-margin-top{margin-top:5px}.sln-field-filter-col{display:auto}.sln-field-filter-button{padding:0;min-width:0px;height:100%;width:25px;display:flex;align-items:center;justify-content:center}.sln-field-filter-button.sln-input-s{min-height:0px;height:31px}.sln-padding-left{padding-left:0}.sln-padding-right{padding-right:0}.sln-filters-addition-showAddition{display:flex;align-items:center;gap:15px;flex:1}.sln-sln-filters-addition-fieldName{flex:1}.sln-field-filter-right{padding-right:5px}.sln-field-filter-right-flex{display:flex;gap:15px}.sln-field-filter-right-flex core-field-combobox{flex:1}\n"] }]
        }], ctorParameters: () => [], propDecorators: { processId: [{
                type: Input
            }], systemObjectId: [{
                type: Input
            }], display: [{
                type: Input
            }], sizeClass: [{
                type: Input
            }], suffix: [{
                type: Input
            }] } });

class CoreFieldFiltersModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldFiltersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldFiltersModule, declarations: [CoreFieldFilterEditComponent,
            CoreFieldFilterViewComponent], imports: [CoreBaseModule,
            CoreMatModule,
            CoreControlModule,
            CorePipeModule], exports: [CoreFieldFilterEditComponent,
            CoreFieldFilterViewComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldFiltersModule, imports: [CoreBaseModule,
            CoreMatModule,
            CoreControlModule,
            CorePipeModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreFieldFiltersModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        CoreFieldFilterEditComponent,
                        CoreFieldFilterViewComponent
                    ],
                    imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreControlModule,
                        CorePipeModule
                    ],
                    exports: [
                        CoreFieldFilterEditComponent,
                        CoreFieldFilterViewComponent
                    ]
                }]
        }] });

class ImportService {
    constructor(_startUp, _ajaxM) {
        this._startUp = _startUp;
        this._ajaxM = _ajaxM;
    }
    getFields(systemObjectId, api) {
        api = api ?? this.getApiName();
        const url = this._startUp.apiRoot('import/fields/' + systemObjectId, api);
        return this._ajaxM.get({ url: url });
    }
    import(model, api) {
        api = api ?? this.getApiName();
        const url = this._startUp.apiRoot('import', api);
        return this._ajaxM.post({ url, data: model });
    }
    getImportArea(fileId, worksheetNum) {
        const url = this._startUp.apiRoot('import/area/' + fileId + '/' + worksheetNum, 'core');
        return this._ajaxM.get({ url: url });
    }
    getColumns(model) {
        const url = this._startUp.apiRoot('import/columns', 'core');
        return this._ajaxM.post({ url, data: model });
    }
    getImportResult(model) {
        const url = this._startUp.apiRoot('import', 'core');
        return this._ajaxM.post({ url, data: model });
    }
    getApiName() {
        const module = this._startUp.getByKey('APP_MODULE_NAME');
        return module === 'main' ? 'core' : module;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ImportService, deps: [{ token: Startup }, { token: AjaxService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ImportService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ImportService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: Startup }, { type: AjaxService }] });

class ImportModel {
}
class ImportFile {
}
class ImportArea {
}

class CoreImportWindow extends CoreBaseDestroyComponent {
    get title() {
        if (this.step == 2) {
            return 'Настройка области импорта';
        }
        if (this.step == 3) {
            return 'Маппинг полей';
        }
        return 'Выбор файла для загрузки';
    }
    constructor(_service, _popUp, injector, _dialogRef, data, _startUp, _userSettingsService) {
        super();
        this._service = _service;
        this._popUp = _popUp;
        this._dialogRef = _dialogRef;
        this.data = data;
        this._startUp = _startUp;
        this._userSettingsService = _userSettingsService;
        this.step = 1;
        this.model = new ImportModel();
        const cookieService = injector.get(BrowserLocalStorage);
        this.session = cookieService.getTyped('user_session');
    }
    ngOnInit() {
        this.uploadedFileConfig = new UploaderConfig(FileTypeEnum.None, this._startUp.apiRoot('import/upload', 'core'));
        this.uploadedFileConfig.typeName = 'Файл импорта';
        this.uploadedFileConfig.accept = '.xlsx';
        this.uploadedFileConfig.isRequired = true;
        this.uploadedFileConfig.callback = (e, ctrl) => {
            this.importFile = e;
            this.model.importArea = e.defaultArea;
            this.defaultFields = e.defaultFields;
            this.columns = of({ isSuccess: true, message: '', entity: e.defaultFields });
            this.worksheets = of({ isSuccess: true, message: '', entity: e.worksheets });
            this.isInitialLoading = true;
            this.step++;
            this.settingKey = this.getSettingKey(e.defaultFields);
        };
        this.model.systemObjectId = this.data?.systemObjectId;
        this.htmlBaner = this.data?.html;
        this.loadFields();
    }
    next() {
        if (this.step === 2) {
            this._service.getColumns(this.model.importArea)
                .subscribe((response) => {
                this._popUp.HandleIEntityResponse({
                    response: response,
                    successCallback: (entity) => {
                        this.columns = of({ isSuccess: true, message: '', entity: entity });
                        this.step++;
                        this.settingKey = this.getSettingKey(entity);
                        this._userSettingsService.getUserSettings(this.session.userId, null, this.settingKey)
                            .subscribe((response) => {
                            if (response.isSuccess && response.entity) {
                                this.settingValue = JSON.parse(response.entity.value);
                                Object.keys(this.settingValue).forEach(key => {
                                    const field = this.model.fields.find(x => x.name === key);
                                    if (field)
                                        field.mapping = this.settingValue[key];
                                });
                            }
                        });
                    }
                });
            });
        }
    }
    import() {
        const mapping = Object.assign({});
        this.model.fields.forEach(x => mapping[x.name] = x.mapping);
        this._userSettingsService.setUserSettings({ userId: this.session.userId, organizationId: this.session.organizations.currentLink.organizationId, key: this.settingKey, value: mapping })
            .subscribe();
        if (this.data.importCallback) {
            this._service.getImportResult(this.model)
                .subscribe((response) => {
                this._popUp.HandleIEntityResponse({
                    response: response,
                    successCallback: () => {
                        this.data.importCallback(response.entity);
                        this._dialogRef.close(true);
                    }
                });
            });
            return;
        }
        this._service.import(this.model, this.data.api)
            .subscribe((response) => {
            this._popUp.HandleIResponse({
                response: response,
                successCallback: () => {
                    this._dialogRef.close(true);
                }
            });
        });
    }
    getMapping(field) {
        if (!field.dictionaryValues) {
            return this.columns;
        }
        let values = field.dictionaryValues.map(x => {
            return { id: -x.id, text: x.text, description: 'Фикс. значение.' };
        }).concat(this.defaultFields);
        return of({ isSuccess: true, message: '', entity: values });
    }
    onEntityChange(e) {
        if (!e)
            return;
        this.model.systemObjectId = e.id;
        this.loadFields();
    }
    onWorksheetChange(e) {
        if (this.isInitialLoading) {
            this.isInitialLoading = false;
            return;
        }
        this.model.importArea.headerRange = null;
        this.model.importArea.dataRange = null;
        this._service.getImportArea(this.importFile.fileId, e.id)
            .subscribe((response) => {
            this._popUp.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this.model.importArea = entity;
                }
            });
        });
    }
    loadFields() {
        if (!this.model.systemObjectId)
            return;
        this._service.getFields(this.model.systemObjectId, this.data.api)
            .subscribe((response) => {
            this._popUp.HandleIEntityResponse({
                response: response,
                successCallback: (entity) => {
                    this.model.fields = entity;
                }
            });
        });
    }
    getSettingKey(columns) {
        return columns.map(x => x.text).join().replace('/', '').replace('?', '').substring(0, 200);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreImportWindow, deps: [{ token: ImportService }, { token: PopupResults }, { token: i0.Injector }, { token: i1$8.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: Startup }, { token: CoreUserSettingsService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: CoreImportWindow, isStandalone: true, selector: "ng-component", providers: [
            ImportService,
            CoreUserSettingsService
        ], usesInheritance: true, ngImport: i0, template: "<form #importForm=\"ngForm\" novalidate >\n  <core-dialog dialogTitle=\"{{ title }}\" hasCansel=\"false\" width=\"800\">\n    <div body>\n      @if (step === 1) {\n        <core-file-uploader [config]=\"uploadedFileConfig\" name=\"uploadedFile\"></core-file-uploader>\n        <div [innerHtml]=\"htmlBaner\"></div>\n      }\n      @if (step === 2) {\n        <div class=\"col-md-12\">\n          <core-field-combobox [dataSource]=\"worksheets\" name=\"worksheet\" fieldName=\"worksheet\"\n            placeholder=\"\u041B\u0438\u0441\u0442, \u0441 \u043A\u043E\u0442\u043E\u0440\u043E\u0433\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435\"\n            [settings]=\"{ sourceCode:'DataSource', isRequired: true, hideEmpty: true, selectFirst: true }\"\n            (valueChange)=\"onWorksheetChange($event)\" class=\"sln-core-field-combobox\">\n          </core-field-combobox>\n        </div>\n        <div class=\"col-md-6\">\n          <core-field-string [(ngModel)]=\"model.importArea.headerRange\" name=\"headerRange\" fieldName=\"headerRange\"\n            placeholder=\"\u0414\u0438\u0430\u043F\u0430\u0437\u043E\u043D \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u043E\u0432\"\n            [settings]=\"{ isRequired: true, rightHintHide: true}\">\n          </core-field-string>\n        </div>\n        <div class=\"col-md-6\">\n          <core-field-string [(ngModel)]=\"model.importArea.dataRange\" name=\"dataRange\" fieldName=\"dataRange\"\n            placeholder=\"\u0414\u0438\u0430\u043F\u0430\u0437\u043E\u043D \u0434\u0430\u043D\u043D\u044B\u0445\"\n            [settings]=\"{ isRequired: true, rightHintHide: true}\">\n          </core-field-string>\n        </div>\n      }\n      @if (step === 3) {\n        <ng-scrollbar style=\"height:60vh;\">\n          <div>\n            @for (field of model.fields; track field; let i = $index) {\n              <div class=\"col-md-6\">\n                <core-field-combobox [(ngModel)]=\"field.mapping\" [dataSource]=\"getMapping(field)\" name=\"column{{i}}\" fieldName=\"column{{i}}\"\n                  [placeholder]=\"field.caption\"\n                  [settings]=\"{ sourceCode:'DataSource', isRequired: field.isRequired }\"\n                  class=\"sln-core-field-combobox\">\n                </core-field-combobox>\n              </div>\n            }\n          </div>\n        </ng-scrollbar>\n      }\n    </div>\n    <div footer>\n      @if (step === 2) {\n        <button class=\"btn-primary\" (click)=\"next()\" [disabled]=\"importForm.invalid\">\u0414\u0430\u043B\u0435\u0435</button>\n      }\n      @if (step === 3) {\n        <button class=\"btn-primary\" (click)=\"import()\" [disabled]=\"importForm.invalid\">\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C</button>\n      }\n    </div>\n  </core-dialog>\n</form>\n", styles: [".top-row{margin-bottom:10px}.entity-combobox{margin-top:5px}\n"], dependencies: [{ kind: "ngmodule", type: CoreBaseModule }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3$4.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "ngmodule", type: CoreMatModule }, { kind: "ngmodule", type: CoreDirectiveModule }, { kind: "ngmodule", type: CoreControlModule }, { kind: "component", type: CoreFieldTypeComboboxComponent, selector: "core-field-combobox", inputs: ["multiple", "master", "dataSource", "excludedValues"] }, { kind: "component", type: CoreFieldTypeStringComponent, selector: "core-field-string" }, { kind: "ngmodule", type: CoreDialogModule }, { kind: "component", type: CoreDialogWindow, selector: "core-dialog", inputs: ["dialogTitle", "hasCansel", "canselText", "hasFooter", "fullScreen", "width", "minWidth", "hasTitle", "leftMenu", "resizeble", "showTicketsVersions", "showCloseConfirmDialog", "beforeClosed", "cdkDragDisabled"] }, { kind: "ngmodule", type: CoreUploaderModule }, { kind: "component", type: CoreFileUploaderComponent, selector: "core-file-uploader", inputs: ["config", "needUpload", "elementId", "anonymAccessItemId"], outputs: ["valueChange", "autogenerateClick", "filesLoaded"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreImportWindow, decorators: [{
            type: Component,
            args: [{ imports: [
                        CoreBaseModule,
                        CoreMatModule,
                        CoreDirectiveModule,
                        CoreControlModule,
                        CoreDialogModule,
                        CoreUploaderModule
                    ], providers: [
                        ImportService,
                        CoreUserSettingsService
                    ], template: "<form #importForm=\"ngForm\" novalidate >\n  <core-dialog dialogTitle=\"{{ title }}\" hasCansel=\"false\" width=\"800\">\n    <div body>\n      @if (step === 1) {\n        <core-file-uploader [config]=\"uploadedFileConfig\" name=\"uploadedFile\"></core-file-uploader>\n        <div [innerHtml]=\"htmlBaner\"></div>\n      }\n      @if (step === 2) {\n        <div class=\"col-md-12\">\n          <core-field-combobox [dataSource]=\"worksheets\" name=\"worksheet\" fieldName=\"worksheet\"\n            placeholder=\"\u041B\u0438\u0441\u0442, \u0441 \u043A\u043E\u0442\u043E\u0440\u043E\u0433\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435\"\n            [settings]=\"{ sourceCode:'DataSource', isRequired: true, hideEmpty: true, selectFirst: true }\"\n            (valueChange)=\"onWorksheetChange($event)\" class=\"sln-core-field-combobox\">\n          </core-field-combobox>\n        </div>\n        <div class=\"col-md-6\">\n          <core-field-string [(ngModel)]=\"model.importArea.headerRange\" name=\"headerRange\" fieldName=\"headerRange\"\n            placeholder=\"\u0414\u0438\u0430\u043F\u0430\u0437\u043E\u043D \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u043E\u0432\"\n            [settings]=\"{ isRequired: true, rightHintHide: true}\">\n          </core-field-string>\n        </div>\n        <div class=\"col-md-6\">\n          <core-field-string [(ngModel)]=\"model.importArea.dataRange\" name=\"dataRange\" fieldName=\"dataRange\"\n            placeholder=\"\u0414\u0438\u0430\u043F\u0430\u0437\u043E\u043D \u0434\u0430\u043D\u043D\u044B\u0445\"\n            [settings]=\"{ isRequired: true, rightHintHide: true}\">\n          </core-field-string>\n        </div>\n      }\n      @if (step === 3) {\n        <ng-scrollbar style=\"height:60vh;\">\n          <div>\n            @for (field of model.fields; track field; let i = $index) {\n              <div class=\"col-md-6\">\n                <core-field-combobox [(ngModel)]=\"field.mapping\" [dataSource]=\"getMapping(field)\" name=\"column{{i}}\" fieldName=\"column{{i}}\"\n                  [placeholder]=\"field.caption\"\n                  [settings]=\"{ sourceCode:'DataSource', isRequired: field.isRequired }\"\n                  class=\"sln-core-field-combobox\">\n                </core-field-combobox>\n              </div>\n            }\n          </div>\n        </ng-scrollbar>\n      }\n    </div>\n    <div footer>\n      @if (step === 2) {\n        <button class=\"btn-primary\" (click)=\"next()\" [disabled]=\"importForm.invalid\">\u0414\u0430\u043B\u0435\u0435</button>\n      }\n      @if (step === 3) {\n        <button class=\"btn-primary\" (click)=\"import()\" [disabled]=\"importForm.invalid\">\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C</button>\n      }\n    </div>\n  </core-dialog>\n</form>\n", styles: [".top-row{margin-bottom:10px}.entity-combobox{margin-top:5px}\n"] }]
        }], ctorParameters: () => [{ type: ImportService }, { type: PopupResults }, { type: i0.Injector }, { type: i1$8.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: Startup }, { type: CoreUserSettingsService }] });

class ImportedField {
}

class CoreModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: CoreModule, imports: [CoreLayoutModule,
            CoreMatModule,
            CoreControlModule,
            CoreDialogModule,
            CoreContactVerificationModule,
            CryptoModule], exports: [CoreLayoutModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreModule, providers: [
            MenuService,
            CryptoSignService,
            PopupResults,
            CoreComboboxService,
            DadataIntegrationService,
            DataExportService,
            MfaProviderService,
            RequisiteService
        ], imports: [CoreLayoutModule,
            CoreMatModule,
            CoreControlModule,
            CoreDialogModule,
            CoreContactVerificationModule,
            CryptoModule, CoreLayoutModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: CoreModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CoreLayoutModule,
                        CoreMatModule,
                        CoreControlModule,
                        CoreDialogModule,
                        CoreContactVerificationModule,
                        CryptoModule
                    ],
                    providers: [
                        MenuService,
                        CryptoSignService,
                        PopupResults,
                        CoreComboboxService,
                        DadataIntegrationService,
                        DataExportService,
                        MfaProviderService,
                        RequisiteService
                    ],
                    exports: [
                        CoreLayoutModule
                    ],
                }]
        }] });

/*
 * Public API Surface of sellan-core
 */

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

export { ALL_HOURS, ALL_MINUTES, ALTERNATIVE_FILTER_CONDITIONS, APP_DATE_FORMATS, AbstractStorage, AccessGuard, AccessLvl, AccessManager, Address, AgentService, AjaxService, Align, ArrayExtension, AttorneyRunService, AuthBlockedUserInstructionDialogWindow, AuthorityEnum, AuthorizationService, AvatarEntity, BooleanExtension, BooleanMode, BooleanPipe, BrokerVisualSetting, BrokeredEvent, BrowserCookieStorage, BrowserLocalStorage, BrowserSessionStorage, ButtonLoadingService, CORE_DRAWER_DATA_TOKEN_KEY, CORE_NOTIFICATION_DATA_TOKEN, CardButton, CardEditButtonsComponent, CardFrame, CardPanel, CardPanelComponent, Certificate, CertificateListComponent, CertificateListWindow, Chat, ClientSideDataSource, CollapseDirective, CommonVisualSetting, CompositeAccessSchemaService, ContextService, ConversionDatePipe, CookieStorage, CopyClipboardDirective, CoreAbstractAccessorComponent, CoreAbstractComponent, CoreAbstractDictionaryCommonComponent, CoreAbstractVerificationComponent, CoreAccessSchemaSettingsComponent, CoreAccessSchemaSettingsDialogWindow, CoreAddressCardComponent, CoreAddressDialogWindow, CoreAddressModule, CoreAttorneyDownloadWindow, CoreAttorneyModule, CoreAttorneyUploadWindow, CoreAuthModule, CoreAvatarCropperDialogWindow, CoreAvatarService, CoreBaseDestroyComponent, CoreBaseModule, CoreBasePage, CoreChatAvatarComponent, CoreChatDialodReadingMessageTooltipComponent, CoreChatDialogDrawerComponent, CoreChatDialogMenuComponent, CoreChatForwardDrawerComponent, CoreChatListDrawerComponent, CoreChatListMenuComponent, CoreChatMessageMenuComponent, CoreChatNewDrawerComponent, CoreChatNewGroupDrawerComponent, CoreChatProfileDrawerComponent, CoreChatRoomComponent, CoreChatService, CoreChatUserComponent, CoreChatWidgetBalloonsComponent, CoreClientGrid, CoreComboboxService, CoreCompositeAccessSchemaEditComponent, CoreCompositeAccessSchemaLabelComponent, CoreCompositeAccessSchemaModule, CoreConfirmDialogWindow, CoreContactVerificationModule, CoreControlModule, CoreCropperJsModule, CoreCropperModule, CoreCropperService, CoreCryptoModule, CoreDaDataModule, CoreDadataFmsCodeComponent, CoreDadataSearchComponent, CoreDawerBaseOverlayConfig, CoreDialog, CoreDialogModule, CoreDialogWindow, CoreDictionaryCommonComponent, CoreDictionaryFileTypeComponent, CoreDictionaryModule, CoreDictionaryStatusComponent, CoreDirectiveModule, CoreDrawerComponent, CoreDrawerModule, CoreEditInlineDictionaryComponent, CoreErrorPage, CoreFieldAddressComponent, CoreFieldColorComponent, CoreFieldEmailComponent, CoreFieldFilterEditComponent, CoreFieldFilterViewComponent, CoreFieldFiltersModule, CoreFieldIdentificationDocComponent, CoreFieldInnComponent, CoreFieldIpComponent, CoreFieldKppComponent, CoreFieldLicenseComponent, CoreFieldOgrnComponent, CoreFieldOrganizationComponent, CoreFieldPasswordComponent, CoreFieldPhoneComponent, CoreFieldRequisiteComponent, CoreFieldSnilsComponent, CoreFieldTelegramComponent, CoreFieldTypeBoolComponent, CoreFieldTypeComboboxComponent, CoreFieldTypeDateTimeComponent, CoreFieldTypeMultipleComboboxComponent, CoreFieldTypeNumberComponent, CoreFieldTypeStringComponent, CoreFieldTypeTextareaComponent, CoreFieldTypeTimeComponent, CoreFileAttributesModule, CoreFileAttributesWindow, CoreFilePreviewDialogWindow, CoreFileSignaturesComponent, CoreFileSignaturesModule, CoreFileSignaturesWindow, CoreFileUploaderComponent, CoreFilterOrganizationComponent, CoreFilterOrganizationInternalComponent, CoreForbiddenPage, CoreGirdDynamicPipe, CoreGrid, CoreGridAlignButtonsComponent, CoreGridColumnTemplateComponent, CoreGridConfigUserColumnDialogWindow, CoreGridDialogFilterComponent, CoreGridExportModeDialogWindow, CoreGridFilterBaseComponent, CoreGridFilterTemplateComponent, CoreGridFiltersComponent, CoreGridModule, CoreGridUtility, CoreIdentificationDocCardComponent, CoreIdentificationDocumentDialogWindow, CoreIdentificationDocumentModule, CoreImportWindow, CoreInfoDialogWindow, CoreLabelComponent, CoreLayoutModule, CoreLicenseCardComponent, CoreLicenseDialogWindow, CoreLicenseModule, CoreMatModule, CoreMiniDraftDialogWindow, CoreModule, CoreNotFoundPage, CoreNotification, CoreNotificationBaseOverlayConfig, CoreNotificationModule, CoreNotificationQueueService, CoreNotificationService, CoreNotificationUIConfig, CoreOrganizationDialogWindow, CoreOrganizationInfoComponent, CoreOrganizationModule, CoreOrganizationSearchComponent, CorePage, CorePageContentComponent, CorePageTitleComponent, CorePipeModule, CoreRequisiteCardComponent, CoreRequisiteDialogWindow, CoreRequisiteModule, CoreRouteDescription, CoreSelectSearchComponent, CoreServerGridComponent, CoreSimplePage, CoreStepperComponent, CoreStepperModule, CoreTitlePage, CoreTooltipContainerComponent, CoreTooltipDirective, CoreTooltipModule, CoreUploaderModule, CoreUrlSerializer, CoreUserIconComponent, CoreUserSettingsService, CoreVerificationDialogWindow, CropService, CropperPositionService, CropperSettings, CrudService, CryptoSignService, CryptoSignature, DATE_DATA_TYPE, DATE_RANGE_CONDITIONS, DEFAULT_COUNTER_ID, DEFAULT_COUNTER_ID_AOT, DadataConfigDefault, DadataIntegrationService, DadataType, DataExportService, DataGridComponentTemplate, DateAndTimePipe, DateCompareOption, DateExtension, DateMaskDirective, Deepmerge, DefaultComboboxUriDescriptionService, DefaultQueueService, DeleteStatus, DiagInfo, DiagService, DialogConfirmReason, DialogReason, DictionaryItem, DigitMaxDirective, DigitMinDirective, Division, Document$1 as Document, DocumentTypeEnum, DragUploudDirective, DrawerConfig, DrawerNames, DrawerService, DynamicThemeService, EditDictionaryItem, EqualValidatorDirective, EventBrokerService, EventListener, Exception, ExportMode, ExportedData, ExternalRedirectComponent, FederationEntity, FederationLoader, FieldFilter, FieldSetting, FieldTypeEnum, FileDataForSign, FileTypeEnum, FileTypeItem, FileViewerDialogWindow, FilesLabel, FilterCmbxPipe, GridArrayDataService, GridColumn, GridConfiguration, GridConfigutarionService, GridDataEvent, Guid, HotkeyDirective, IAddressDialogOptions, IChatConfig, IIdentificationDocumentDialogOptions, ILicenseDialogOptions, IOrgnizationDialogOptions, IRequisiteDialogOptions, IdentificationDocument, ImageCropperComponent, ImportArea, ImportFile, ImportModel, ImportService, ImportedField, InfoDiologConfig, InfoOrganization, InfoType, InfoUser, InlineDictionaryAction, InnDirective, InvalidFormService, KONTUR_AUTH_SUCCESS_MESSAGE_TYPE, KonturAuthService, License, LoadImageService, LocalStorage, LogService, LoginModel, LongTastService, MAT_DATE_TIME_LOCALE_FACTORY, MAT_DEFAULT_ACITONS, MAT_TIMEPICKER_DEFAULT_OPTIONS, MAT_TIMEPICKER_SCROLL_STRATEGY, MAT_TIMEPICKER_SCROLL_STRATEGY_FACTORY, MAT_TIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MAT_TIMEPICKER_VALIDATORS, MAT_TIMEPICKER_VALUE_ACCESSOR, MAT_TIME_LOCALE, MAT_TIME_LOCALE_PROVIDER, MaskPipe, MatClockDials, MatContextMenuTrigger, MatHourInput, MatHoursClockDial, MatMinuteInput, MatMinutesClockDial, MatNativeDateTimeModule, MatTimeInputs, MatTimePeriod, MatTimepicker, MatTimepickerActions, MatTimepickerApply, MatTimepickerBase, MatTimepickerCancel, MatTimepickerContent, MatTimepickerContentLayout, MatTimepickerDefaultActions, MatTimepickerInput, MatTimepickerInputBase, MatTimepickerInputEvent, MatTimepickerIntl, MatTimepickerModule, MatTimepickerToggle, MatTimepickerToggleIcon, MenuItem, MenuService, MenuSetting, Message, MessageHistory, MessageStatus, MethodOptions, Metrika, MetrikaModule, MfaDialogWindow, MfaProviderService, MiddleEllipsisPipe, MiniDraftModeEnum, MiniDraftService, MoneyPipe, NationalityEnum, NativeDateTimeAdapter, NativeDateTimeModule, NewMsgMode, NotificationDetailService, NotificationInfoType, NumberExtension, OAuthModel, ObjectExtension, OrganizationBaseService, OrganizationItem, OrganizationItemExtension, OrganizationItemTypes, OrganizationSearchResult, PageService, PaginatorSource, Pair, ParticipationDisplayMode, ParticipationEnum, PasswordValidatorDirective, PercentTransformPipe, PersonVerification, PhoneNumberFormatter, PhoneRuPipe, PhoneVerificationServiceWorkingMode, PlatformVisualSetting, PopupResults, PrettyPrintJsonStringPipe, ProportionPercentPipe, ProvideParentFormDirective, RegistrationData, RegistrationDocumentService, RegistrationMethod, RegistrationService, RegistrationType, RequestVisualSettings, RequiredFileValidatorDirective, RequisiteService, Requisites, RequisitsMode, RolesEnum, RouteAccessParam, RuDateAdapter, RuDatePipe, RuDateTimePipe, SLN_CORE_COMBOBOX_SOURCE, SLN_INVALID_FORM_TAB_ACTIVATE_EVENT, SafePipe, SelectedChatUserFilterPipe, SellanChatCommonModule, SellanChatHighlighterPipe, SellanChatInputComponent, SellanChatMessageService, SellanChatMsgManagerService, SellanChatSearchMessageComponent, SellanChatSendMessageMenuComponent, SellanChatUsersService, SellanCoreChatModule, ServerSideDataSource, SessionStorage, SignalBaseService, SignalMainModel, SignalRService, SlnBaseAuthRecoveryComponent, SlnBaseAuthRecoveryDoneComponent, SlnBaseAuthSigninComponent, SnilsDirective, Startup, StatusItem, StatusMetadata, StepperAdditionalPipe, StepperEnabledPipe, StorageCheck, StorageDataGridFilter, StringExtension, SupportDialogWindow, SystemObjectSelectedType, TPair, TimeAdapter, TopicRequest, TopicSubject, TwoFactorService, UnauthorizedInterceptor, UploadedFile, UploadedFileAttribute, UploaderConfig, UploaderConst, UserAdditionalSettingsDto, UserMenuSettings, UserMenuSettingsItem, UserSessionData, UserVerificationMode, Utility, VerificationChannel, VerificationDirective, VerificationFlow, VerificationService, ViewMode, VirtualAccount, VisualSettingManager, VisualSettings, YANDEX_COUNTERS_CONFIGS, YANDEX_COUNTERS_CONFIGS_AOT, YandexCounterConfig, ZeroLeftPadPipe, _isDateRangeFilter, appInitializerFactory, countersFactory, createConfigs, createCounter, createDaDataFmsValidator, createDaDataValidator, dateReviver, defaultCounterIdFactory, defaultMergeReducer, defineDefaultId, getCounterNameById, insertMetrika, localStorageSync, makeAttorneyLink, provideNativeDateTimeAdapter, provideParentForm, rehydrateApplicationState, scrollFactory, syncStateUpdate, timeInputsHaveChanged, СoreNotificationComponent };
//# sourceMappingURL=sellan-core.mjs.map
