UNPKG

barsa-novin-ray-core

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.6.

19,904 lines 884 kB
import * as i0 from '@angular/core';
import { Injectable, inject, ElementRef, Input, ChangeDetectionStrategy, Component, Pipe, ComponentFactoryResolver, Injector, ApplicationRef, Compiler, DOCUMENT, NgModuleFactory, InjectionToken, NgZone, signal, ViewContainerRef, isDevMode, EventEmitter, ChangeDetectorRef, Renderer2, HostBinding, Output, HostListener, ViewChild, Directive, TemplateRef, input, NgModule, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA, provideAppInitializer, ErrorHandler } from '@angular/core';
import { Subject, from, BehaviorSubject, of, exhaustMap, map as map$1, timer, combineLatest, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, switchMap, forkJoin, shareReplay, withLatestFrom as withLatestFrom$1, fromEvent, throwError, merge, interval, filter as filter$1, lastValueFrom, timeout, catchError as catchError$1, takeUntil as takeUntil$1, take, skip, Observable, tap as tap$1, mergeWith, Subscription } from 'rxjs';
import * as i1 from '@angular/router';
import { Router, NavigationEnd, ActivatedRoute, RouterEvent, NavigationStart, RouterModule, RouteReuseStrategy } from '@angular/router';
import { DomSanitizer, Title } from '@angular/platform-browser';
import { filter, startWith, map, tap, takeUntil, exhaustMap as exhaustMap$1, withLatestFrom, delay, debounceTime, distinctUntilChanged, concatMap, finalize, publishReplay, refCount, shareReplay as shareReplay$1, switchMap as switchMap$1, catchError, merge as merge$1, pluck, mergeWith as mergeWith$1 } from 'rxjs/operators';
import moment from 'moment';
import moment$1 from 'moment-hijri';
import 'moment/locale/ar';
import moment$2 from 'moment-jalaali';
import 'moment/locale/fa';
import { _isNumberValue } from '@angular/cdk/coercion';
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClient, HttpEventType, HttpErrorResponse, HttpHeaders, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import * as i1$1 from '@angular/common';
import { Location, TitleCasePipe, CommonModule } from '@angular/common';
import RecordRTC from 'recordrtc';
import { SwUpdate, SwPush } from '@angular/service-worker';
import { openDB } from 'idb';
import Splide from '@splidejs/splide';

class BarsaApi {
    static { this.idGenerator = -10000; }
    static get GanttChartHelper() {
        return GanttChartHelper;
    }
    static get Offline() {
        return Offline;
    }
    static get Ext() {
        return Ext;
    }
    static get Common() {
        return Common;
    }
    static get Util() {
        return Util;
    }
    static get Ul() {
        return Ul;
    }
    static get Ui() {
        return Ui;
    }
    static get Bw() {
        return Bw;
    }
    static get BBB() {
        return BBB;
    }
    static get LoginForm() {
        return LoginForm;
    }
    static get LoginAction() {
        return LoginAction;
    }
    static get LoginFormUi() {
        return LoginFormUi;
    }
    static get LoginFormData() {
        return LoginFormData;
    }
}

// angular
class LogService {
    static { this.DEBUG = {
        LEVEL_1: false, // .warn only
        LEVEL_2: false, // .error only
        LEVEL_3: false, // .log + all the above
        LEVEL_4: false, // .log + all the above + info
        LEVEL_5: false // just info (excluding all else)
    }; }
    // info (extra messages like analytics)
    // use LEVEL_5 to see only these
    info(...msg) {
        if (LogService.DEBUG.LEVEL_5 || LogService.DEBUG.LEVEL_4) {
            // extra messages
            /* eslint-disable */
            console.info(msg);
        }
    }
    // debug (standard output)
    debug(...msg) {
        if (LogService.DEBUG.LEVEL_4 || LogService.DEBUG.LEVEL_3) {
            // console.debug does not work on {N} apps... use `log`
            /* eslint-disable */
            console.debug(msg);
        }
    }
    // error
    error(...err) {
        if (LogService.DEBUG.LEVEL_4 || LogService.DEBUG.LEVEL_3 || LogService.DEBUG.LEVEL_2) {
            console.error(err);
        }
    }
    // warn
    warn(...warn) {
        if (LogService.DEBUG.LEVEL_4 || LogService.DEBUG.LEVEL_3 || LogService.DEBUG.LEVEL_1) {
            console.warn(warn);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LogService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LogService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }] });

class BaseComponent {
    constructor() {
        this._el = inject(ElementRef);
        this._log = inject(LogService);
        this._onDestroy$ = new Subject();
    }
    get el() {
        return this._el;
    }
    get onDestroy$() {
        return this._onDestroy$;
    }
    ngAfterContentInit() {
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log('ngAfterContentInit');
        console.log(this);
    }
    ngOnChanges(changes) {
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log(changes);
    }
    ngOnInit() {
        this.rendered = true;
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log('ngOnInit');
        console.log(this);
    }
    ngAfterViewInit() {
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log('ngAfterViewInit');
        console.log(this);
    }
    ngOnDestroy() {
        this._onDestroy$.next();
        this._onDestroy$.complete();
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log('ngOnDestroy');
        console.log(this);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseComponent, isStandalone: false, selector: "bnrc-base", inputs: { rendered: "rendered" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { rendered: [{
                type: Input
            }] } });

class EmptyPageWithRouterAndRouterOutletComponent extends BaseComponent {
    constructor() {
        super();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: EmptyPageWithRouterAndRouterOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: EmptyPageWithRouterAndRouterOutletComponent, isStandalone: false, selector: "bnrc-empty-page-with-router-and-router-outlet", usesInheritance: true, ngImport: i0, template: "<ng-container #containerRef></ng-container>\r\n<router-outlet></router-outlet>\r\n<router-outlet name=\"main\"></router-outlet>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: EmptyPageWithRouterAndRouterOutletComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-empty-page-with-router-and-router-outlet', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ng-container #containerRef></ng-container>\r\n<router-outlet></router-outlet>\r\n<router-outlet name=\"main\"></router-outlet>\r\n" }]
        }], ctorParameters: () => [] });

class GeneralControlInfoModel {
    constructor() {
        this.ShowLabel = true;
    }
}
class StringControlInfoModel extends GeneralControlInfoModel {
}
class RichStringControlInfoModel extends StringControlInfoModel {
}
class NumberControlInfoModel extends GeneralControlInfoModel {
}
class FilePictureInfoModel extends GeneralControlInfoModel {
}
class FileControlInfoModel extends GeneralControlInfoModel {
}
class CommandControlInfoModel extends GeneralControlInfoModel {
}
class IconControlInfoModel extends GeneralControlInfoModel {
}
class PictureFileControlInfoModel extends GeneralControlInfoModel {
}
class GaugeControlInfoModel extends GeneralControlInfoModel {
}
class RelationListControlInfoModel extends GeneralControlInfoModel {
}
class HistoryControlInfoModel extends RelationListControlInfoModel {
}
class RabetehAkseTakiListiControlInfoModel extends RelationListControlInfoModel {
}
class RelatedReportControlInfoModel extends GeneralControlInfoModel {
}
class CodeEditorControlInfoModel extends GeneralControlInfoModel {
}
class EnumControlInfoModel extends GeneralControlInfoModel {
}
class RowDataOption {
}
class DateTimeControlInfoModel extends GeneralControlInfoModel {
}
class BoolControlInfoModel extends GeneralControlInfoModel {
}
class CalculateControlInfoModel extends GeneralControlInfoModel {
}
class SubformControlInfoModel extends GeneralControlInfoModel {
}
class LinearListControlInfoModel extends GeneralControlInfoModel {
}
class ListRelationModel {
}
class SingleRelationControlInfoModel extends GeneralControlInfoModel {
}
class MetaobjectDataModel {
}
class MoForReportModelBase {
}
class MoForReportModel extends MoForReportModelBase {
    constructor() {
        super();
        this.DeletedList = this.AddedList = this.MoDataList = [];
    }
}
class ReportBaseInfo {
}
class FormToolbarButton {
}
class ReportExtraInfo extends ReportBaseInfo {
}
class MetaobjectRelationModel extends ListRelationModel {
}
var FieldInfoTypeEnum;
(function (FieldInfoTypeEnum) {
    FieldInfoTypeEnum[FieldInfoTypeEnum["IntInfo"] = 0] = "IntInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["StringInfo"] = 2] = "StringInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["DateInfo"] = 3] = "DateInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["BoolInfo"] = 5] = "BoolInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["EnumInfo"] = 6] = "EnumInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["UserInfo"] = 7] = "UserInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["CategoryInfo"] = 8] = "CategoryInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["MetaObjectInfo"] = 9] = "MetaObjectInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["CommandInfo"] = 10] = "CommandInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["PicturesInfo"] = 11] = "PicturesInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["RelationInfo"] = 12] = "RelationInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["HistoryInfo"] = 13] = "HistoryInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["RelationInfoReverse_AksListi"] = 14] = "RelationInfoReverse_AksListi";
    FieldInfoTypeEnum[FieldInfoTypeEnum["CreatorUserInfo"] = 15] = "CreatorUserInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["CreationDateInfo"] = 16] = "CreationDateInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["LastUpdateDateInfo"] = 17] = "LastUpdateDateInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["ReminderInfo"] = 18] = "ReminderInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["RichStringInfo"] = 19] = "RichStringInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["ConvertCommandInfo"] = 20] = "ConvertCommandInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["RelationInfoSingleReverse_AksTakiListi"] = 21] = "RelationInfoSingleReverse_AksTakiListi";
    FieldInfoTypeEnum[FieldInfoTypeEnum["DialCommandInfo"] = 22] = "DialCommandInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["FindContactCommandInfo"] = 23] = "FindContactCommandInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["SequenceCommandInfo"] = 24] = "SequenceCommandInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["CurrencyInfo"] = 25] = "CurrencyInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["SinglePictureInfo"] = 26] = "SinglePictureInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["WordReportCommandInfo"] = 27] = "WordReportCommandInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["HierarchicalInfo"] = 28] = "HierarchicalInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["TimeSpanInfo"] = 29] = "TimeSpanInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["ReportInfo"] = 30] = "ReportInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["FileInfo"] = 31] = "FileInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["WordFileInfo"] = 32] = "WordFileInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["PictureFileInfo"] = 33] = "PictureFileInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["GaugeInfo"] = 34] = "GaugeInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["CodeInfo"] = 35] = "CodeInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["WorkCenterInfo"] = 36] = "WorkCenterInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["IsDeletedInfo"] = 37] = "IsDeletedInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["RowNumberInfo"] = 38] = "RowNumberInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["BinaryInfo"] = 39] = "BinaryInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["ReverseMetaObjectInfo_AksTakiTaki"] = 40] = "ReverseMetaObjectInfo_AksTakiTaki";
    FieldInfoTypeEnum[FieldInfoTypeEnum["ColorInfo"] = 41] = "ColorInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["IconInfo"] = 42] = "IconInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["RefreshFieldCommandInfo"] = 43] = "RefreshFieldCommandInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["ReferenceFieldInfo"] = 44] = "ReferenceFieldInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["SearchCommandInfo"] = 45] = "SearchCommandInfo";
    FieldInfoTypeEnum[FieldInfoTypeEnum["OrderInfo"] = 46] = "OrderInfo"; // 0x0000002E
})(FieldInfoTypeEnum || (FieldInfoTypeEnum = {}));
class BaseReportModel {
    constructor() {
        this.DefaultItemComponent = 'ReportDefaultItemComponent';
    }
}
const DefaultCommandsAccessValue = {
    Add: false,
    AddToList: false,
    Delete: false,
    Edit: false,
    Export: false,
    Print: false,
    Refresh: false,
    RemoveFromList: false,
    View: false
};
class CustomCommand {
}
class ReportModel extends BaseReportModel {
    constructor() {
        super();
    }
}
class ReportListModel extends BaseReportModel {
}
class ReportFormModel extends BaseReportModel {
}
class ReportCalendarModel extends BaseReportModel {
}
class ReportTreeModel extends BaseReportModel {
}
class ReportViewColumn {
}
const DefaultGridSetting = {
    ColSettingList: [],
    AutoSizeColumns: false,
    SortSettingList: [],
    Hidden: true
};
class GridSetting {
}
class ColSetting {
}
class SortSetting {
}
class ReportField {
    constructor(column, item) {
        this.column = column;
        this.item = item;
        const name = column.Name;
        this.caption = column.Caption;
        this.value = this.item[name];
        if (Number(column.FieldTypeId) === FieldInfoTypeEnum.DateInfo) {
            this.value = this.item[name + '$Caption'];
        }
        if (Number(column.FieldTypeId) === FieldInfoTypeEnum.IconInfo) {
            this.value = this.item[name].Url;
        }
    }
}
const DateRanges = [
    'DateR_None',
    'DateR_SpecificRange',
    'DateR_Today',
    'DateR_ThisWeek',
    'DateR_ThisMonth',
    'DateR_ThisYear',
    'DateR_DaysBefore',
    'DateR_PrevWeek',
    'DateR_PrevMonth',
    'DateR_PrevYear',
    'DateR_DaysAfter',
    'DateR_NextWeek',
    'DateR_NextMonth',
    'DateR_NextYear'
];
var SortDirection;
(function (SortDirection) {
    SortDirection["NONE"] = "none";
    SortDirection["ASC"] = "asc";
    SortDirection["DESC"] = "desc";
})(SortDirection || (SortDirection = {}));
var SelectionMode;
(function (SelectionMode) {
    SelectionMode["SINGLE"] = "single";
    SelectionMode["MULTIPLE"] = "multiple";
    SelectionMode["NONE"] = "none";
})(SelectionMode || (SelectionMode = {}));
var UlvHeightSizeType;
(function (UlvHeightSizeType) {
    UlvHeightSizeType[UlvHeightSizeType["Default"] = 0] = "Default";
    UlvHeightSizeType[UlvHeightSizeType["FillPage"] = 1] = "FillPage";
    UlvHeightSizeType[UlvHeightSizeType["DesignSize"] = 2] = "DesignSize";
    UlvHeightSizeType[UlvHeightSizeType["CustomSize"] = 3] = "CustomSize";
})(UlvHeightSizeType || (UlvHeightSizeType = {}));

class DateService {
    constructor() {
        this.logService = new LogService();
    }
    get now() {
        return new Date();
    }
    monthNames() {
        return moment.localeData(this.locale).months();
    }
    includeDay(date, startDate, endDate) {
        return moment(date).isBetween(startDate, endDate);
    }
    duration(inp, _) {
        return moment.duration(inp);
    }
    day(date) {
        return moment(date).weekday();
    }
    getDayStr(mode) {
        let date;
        switch (mode) {
            case 'Today':
                date = this.now;
                break;
            case 'DaysBefore':
                date = new Date(this.now.setDate(this.now.getDate() - 1));
                break;
            case 'DaysAfter':
                date = new Date(this.now.setDate(this.now.getDate() + 1));
                break;
        }
        const momentOfDate = this.getMoment(date);
        return this.getDateString(momentOfDate, true, false);
    }
    getMonthStr(mode) {
        const momentOfDate = this.getMoment(this.now);
        let date;
        switch (mode) {
            case 'ThisMonth':
                date = this.now;
                break;
            case 'NextMonth':
                date = this.addMonth(momentOfDate, 1);
                break;
            case 'PrevMonth':
                date = this.subtractMonth(momentOfDate, 1);
                break;
            default:
                date = this.now;
                break;
        }
        const dateInfo = this.getDateInfo(date);
        return dateInfo.monthName + ' ' + dateInfo.strYear;
    }
    getYearStr(mode) {
        let year;
        const thisYear = this.getDateInfo(this.now).year;
        switch (mode) {
            case 'ThisYear':
                year = thisYear;
                break;
            case 'PrevYear':
                year = thisYear - 1;
                break;
            case 'NextYear':
                year = thisYear + 1;
                break;
            default:
                year = thisYear;
                break;
        }
        return year;
    }
    getWeekStr(mode) {
        const { from, to } = this.getWeekRange(mode);
        const strFirstDate = this.getDateString(from, true, false);
        const strLastDate = this.getDateString(to, true, false);
        return strFirstDate + this.toText() + strLastDate;
    }
    getWeekRange(mode) {
        let from = moment();
        let to = moment();
        from.locale(this.locale);
        to.locale(this.locale);
        switch (mode) {
            case 'ThisWeek':
                from = from.startOf('week');
                to = to.endOf('week');
                break;
            case 'NextWeek':
                from = from.day(+7).startOf('week');
                to = to.day(+7).endOf('week');
                break;
            case 'PrevWeek':
                from = from.day(-7).startOf('week');
                to = to.day(-7).endOf('week');
                break;
        }
        return { from, to };
    }
    format(value, format) {
        const m = this.getMoment(value);
        return m.format(format);
    }
    getShortDateString(date) {
        const m = moment(date);
        m.locale('fa');
        const format = 'YYYY/MM/DD';
        return m.format(format);
    }
    checkSame(moment1, moment2, mode, prefix) {
        const yearF = `${prefix}YYYY`;
        const monthF = `${prefix}MM`;
        const dayF = `${prefix}DD`;
        const dayCompare = yearF + monthF + dayF;
        const monthCompare = yearF + monthF;
        const yearCompare = yearF;
        let val1;
        let val2;
        switch (mode) {
            case 'day':
                val1 = moment1.format(dayCompare);
                val2 = moment2.format(dayCompare);
                break;
            case 'month':
                val1 = moment1.format(monthCompare);
                val2 = moment2.format(monthCompare);
                break;
            case 'year':
                val1 = moment1.format(yearCompare);
                val2 = moment2.format(yearCompare);
                break;
        }
        return val1 === val2;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateService, decorators: [{
            type: Injectable
        }] });

class DateHijriService extends DateService {
    constructor() {
        super(...arguments);
        this.locale = 'ar';
    }
    getTimes(date) {
        return moment$1(date).format('HH:mm');
    }
    weeksCount(momentObj) {
        return moment$1.duration(moment$1(momentObj).endOf('iMonth') - moment$1(momentObj).startOf('iMonth')).weeks() + 1;
    }
    subtractMonth(momentOfDate, value) {
        return momentOfDate.subtract(value, 'iMonth').toDate();
    }
    addMonth(momentOfDate, value) {
        return momentOfDate.add(value, 'iMonth').toDate();
    }
    toText() {
        return 'الی ';
    }
    to(date1, date2) {
        return moment$1(date1).to(date2);
    }
    from(date1, date2) {
        return moment$1(date1).from(date2);
    }
    isSame(date1, date2, mode) {
        const m1 = moment$1(date1);
        const m2 = moment$1(date2);
        return this.checkSame(m1, m2, mode, 'i');
    }
    strDate(date) {
        return moment$1(date).format('iD');
    }
    weekdaysMin() {
        return moment$1.weekdaysMin();
    }
    weekDays() {
        return moment$1.weekdays();
    }
    date(date) {
        return moment$1(date).iDate();
    }
    endOfMonth(date) {
        return moment$1(date).endOf('iMonth').format('iYYYY-iMM-iDD hh:mm');
    }
    startOfMonth(date) {
        return moment$1(date).startOf('iMonth').format('iYYYY-iMM-iDD hh:mm');
    }
    getDateInfo(date) {
        const m = moment$1(date);
        const shamsi = {
            year: m.iYear(),
            month: m.iMonth(),
            day: m.iDate(),
            hour: m.hour(),
            minutes: m.minute(),
            strYear: m.format('iYYYY'),
            strMonth: m.format('iM'),
            strDay: m.format('iD'),
            monthName: m.format('iMMMM'),
            dayInWeek: 0,
            dayName: m.format('dddd'),
            moment: m,
            date
        };
        shamsi.dayInWeek = m.daysInMonth(shamsi.year, shamsi.month);
        return shamsi;
    }
    daysInMonth(year, month) {
        return moment$1.jDaysInMonth(year, month);
    }
    getMoment(date) {
        if (!date) {
            date = new Date();
        }
        return moment$1(date);
    }
    stringToMoment(str, format) {
        return moment$1(str, format);
    }
    getStrMonthName(date) {
        return moment$1(date).format('iMMMM');
    }
    parse(payload) {
        const { year, month, day, hour, minutes } = payload;
        const format = 'iYYYY-iM-iD HH:mm';
        const value = `${year}-${month}-${day} ${hour}:${minutes}`;
        if (this.logService) {
            this.logService.info(value, format);
        }
        return moment$1(value, format);
    }
    monthNames() {
        return moment$1.localeData()._iMonths;
    }
    format(value, format) {
        const m = this.getMoment(value);
        format = format.indexOf('YYYY') > -1 ? format.replace('YYYY', 'i1111') : format;
        format = format.indexOf('YY') > -1 ? format.replace('YY', 'i11') : format;
        format = format.indexOf('MMMM') > -1 ? format.replace('MMMM', 'i2222') : format;
        format = format.indexOf('MM') > -1 ? format.replace('MM', 'i22') : format;
        format = format.indexOf('DD') > -1 ? format.replace('DD', 'i33') : format;
        format = format.replace(/1/g, 'Y');
        format = format.replace(/2/g, 'M');
        format = format.replace(/3/g, 'D');
        return m.format(format);
    }
    getShortDateString(date) {
        const m = moment$1(date);
        m.locale('ar-SA');
        const format = 'iYYYY/iMM/iDD';
        return m.format(format);
    }
    getDateTimeString(date) {
        const m = moment$1(date);
        m.locale('ar-SA');
        return m.format('iYYYY-iMM-iDD HH:mm');
    }
    getDateString(date, showDate, showTime) {
        const m = moment$1(date);
        let format = 'dddd';
        if (showDate) {
            format = `${format} iYYYY/iMM/iDD  `;
        }
        if (showTime) {
            format = `${format} HH:mm`;
        }
        return m.format(format);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateHijriService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateHijriService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateHijriService, decorators: [{
            type: Injectable
        }] });

class DateMiladiService extends DateService {
    constructor() {
        super();
        this.locale = 'en';
        moment.locale('en');
    }
    getTimes(date) {
        return moment(date).format('HH:mm');
    }
    weeksCount(momentObj) {
        return moment.duration(moment(momentObj).endOf('month').diff(moment(momentObj).startOf('month'))).asWeeks() + 1;
    }
    subtractMonth(momentOfDate, value) {
        return momentOfDate.subtract(value, 'months').toDate();
    }
    addMonth(momentOfDate, value) {
        return momentOfDate.add(value, 'months').toDate();
    }
    to(date1, date2) {
        return moment(date1).to(date2);
    }
    from(date1, date2) {
        return moment(date1).from(date2);
    }
    isSame(date1, date2, mode) {
        return moment(date1).isSame(date2, mode);
    }
    strDate(date) {
        return moment(date).format('D');
    }
    toText() {
        return 'to ';
    }
    date(date) {
        return moment(date).date();
    }
    endOfMonth(date) {
        return new Date(moment(date).endOf('month').format('YYYY-MM-DD hh:mm'));
    }
    startOfMonth(date) {
        return new Date(moment(date).startOf('month').format('YYYY-MM-DD hh:mm'));
    }
    getDateInfo(date) {
        const m = moment(date);
        const miladi = {
            year: m.year(),
            month: m.month(),
            day: m.date(),
            hour: m.hour(),
            minutes: m.minute(),
            strYear: m.format('YYYY'),
            strMonth: m.format('M'),
            strDay: m.format('D'),
            monthName: m.format('MMMM'),
            dayInWeek: 0,
            moment: m,
            dayName: m.format('dddd'),
            date
        };
        miladi.dayInWeek = m.daysInMonth();
        return miladi;
    }
    daysInMonth(year, month) {
        return moment([year, month]).daysInMonth();
    }
    getMoment(date) {
        if (!date) {
            date = new Date();
        }
        return moment(date);
    }
    stringToMoment(str, format) {
        return moment(str, format);
    }
    getStrMonthName(date) {
        return moment(date).format('MMMM');
    }
    parse(payload) {
        const { year, month, day, hour, minutes } = payload;
        const format = 'YYYY-M-D HH:mm';
        const value = `${year}-${month}-${day} ${hour}:${minutes}`;
        if (this.logService) {
            this.logService.info(value, format);
        }
        return moment(value, format);
    }
    getDateString(date, showDate, showTime) {
        const m = moment(date);
        m.locale('en');
        let format = 'dddd';
        if (showDate) {
            format = `${format} DD MM YYYY`;
        }
        if (showTime) {
            format = `${format} HH:mm`;
        }
        return m.format(format);
    }
    getDateTimeString(date) {
        const m = moment(date);
        m.locale('en');
        return m.format('YYYY-MM-DD HH:mm');
    }
    weekdaysMin() {
        return moment.weekdaysMin();
    }
    weekDays() {
        return moment.weekdays();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateMiladiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateMiladiService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateMiladiService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class DateShamsiService extends DateService {
    constructor() {
        super();
        this.locale = 'fa';
        moment$2.loadPersian({ usePersianDigits: true, dialect: 'persian-modern' });
    }
    getTimes(date) {
        return moment$2(date).format('HH:mm');
    }
    weeksCount(momentObj) {
        return moment$2.duration(moment$2(momentObj).endOf('jMonth') - moment$2(momentObj).startOf('jMonth')).weeks() + 1;
    }
    subtractMonth(momentOfDate, value) {
        return momentOfDate.subtract(value, 'jMonth').toDate();
    }
    addMonth(momentOfDate, value) {
        return momentOfDate.add(value, 'jMonth').toDate();
    }
    to(date1, date2) {
        return moment$2(date1).to(date2);
    }
    from(date1, date2) {
        return moment$2(date1).from(date2);
    }
    isSame(date1, date2, mode) {
        const m1 = moment$2(date1);
        const m2 = moment$2(date2);
        return this.checkSame(m1, m2, mode, 'j');
    }
    strDate(date) {
        return moment$2(date).format('jD');
    }
    weekdaysMin() {
        return 'ش_ی_د_س_چ_پ_ج'.split('_');
    }
    weekDays() {
        return 'شنبه_یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه'.split('_');
    }
    toText() {
        return 'تا ';
    }
    date(date) {
        return moment$2(date).jDate();
    }
    endOfMonth(date) {
        return moment$2(date).endOf('jMonth').toDate();
    }
    startOfMonth(date) {
        return moment$2(date).startOf('jMonth').toDate();
    }
    monthNames() {
        return moment$2.localeData()._jMonths;
    }
    getDateInfo(date) {
        const m = moment$2(date);
        const shamsi = {
            year: m.jYear(),
            month: m.jMonth(),
            day: m.jDate(),
            hour: m.hour(),
            minutes: m.minute(),
            strYear: m.format('jYYYY'),
            strMonth: m.format('jM'),
            strDay: m.format('jD'),
            monthName: m.format('jMMMM'),
            dayInWeek: 0,
            moment: m,
            dayName: m.format('dddd'),
            date
        };
        shamsi.dayInWeek = m.daysInMonth(shamsi.year, shamsi.month);
        return shamsi;
    }
    daysInMonth(year, month) {
        return moment$2.jDaysInMonth(year, month);
    }
    getMoment(date) {
        if (!date) {
            date = new Date();
        }
        return moment$2(date);
    }
    stringToMoment(str, format) {
        format = this.convertFormatToJalali(format);
        return moment$2(str, format, true);
    }
    getStrMonthName(date) {
        return moment$2(date).format('jMMMM');
    }
    getDateTimeString(date) {
        const m = moment$2(date);
        m.locale('fa');
        return m.format('jYYYY/jMM/jDD HH:mm');
    }
    format(value, format) {
        const m = this.getMoment(value);
        format = this.convertFormatToJalali(format);
        return m.format(format);
    }
    convertFormatToJalali(format) {
        format = format.indexOf('YYYY') > -1 ? format.replace('YYYY', 'j1111') : format;
        format = format.indexOf('YY') > -1 ? format.replace('YY', 'j11') : format;
        format = format.indexOf('MMMM') > -1 ? format.replace('MMMM', 'j2222') : format;
        format = format.indexOf('MM') > -1 ? format.replace('MM', 'j22') : format;
        format = format.indexOf('DD') > -1 ? format.replace('DD', 'j33') : format;
        format = format.replace(/1/g, 'Y');
        format = format.replace(/2/g, 'M');
        format = format.replace(/3/g, 'D');
        return format;
    }
    getShortDateString(date) {
        const m = moment$2(date);
        m.locale('fa');
        const format = 'jYYYY/jMM/jDD';
        return m.format(format);
    }
    getDateString(date, showDate, showTime) {
        const m = moment$2(date);
        m.locale('fa');
        let format = '';
        if (showDate) {
            format = `dddd jYYYY/jMM/jDD`;
        }
        if (showTime) {
            format = `${format} HH:mm`;
        }
        return m.format(format);
    }
    parse(payload) {
        const { year, month, day, hour, minutes } = payload;
        const format = 'jYYYY-jM-jD HH:mm';
        const value = `${year}-${month}-${day} ${hour}:${minutes}`;
        if (this.logService) {
            this.logService.info(value, format);
        }
        return moment$2(value, format);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateShamsiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateShamsiService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateShamsiService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

/* eslint-disable */
const Device = {};
// * ******* OS Detection ********
/**
 * Contains information about the operating system of the Device.
 * @name Device.os
 */
/**
 * Enumeration containing the names of known operating systems.
 * @name Device.os.OS
 */
/**
 * The name of the operating system.
 * @name Device.os.name
 * @type String
 */
/**
 * The version of the operating system as <code>string</code>. Might be empty if no version can be determined.
 * @name Device.os.versionStr
 * @type String
 */
/**
 * The version of the operating system as <code>float</code>. Might be <code>-1</code> if no version can be determined.
 * @name Device.os.version
 * @type float
 */
/**
 * If this flag is set to <code>true</code>, a Windows operating system is used.
 * @name Device.os.windows
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, a Mac operating system is used.
 * @name Device.os.macintosh
 * @type boolean
 */
/*
 * If this flag is set to <code>true</code>, an iOS operating system is used.
 * @name Device.os.ios
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, an Android operating system is used.
 * @name Device.os.android
 * @type boolean
 */
/*
 * Windows operating system name.
 * @see Device.os.name
 * @name Device.os.OS.WINDOWS
 */
/**
 * MAC operating system name.
 * @see Device.os.name
 * @name Device.os.OS.MACINTOSH
 */
/**
 * iOS operating system name.
 * @see Device.os.name
 * @name Device.os.OS.IOS
 */
/**
 * Android operating system name.
 * @see Device.os.name
 * @name Device.os.OS.ANDROID
 */
const OS = {
    WINDOWS: 'win',
    MACINTOSH: 'mac',
    IOS: 'iOS',
    ANDROID: 'Android'
};
const _getMobileOS = () => {
    const userAgent = navigator.userAgent;
    // iOS, Android
    let rPlatform = /\(([a-zA-Z ]+);\s(?:[U]?[;]?)([\D]+)((?:[\d._]*))(?:.*[)][^\d]*)([\d.]*)\s/;
    let aMatches = userAgent.match(rPlatform);
    if (aMatches) {
        const rAppleDevices = /iPhone|iPad|iPod/;
        if (aMatches[0].match(rAppleDevices)) {
            aMatches[3] = aMatches[3].replace(/_/g, '.');
            return {
                name: OS.IOS,
                versionStr: aMatches[3]
            };
        }
        if (aMatches[2].match(/Android/)) {
            aMatches[2] = aMatches[2].replace(/\s/g, '');
            return {
                name: OS.ANDROID,
                versionStr: aMatches[3]
            };
        }
    }
    // Firefox on Android
    rPlatform = /\((Android)[\s]?([\d][.\d]*)?;.*Firefox\/[\d][.\d]*/;
    aMatches = userAgent.match(rPlatform);
    if (aMatches) {
        return {
            name: OS.ANDROID,
            versionStr: aMatches.length === 3 ? aMatches[2] : ''
        };
    }
    return {};
};
const _getDesktopOS = () => {
    const sPlatform = navigator.platform;
    if (sPlatform.indexOf('Win') !== -1) {
        const rVersion = /Windows NT (\d+).(\d)/i; // userAgent since windows 10: Windows NT 10[...]
        const uaResult = navigator.userAgent.match(rVersion);
        return {
            name: OS.WINDOWS,
            versionStr: (uaResult && uaResult[1]) || ''
        };
    }
    if (sPlatform.indexOf('Mac') !== -1) {
        return {
            name: OS.MACINTOSH,
            versionStr: ''
        };
    }
    return null;
};
const _getOS = () => _getMobileOS() || _getDesktopOS();
const _setOS = () => {
    if (Device.os) {
        return;
    }
    Device.os = _getOS() || {};
    Device.os.OS = OS;
    Device.os.version = Device.os.versionStr ? parseFloat(Device.os.versionStr) : -1;
    if (Device.os.name) {
        Object.keys(OS).forEach((name) => {
            if (OS[name] === Device.os.name) {
                Device.os[name.toLowerCase()] = true;
            }
        });
    }
};
const getOS = () => {
    if (!Device.os) {
        _setOS();
    }
    return Device.os;
};
const isAndroid = () => {
    if (!Device.os) {
        _setOS();
    }
    return !!Device.os.android;
};
// * ******* Browser Detection ********
/**
 * Contains information about the used browser.
 * @name Device.browser
 */
/**
 * Enumeration containing the names of known browsers.
 * @name Device.browser.BROWSER
 *
 * The name of the browser.
 * @name Device.browser.name
 * @type String
 */
/**
 * The version of the browser as <code>string</code>. Might be empty if no version can be determined.
 * @name Device.browser.versionStr
 * @type String
 */
/**
 * The version of the browser as <code>float</code>. Might be <code>-1</code> if no version can be determined.
 * @name Device.browser.version
 * @type float
 */
/**
 * If this flag is set to <code>true</code>, the mobile variant of the browser is used or
 * a tablet or phone device is detected. This information might not be available for all browsers.
 * @name Device.browser.mobile
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, the Microsoft Internet Explorer browser is used.
 * @name Device.browser.internet_explorer
 * @type boolean
 * @deprecated since 1.20, use {@link Device.browser.msie} instead.
 */
/**
 * If this flag is set to <code>true</code>, the Microsoft Internet Explorer browser is used.
 * @name Device.browser.msie
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, the Microsoft Edge browser is used.
 * @name Device.browser.edge
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, the Mozilla Firefox browser is used.
 * @name Device.browser.firefox
 */
/**
 * If this flag is set to <code>true</code>, the Google Chrome browser is used.
 * @name Device.browser.chrome
 * @type boolean
 *
 * If this flag is set to <code>true</code>, the Apple Safari browser is used.
 *
 * <b>Note:</b>
 * This flag is also <code>true</code> when the standalone (fullscreen) mode or webview is used on iOS devices.
 * Please also note the flags {@link Device.browser.fullscreen} and {@link Device.browser.webview}.
 *
 * @name Device.browser.safari
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, a browser featuring a Webkit engine is used.
 *
 * <b>Note:</b>
 * This flag is also <code>true</code> when the used browser was based on the Webkit engine, but
 * uses another rendering engine in the meantime. For example the Chrome browser started from version 28 and above
 * uses the Blink rendering engine.
 *
 * @name Device.browser.webkit
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, the Safari browser runs in standalone fullscreen mode on iOS.
 *
 * <b>Note:</b> This flag is only available if the Safari browser was detected. Furthermore, if this mode is detected,
 * technically not a standard Safari is used. There might be slight differences in behavior and detection, e.g.
 * the availability of {@link Device.browser.version}.
 *
 * @name Device.browser.fullscreen
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, the Safari browser runs in webview mode on iOS.
 *
 * <b>Note:</b> This flag is only available if the Safari browser was detected. Furthermore, if this mode is detected,
 * technically not a standard Safari is used. There might be slight differences in behavior and detection, e.g.
 * the availability of {@link Device.browser.version}.
 *
 * @name Device.browser.webview
 * @type boolean
 */
/**
 * If this flag is set to <code>true</code>, the Phantom JS browser is used.
 * @name Device.browser.phantomJS
 * @type boolean
 */
/**
 * The version of the used Webkit engine, if available.
 * @name Device.browser.webkitVersion
 * @type String
 */
/**
 * If this flag is set to <code>true</code>, a browser featuring a Mozilla engine is used.
 * @name Device.browser.mozilla
 * @type boolean
 */
/**
 * Internet Explorer browser name.
 * @name Device.browser.BROWSER.INTERNET_EXPLORER
 */
/**
 * Edge browser name.
 * @name Device.browser.BROWSER.EDGE
 */
/**
 * Firefox browser name.
 * @name Device.browser.BROWSER.FIREFOX
 */
/**
 * Chrome browser name.
 * @name Device.browser.BROWSER.CHROME
 */
/**
 * Safari browser name.
 * @name Device.browser.BROWSER.SAFARI
 */
/**
 * Android stock browser name.
 * @name Device.browser.BROWSER.ANDROID
 */
const BROWSER = {
    INTERNET_EXPLORER: 'ie',
    EDGE: 'ed',
    FIREFOX: 'ff',
    CHROME: 'cr',
    SAFARI: 'sf',
    ANDROID: 'an'
};
/* !
 * Taken from jQuery JavaScript Library v1.7.1
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Mon Nov 21 21:11:03 2011 -0500
 */
const _calcBrowser = () => {
    const sUserAgent = navigator.userAgent.toLowerCase();
    const rwebkit = /(webkit)[ /]([\w.]+)/;
    const rmsie = /(msie) ([\w.]+)/;
    const rmsie11 = /(trident)\/[\w.]+;.*rv:([\w.]+)/;
    const redge = /(edge)[ /]([\w.]+)/;
    const rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/;
    // WinPhone IE11 and MS Edge userAgents contain "WebKit" and "Mozilla" and therefore must be checked first
    const browserMatch = redge.exec(sUserAgent) ||
        rmsie11.exec(sUserAgent) ||
        rwebkit.exec(sUserAgent) ||
        rmsie.exec(sUserAgent) ||
        (sUserAgent.indexOf('compatible') < 0 && rmozilla.exec(sUserAgent)) ||
        [];
    const oRes = {
        browser: browserMatch[1] || '',
        version: browserMatch[2] || '0'
    };
    oRes[oRes.browser] = true;
    return oRes;
};
const _getBrowser = () => {
    const oBrowser = _calcBrowser();
    const sUserAgent = navigator.userAgent;
    const oNavigator = window.navigator;
    // jQuery checks for user agent strings. We differentiate between browsers
    let oExpMobile;
    let oResult;
    let fVersion;
    // Mozilla
    if (oBrowser.mozilla) {
        oExpMobile = /Mobile/;
        if (sUserAgent.match(/Firefox\/(\d+\.\d+)/)) {
            fVersion = parseFloat(RegExp.$1);
            oResult = {
                name: BROWSER.FIREFOX,
                versionStr: `${fVersion}`,
                version: fVersion,
                mozilla: true,
                mobile: oExpMobile.test(sUserAgent)
            };
        }
        else {
            // unknown mozilla browser
            oResult = {
                mobile: oExpMobile.test(sUserAgent),
                mozilla: true,
                version: -1
            };
        }
    }
    else if (oBrowser.webkit) {
        // webkit version is needed for calculation if the mobile android device is a tablet (calculation of other mobile devices work without)
        const regExpWebkitVersion = sUserAgent.toLowerCase().match(/webkit[/]([\d.]+)/);
        let webkitVersion;
        if (regExpWebkitVersion) {
            webkitVersion = regExpWebkitVersion[1];
        }
        oExpMobile = /Mobile/;
        const aChromeMatch = sUserAgent.match(/(Chrome|CriOS)\/(\d+\.\d+).\d+/);
        const aFirefoxMatch = sUserAgent.match(/FxiOS\/(\d+\.\d+)/);
        const aAndroidMatch = sUserAgent.match(/Android .+ Version\/(\d+\.\d+)/);
        if (aChromeMatch || aFirefoxMatch || aAndroidMatch) {
            let sName;
            let sVersion;
            let bMobile;
            if (aChromeMatch) {
                sName = BROWSER.CHROME;
                bMobile = oExpMobile.test(sUserAgent);
                sVersion = parseFloat(aChromeMatch[2]);
            }
            else if (aFirefoxMatch) {
                sName = BROWSER.FIREFOX;
                bMobile = true;
                sVersion = parseFloat(aFirefoxMatch[1]);
            }
            else if (aAndroidMatch) {
                sName = BROWSER.ANDROID;
                bMobile = oExpMobile.test(sUserAgent);
                sVersion = parseFloat(aAndroidMatch[1]);
            }
            oResult = {
                name: sName,
                mobile: bMobile,
                versionStr: `${sVersion}`,
                version: sVersion,
                webkit: true,
                webkitVersion
            };
        }
        else {
            // Safari might have an issue with sUserAgent.match(...); thus changing
            const oExp = /(Version|PhantomJS)\/(\d+\.\d+).*Safari/;
            const bStandalone = oNavigator.standalone;
            if (oExp.test(sUserAgent)) {
                const aParts = oExp.exec(sUserAgent);
                fVersion = parseFloat(aParts[2]);
                oResult = {
                    name: BROWSER.SAFARI,
                    versionStr: `${fVersion}`,
                    fullscreen: false,
                    webview: false,
                    version: fVersion,
                    mobile: oExpMobile.test(sUserAgent),
                    webkit: true,
                    webkitVersion,
                    phantomJS: aParts[1] === 'PhantomJS'
                };
            }
            else if (/iPhone|iPad|iPod/.test(sUserAgent) &&
                !/CriOS/.test(sUserAgent) &&
                !/FxiOS/.test(sUserAgent) &&
                (bStandalone === true || bStandalone === false)) {
                // WebView or Standalone mode on iOS
                oResult = {
                    name: BROWSER.SAFARI,
                    version: -1,
                    fullscreen: bStandalone,
                    webview: !bStandalone,
                    mobile: oExpMobile.test(sUserAgent),
                    webkit: true,
                    webkitVersion
                };
            }
            else {
                // other webkit based browser
                oResult = {
                    mobile: oExpMobile.test(sUserAgent),
                    webkit: true,
                    webkitVersion,
                    version: -1
                };
            }
        }
    }
    else if (oBrowser.msie || oBrowser.trident) {
        fVersion = parseFloat(oBrowser.version);
        oResult = {
            name: BROWSER.INTERNET_EXPLORER,
            versionStr: `${fVersion}`,
            version: fVersion,
            msie: true,
            mobile: false
        };
    }
    else if (oBrowser.edge) {
        fVersion = parseFloat(oBrowser.version);
        oResult = {
            name: BROWSER.EDGE,
            versionStr: `${fVersion}`,
            version: fVersion,
            edge: true
        };
    }
    else {
        oResult = {
            name: '',
            versionStr: '',
            version: -1,
            mobile: false
        };
    }
    return oResult;
};
const _setBrowser = () => {
    Device.browser = _getBrowser();
    Device.browser.BROWSER = BROWSER;
    if (Device.browser.name) {
        Object.keys(BROWSER).forEach((b) => {
            if (BROWSER[b] === Device.browser.name) {
                Device.browser[b.toLowerCase()] = true;
            }
        });
    }
};
const getBrowser = () => {
    if (!Device.browser) {
        _setBrowser();
    }
    return Device.browser;
};
const isIE = () => {
    if (!Device.browser) {
        _setBrowser();
    }
    return !!Device.browser.msie;
};
const isEdge = () => {
    if (!Device.browser) {
        _setBrowser();
    }
    return !!Device.browser.edge;
};
const isChrome = () => {
    if (!Device.browser) {
        _setBrowser();
    }
    return !!Device.browser.chrome;
};
const isFF$1 = () => {
    if (!Device.browser) {
        _setBrowser();
    }
    return !!Device.browser.firefox;
};
const isSafari$1 = () => {
    if (!Device.browser) {
        _setBrowser();
    }
    return !!Device.browser.safari;
};
// * ******* Support Detection ********
const _setSupport = () => {
    if (Device.support) {
        return;
    }
    if (!Device.browser) {
        _setBrowser();
    }
    Device.support = {};
    Device.support.touch = !!('ontouchstart' in window ||
        navigator.maxTouchPoints > 0 ||
        (window.DocumentTouch && document instanceof window.DocumentTouch));
};
const supportTouch = () => {
    if (!Device.support) {
        _setSupport();
    }
    return !!Device.support.touch;
};
// * ******* System Detection ********
/**
 * Provides a basic categorization of the used device based on various indicators.
 *
 * <b>Note:</b> Depending on the capabilities of the device it is also possible that multiple flags are set to <code>true</code>.
 *
 * @namespace
 * @name Device.system
 */
/**
 * If this flag is set to <code>true</code>, the device is recognized as a phone.
 *
 * @name Device.system.phone
 * @type boolean
 */
/**
 * @name Device.system.SYSTEMTYPE
 * Enumeration containing the names of known types of the devices.
 */
const SYSTEMTYPE = {
    TABLET: 'tablet',
    PHONE: 'phone',
    DESKTOP: 'desktop',
    COMBI: 'combi'
};
const _isTablet = () => {
    const sUserAgent = navigator.userAgent;
    if (Device.os.name === Device.os.OS.IOS) {
        return /ipad/i.test(sUserAgent);
    }
    // in real mobile device
    if (supportTouch()) {
        if (Device.os.windows && Device.os.version >= 8) {
            return true;
        }
        if (Device.browser.chrome && Device.os.android && Device.os.version >= 4.4) {
            return !/Mobile Safari\/[.0-9]+/.test(sUserAgent);
        }
        let densityFactor = window.devicePixelRatio ? window.devicePixelRatio : 1; // may be undefined in Windows Phone devices
        // On Android sometimes window.screen.width returns the logical CSS pixels, sometimes the physical device pixels;
        // Tests on multiple devices suggest this depends on the Webkit version.
        // The Webkit patch which changed the behavior was done here: https://bugs.webkit.org/show_bug.cgi?id=106460
        // Chrome 27 with Webkit 537.36 returns the logical pixels,
        // Chrome 18 with Webkit 535.19 returns the physical pixels.
        // The BlackBerry 10 browser with Webkit 537.10+ returns the physical pixels.
        // So it appears like somewhere above Webkit 537.10 we do not hve to divide by the devicePixelRatio anymore.
        if (Device.os.android && Device.browser.webkit && parseFloat(Device.browser.webkitVersion) > 537.1) {
            densityFactor = 1;
        }
        // this is how android distinguishes between tablet and phone
        // http://android-developers.blogspot.de/2011/07/new-tools-for-managing-screen-sizes.html
        const bTablet = Math.min(window.screen.width / densityFactor, window.screen.height / densityFactor) >= 600;
        // special workaround for Nexus 7 where the window.screen.width is 600px or 601px in portrait mode (=> tablet)
        // but window.screen.height 552px in landscape mode (=> phone), because the browser UI takes some space on top.
        // So the detected device type depends on the orientation :-(
        // actually this is a Chrome bug, as "width"/"height" should return the entire screen's dimensions and
        // "availWidth"/"availHeight" should return the size available after subtracting the browser UI
        /*
                 if (isLandscape() &&
                     (window.screen.height === 552 || window.screen.height === 553) // old/new Nexus 7
                     &&
                     (/Nexus 7/i.test(sUserAgent))) {
                     bTablet = true;
                 }
                 */
        return bTablet;
    }
    // This simple android phone detection can be used here because this is the mobile emulation mode in desktop browser
    const bAndroidPhone = /(?=android)(?=.*mobile)/i.test(sUserAgent);
    // in desktop browser, it's detected as tablet when
    // 1. Windows 8 device with a touch screen where "Touch" is contained in the userAgent
    // 2. Android emulation and it's not an Android phone
    return (Device.browser.msie && sUserAgent.indexOf('Touch') !== -1) || (Device.os.android && !bAndroidPhone);
};
const _getSystem = () => {
    const bTabletDetected = _isTablet();
    const isWin8Upwards = Device.os.windows && Device.os.version >= 8;
    const oSystem = {};
    oSystem.tablet = !!((Device.support.touch || isWin8Upwards) && bTabletDetected);
    oSystem.phone = !!((Device.os.windows_phone || Device.support.touch) && !bTabletDetected);
    oSystem.desktop = !!((!oSystem.tablet && !oSystem.phone) || isWin8Upwards);
    oSystem.combi = oSystem.desktop && oSystem.tablet;
    oSystem.SYSTEMTYPE = SYSTEMTYPE;
    oSystem.phone = oSystem.phone && window.innerWidth < 768;
    return oSystem;
};
const _setSystem = () => {
    _setSupport();
    _setOS();
    Device.system = {};
    Device.system = _getSystem();
    if (Device.system.tablet || Device.system.phone) {
        Device.browser.mobile = true;
    }
};
const getSystem = () => {
    if (!Device.system) {
        _setSystem();
    }
    return Device.system;
};
const isDesktop = () => {
    if (!Device.system) {
        _setSystem();
    }
    return Device.system.desktop;
};
const isTablet = () => {
    if (!Device.system) {
        _setSystem();
    }
    return Device.system.tablet;
};
const isPhone = () => {
    if (!Device.system) {
        _setSystem();
    }
    return Device.system.phone;
};
const isMobile = () => {
    if (!Device.system) {
        _setSystem();
    }
    return Device.browser.mobile;
};

/* eslint-disable */
var TableHeaderWidthMode;
(function (TableHeaderWidthMode) {
    TableHeaderWidthMode[TableHeaderWidthMode["FitToRowContent"] = 1] = "FitToRowContent";
    TableHeaderWidthMode[TableHeaderWidthMode["FitToContainer"] = 2] = "FitToContainer";
    TableHeaderWidthMode[TableHeaderWidthMode["FreeColumnSize"] = 3] = "FreeColumnSize";
    TableHeaderWidthMode[TableHeaderWidthMode["ColumnWidth"] = 4] = "ColumnWidth";
})(TableHeaderWidthMode || (TableHeaderWidthMode = {}));
function setTableThWidth(tableHeaderMode, columns, thList, renderer2) {
    let propName = '';
    switch (tableHeaderMode) {
        case TableHeaderWidthMode.FitToRowContent:
            propName = '$FitToContent';
            break;
        case TableHeaderWidthMode.FitToContainer:
            propName = '$FitContainerWidth';
            break;
        case TableHeaderWidthMode.FreeColumnSize:
            propName = '$Width';
            break;
        case TableHeaderWidthMode.ColumnWidth:
            propName = '$ColumnWidth';
            break;
    }
    thList.forEach((c, i) => {
        const wx = _calcWidthOfTh(columns[i], i, propName, thList);
        wx && renderer2.setStyle(c, 'width', wx);
    });
}
function _calcWidthOfTh(column, i, propName, thList) {
    if (!column) {
        return '';
    }
    if (column.$IsImageOricon && i < thList.length - 1) {
        const fieldTypeId = +column.FieldTypeId;
        const isPicture = fieldTypeId === 42;
        if (fieldTypeId === 6 || fieldTypeId === 5 || isPicture) {
            return isPicture ? '48px' : '32px';
        }
    }
    return column.$IsImageOricon && i < thList.length - 1 ? '42px' : column[propName];
}
function calculateColumnContent(columns, moDataList) {
    columns.forEach((column) => {
        setColumnWidthByMaxMoContentWidth(moDataList, column);
    });
}
function calculateColumnWidth(container, columns, moDataList, disableContextMenuOverflow, contextMenuItems) {
    columns
        .filter((c) => !c.Hidden)
        .forEach((column) => {
        setColumnCaptionWidth(column);
    });
    const contextMenuWidth = calcContextMenuWidth(contextMenuItems, disableContextMenuOverflow);
    return { columns: [...columns], contextMenuWidth };
}
function setColumnCaptionWidth(column) {
    if (column.$ColumnWidthNum) {
        return column.$ColumnWidthNum;
    }
    const colCaptionWidth = measureText(column.Alias) + 16 + 10;
    column.$ColumnWidthNum = Math.ceil(colCaptionWidth);
    column.$ColumnWidth = `${column.$ColumnWidthNum}px`;
    return colCaptionWidth;
}
function setColumnWidthByMaxMoContentWidth(moDataList, column) {
    const width = calculateMoDataListContentWidthByColumnName(moDataList, column);
    column.$ContentWidth = `${Math.ceil(width)}px`;
}
function calculateMoDataListContentWidthByColumnName(moDataList, column) {
    let maxWidth = 0;
    moDataList.forEach((c, index) => {
        const caption = getColumnValueOfMoDataList(column.Name, c, undefined, true);
        const captionWidth = measureText(caption) + 16;
        if (maxWidth < captionWidth) {
            maxWidth = captionWidth;
        }
    });
    return Math.ceil(maxWidth);
}
function calculateFreeColumnSize(columns) {
    let allColWidth = 0;
    const visibleColumns = columns.filter((c) => !c.Hidden);
    visibleColumns.forEach((col, index) => {
        const x = setColumnCaptionWidth(col);
        const w = col.Width && col.Width > 0 ? col.Width : x;
        allColWidth += w;
        col.$Width = index === visibleColumns.length - 1 ? '100%' : `${w}px`;
    });
    return [...columns];
}
function calculateColumnWidthFitToContainer(container, canView, disableContextMenuOverflow, contextMenuItems, columns) {
    let hasDefinedWidth = true;
    let containerWidth = columns.map((c) => c.Width).reduce((a, b) => a + b, 0);
    if (containerWidth === 0) {
        containerWidth = container.clientWidth;
        hasDefinedWidth = false;
    }
    let allColWidth = 0;
    const isMobile = getDeviceIsMobile();
    let remainPercent = 0;
    const lCols = columns.filter((c, i) => !c.Hidden && !(i === 0 && c.FieldTypeId === 41));
    lCols.forEach((col, index) => {
        // اگر فیلد از نوع رنگ نبود و ستون اول هم نبود
        const x = setColumnCaptionWidth(col);
        const w = col.Width && col.Width > 0 ? col.Width : x;
        allColWidth += w;
        const percent = (w / containerWidth) * 100;
        col.$FitContainerWidth = isMobile || col.Width === 0 || percent === Infinity ? '100%' : `${percent}%`;
        if (index === lCols.length - 1 && !hasDefinedWidth) {
            col.$FitContainerWidth = 100 - (remainPercent === Infinity ? 0 : remainPercent) + '%';
        }
        else {
            remainPercent += percent;
        }
    });
    // const canViewButtonWidth = canView ? 40 : 0;
    // const selectionWidth = 30;
    const contextMenuWidth = calcContextMenuWidth(contextMenuItems, disableContextMenuOverflow);
    // const containerWidthAllColumns = containerWidth - selectionWidth - canViewButtonWidth - contextMenuWidth - 12;
    // allColWidth += containerWidthAllColumns - allColWidth;// محاسبه آخرین ستون.چون width مشخصی ندارد
    // columns
    //     .filter((c) => !c.Hidden)
    //     .forEach((col) => {
    //         const newWidth = Math.ceil((containerWidthAllColumns * col.Width) / allColWidth);
    //         col.Width = newWidth;
    //         col.$FitContainerWidth = `${newWidth}px`;
    //     });
    return { columns: [...columns], contextMenuWidth };
}
function calcContextMenuWidth(contextMenuItems, disableContextMenuOverflow) {
    let contextMenuWidth = contextMenuItems.length > 1 ? 40 : 0;
    const btnPadding = 14 + 2 + 10; // padding + border + if text is overflowed then add 5 pixel.so we always 5 px to it.
    const tdPadding = 15 + 1; // padding + border
    const buttonIconWidth = 16 + 6; // size + margin
    if (disableContextMenuOverflow || contextMenuItems.length === 1) {
        contextMenuWidth = 0;
        contextMenuItems.forEach((c) => {
            contextMenuWidth += measureText(c.text) + btnPadding + tdPadding;
            contextMenuWidth += c.icon ? buttonIconWidth : 0;
        });
    }
    return contextMenuWidth;
}
function RotateImage(imgEl, media, renderer2) {
    // ۱. به‌روزرسانی زاویه
    media.RotationAngle = ((media.RotationAngle || 0) + 90) % 360;
    const w = imgEl.offsetWidth;
    const h = imgEl.offsetHeight;
    const isVertical = media.RotationAngle % 180 !== 0;
    if (isVertical) {
        // چون محورها چرخیده‌اند، ScaleX روی ارتفاع کانتینر و ScaleY روی عرض کانتینر اثر می‌گذارد
        const scaleX = h / w; // مقیاس افقی تصویر که حالا عمودی شده
        const scaleY = w / h; // مقیاس عمودی تصویر که حالا افقی شده
        renderer2.setStyle(imgEl, 'transform', `rotate(${media.RotationAngle}deg) scale(${scaleX}, ${scaleY})`);
    }
    else {
        // در زوایای ۰ و ۱۸۰، تصویر به حالت عادی برمی‌گردد
        renderer2.setStyle(imgEl, 'transform', `rotate(${media.RotationAngle}deg) scale(1, 1)`);
    }
    // برای اطمینان از اینکه تصویر از مرکز فیت می‌شود
    renderer2.setStyle(imgEl, 'transform-origin', 'center center');
    renderer2.setStyle(imgEl, 'transition', 'transform 0.3s ease-in-out');
}
function isInLocalMode() {
    const offlinceActive = BarsaApi.Common.Util.TryGetValue(BarsaApi.Offline, 'Settings.IsActive', false);
    const offlineTrue = BarsaApi.Common.Util.TryGetValue(BarsaApi.Offline, 'Settings.IsOffline', false);
    return offlinceActive && offlineTrue;
}
function getLabelWidth(item) {
    const fieldXtype = item.FieldUi?.originalXtype;
    if (fieldXtype === 'Ui.Button' ||
        fieldXtype === 'Ui.CheckBox' ||
        !item.TextVisible ||
        item.CaptionSetting?.AlignMode === 'AutoSize') {
        return;
    }
    let labelCaption = item.Caption;
    if (labelCaption === '&zwnj;') {
        labelCaption = '';
    }
    labelCaption = labelCaption + ' * ';
    // if (item.FieldUi?.Setting?.IsMandatory) {
    //     if (labelCaption.indexOf('*') < 0) {
    //     }
    // } else {
    //     labelCaption = labelCaption.replace('*', '');
    // }
    labelCaption += ':';
    const labelWidth = measureTextBy(labelCaption);
    let labelWithPadding = labelWidth + 10;
    if (item.FieldUi?.Setting?.FieldIcon) {
        labelWithPadding += 24;
    }
    if (item.FieldUi?.Setting?.HelpDescription) {
        labelWithPadding += 24;
    }
    const controlWidth = Math.ceil(labelWithPadding);
    return controlWidth;
}
function getColumnValueOfMoDataList(name, mo, Columns, caption) {
    let fieldName = Columns ? Columns.find((c) => c.Name === name || c.Alias === name)?.Name : name;
    if (!fieldName) {
        fieldName = name;
    }
    let val = fieldName ? mo[fieldName] : undefined;
    if (caption) {
        let captionVal = fieldName ? mo[fieldName]?.$Caption : undefined;
        if (typeof captionVal === 'undefined' && fieldName) {
            captionVal = mo[fieldName + '$Caption'];
        }
        if (typeof captionVal === 'undefined') {
            captionVal = val;
        }
        val = captionVal;
    }
    return val;
}
function throwIfAlreadyLoaded(parentModule, moduleName) {
    if (parentModule) {
        throw new Error(`${moduleName} has already been loaded. Import ${moduleName} in the AppModule only.`);
    }
}
const measureTextValues = {};
function measureText2(text, fontSize, fontName) {
    const key = `${text}${fontSize}${fontName}`;
    if (measureTextValues[key]) {
        return measureTextValues[key];
    }
    const measureTextDom = document.getElementById('measureText');
    if (!measureTextDom) {
        return -1;
    }
    const ctx = measureTextDom.getContext('2d');
    fontSize = fontSize ? fontSize : '0.885rem';
    fontName = fontName ? fontName : 'B-Font';
    ctx.font = `normal ${fontSize} ${fontName}`;
    const x = ctx.measureText(text).width;
    measureTextValues[key] = x;
    return x;
}
function measureText(text, fontSize) {
    return measureText2(text, fontSize, 'IRANYekanDigits');
}
function measureTextBy(text, fontSize, fontName) {
    return measureText2(text, fontSize, fontName || 'B-Font');
}
function genrateInlineMoId() {
    return (BarsaApi.idGenerator--).toString();
}
function enumValueToStringSize(value, defaultValue) {
    switch (value) {
        case '1':
            return 's';
        case '2':
            return 'm';
        case '3':
            return 'l';
        default:
            return defaultValue;
    }
}
function isVersionBiggerThan(inputVersion) {
    const result = compareVersions(inputVersion, BarsaApi.LoginFormData.Version);
    if (result > 0) {
        return true;
    }
    else {
        return false;
    }
}
function compareVersions(v1, v2) {
    // ۱. تابع کمکی برای تبدیل رشته به عدد نهایی بر اساس فرمول شما
    const getVersionScore = (v) => {
        const parts = v
            .split('.')
            .filter((x) => x !== '')
            .map(Number);
        const major = (parts[0] || 0) * 1000; // بخش اول * 1000
        const minor = (parts[1] || 0) * 100; // بخش دوم * 100
        // بخش‌های باقی‌مانده (بخش سوم به بعد) با هم جمع می‌شوند
        const remaining = parts.slice(2).reduce((sum, current) => sum + current, 0);
        return major + minor + remaining;
    };
    // ۲. محاسبه امتیاز برای هر دو نسخه
    const score1 = getVersionScore(v1);
    const score2 = getVersionScore(v2);
    // ۳. مقایسه اعداد نهایی
    if (score1 < score2)
        return 1;
    if (score1 > score2)
        return -1;
    return 0;
}
function scrollToElement(target) {
    if (!target)
        return;
    const rect = target.getBoundingClientRect();
    // بررسی اینکه آیا المنت در محدوده پنجره مرورگر قرار دارد
    const isVisible = rect.top >= 0 &&
        rect.left >= 0 &&
        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
        rect.right <= (window.innerWidth || document.documentElement.clientWidth);
    if (!isVisible) {
        // اگر قابل مشاهده نبود، به سمت آن اسکرول کن
        target.scrollIntoView({ behavior: 'smooth', block: 'center' });
    }
    else {
        console.log('المنت همین الان هم قابل مشاهده است.');
    }
}
function executeUlvCommandHandler(button, options) {
    if (button.Command && button.Command.Handler) {
        button.Command.Handler(button, options);
    }
    else if (button.handler) {
        button.handler.bind(button.scope)(button, options);
    }
}
function getUniqueId(parts) {
    const stringArr = [];
    for (let i = 0; i < parts; i++) {
        const S4 = (((1 + Math.random()) * 0x10000) | 0).toString(16);
        const S4_ = S4.length > 0 ? S4.substring(1) : '';
        stringArr.push(S4_);
    }
    return stringArr.join('-');
}
function getDateService(logService, culture) {
    const defaultCulture = culture ?? BarsaApi.LoginFormData.Culture;
    switch (defaultCulture) {
        case 'fa-IR':
            return new DateShamsiService();
        case 'ar-AE':
            return new DateHijriService();
        default:
            return new DateMiladiService();
    }
}
function getAllItemsPerChildren(item, level, array, parentNode, autoOpenLevels) {
    let newItem = item;
    if (level > 0) {
        item.parentNode = parentNode;
        item.level = level;
        item.isExpand = item.isExpand ?? autoOpenLevels > level;
        item.visibility = item.parentNode.isExpand;
        array.push(newItem);
    }
    else {
        newItem = item;
        newItem.isExpand = true;
    }
    if (item.children) {
        item.children.forEach((child) => setOneDepthLevel(child));
        return item.children.map((i) => getAllItemsPerChildren(i, level + 1, array, newItem, autoOpenLevels));
    }
}
function setOneDepthLevel(node) {
    let hasOneDepth = true;
    node.children?.forEach((child) => {
        if (child.Data?.$HasChildren) {
            hasOneDepth = false;
            return;
        }
    });
    node.hasOneDepthLevel = hasOneDepth;
}
function isFirefox() {
    return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
}
function getImagePath(type, moId, fileId, fieldDefId, size, sizeH) {
    moId = moId == null ? '' : encodeURIComponent(moId);
    fileId = fileId == null ? '' : encodeURIComponent(fileId);
    fieldDefId = fieldDefId == null ? '' : encodeURIComponent(fieldDefId);
    size = size === null ? 128 : size;
    sizeH = sizeH === null ? size : sizeH;
    const url = `/IH.ashx?ty=${type}&moId=${moId}&id=${fileId}&fdId=${fieldDefId}&si=${size}&siH=${sizeH}`;
    return url;
}
function checkPermission() {
    const windowRef = window;
    // ابتدا چک می‌کنیم که آیا کلاً این قابلیت در این مرورگر وجود دارد یا خیر
    if ('Notification' in windowRef) {
        return windowRef.Notification.permission;
    }
    // اگر نبود (مثل سفاری موبایل)، مقدار default یا denied برمی‌گردانیم
    return 'denied';
}
function fixUnclosedParentheses(url) {
    const openCount = (url.match(/\(/g) || []).length;
    const closeCount = (url.match(/\)/g) || []).length;
    if (openCount > closeCount) {
        // به تعداد اختلاف، پرانتز بسته اضافه می‌کند
        return url + ')'.repeat(openCount - closeCount);
    }
    return url;
}
function isFunction(functionToCheck) {
    return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';
}
function DeviceWidth() {
    return window.innerWidth > 0 ? window.innerWidth : screen.width;
}
function getHeaderValue(fieldValue, returnValue) {
    if (typeof fieldValue !== 'object') {
        return fieldValue;
    }
    const value = fieldValue.Value;
    const valueCaption = fieldValue.Value$Caption;
    let valueObjectCaption = null;
    if (typeof value === 'object') {
        valueObjectCaption = fieldValue.Value.$Caption;
    }
    if (valueObjectCaption && !returnValue) {
        return valueObjectCaption;
    }
    if (valueCaption && !valueCaption.startsWith('tmp') && !returnValue) {
        return valueCaption;
    }
    return value;
}
function elementInViewport2(el) {
    let top = el.offsetTop;
    let left = el.offsetLeft;
    const width = el.offsetWidth;
    const height = el.offsetHeight;
    while (el.offsetParent) {
        el = el.offsetParent;
        top += el.offsetTop;
        left += el.offsetLeft;
    }
    return (top < window.pageYOffset + window.innerHeight &&
        left < window.pageXOffset + window.innerWidth &&
        top + height > window.pageYOffset &&
        left + width > window.pageXOffset);
}
function PreventDefaulEvent(e, propagationDisable = true) {
    if (propagationDisable) {
        stopPropagation(e);
    }
    e.preventDefault();
}
function stopPropagation(e) {
    e.stopPropagation();
}
function getParentHeight(elDom) {
    let parentDom = elDom.parentElement;
    let parentHeight = parentDom?.clientHeight ?? 0;
    while (parentDom != null && parentHeight < 40) {
        parentDom = parentDom.parentElement;
        parentHeight = parentDom?.clientHeight ?? 0;
    }
    return parentHeight;
}
function getComponentDefined(controlUi, customUiSetting) {
    let moduleName = BarsaApi.LoginFormData.DefaultUiModule;
    let moduleKebabName = BarsaApi.Common.Util.GetKebabCase(moduleName);
    let componentName = controlUi.originalXtype.replace('.', '').replace('_', '');
    let selector = BarsaApi.Common.Util.GetKebabCase(componentName);
    selector = selector.substring(1, selector.length);
    selector = BarsaApi.LoginFormData.CustomUiPrefix + '-' + selector;
    if (customUiSetting && customUiSetting.Module) {
        moduleName = customUiSetting.Module;
        moduleKebabName = BarsaApi.Common.Util.GetKebabCase(moduleName);
        componentName = customUiSetting.Name;
        selector = customUiSetting.Selector;
    }
    const modulePath = moduleKebabName.slice(1, moduleKebabName.length);
    return { moduleName, modulePath, componentName, selector };
}
function isSafari() {
    return isSafari$1();
}
function isFF() {
    return isFF$1();
}
function getDeviceIsPhone() {
    return isPhone();
}
function getDeviceIsDesktop() {
    return isDesktop();
}
function getDeviceIsTablet() {
    return isTablet();
}
function getDeviceIsMobile() {
    return navigator.userAgent.indexOf('mobi') > 0 || getDeviceIsPhone();
}
function getControlSizeMode(el, deviceSize = 'l') {
    const containerWidth = el.offsetWidth;
    if (containerWidth === 0) {
        return deviceSize;
    }
    if (deviceSize === 's' || containerWidth < 600) {
        deviceSize = 's';
    }
    else if (deviceSize === 'm' || (containerWidth > 600 && containerWidth < 1200)) {
        deviceSize = 'm';
    }
    return deviceSize;
}
function formatBytes(bytes, decimals = 2, size) {
    if (bytes === 0) {
        return '0 Bytes';
    }
    const k = 1024;
    const dm = decimals < 0 ? 0 : decimals;
    const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
    const i = sizes.findIndex((c) => c === size);
    return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
function getValidExtension(validExtensions) {
    let _validExtensions = '';
    if (Array.isArray(validExtensions)) {
        _validExtensions = validExtensions.map((c) => '.' + c.Extension).join(',');
    }
    return _validExtensions;
}
function getIcon(type) {
    return BarsaApi.Common.File.FileIconDict128[type];
}
function isImage(type) {
    if (!type) {
        return false;
    }
    type = type.toLowerCase();
    return ['img', 'png', 'jpeg', 'jpg', 'gif', 'bmp', 'tiff', 'image', 'jfif'].indexOf(type) > -1;
}
function GetAllColumnsSorted(context) {
    const allColumns = BarsaApi.Common.Util.TryGetValue(context, 'Setting.View.Columns', []).filter((c) => c.Name !== 'Id' && c.Name !== '$StyleIndex' && !c.Hidden);
    const colList = BarsaApi.Common.Util.TryGetValue(context, 'Setting.View.GridSetting.ColSettingList', []);
    const columns = new Array();
    colList.forEach((colS) => {
        const columnOfColList = allColumns.find((c) => c.Name === colS.Name);
        if (columnOfColList) {
            columns.push({ ...columnOfColList, Hidden: colS.IsHidden, Width: colS.Width });
        }
    });
    allColumns.forEach((column, index) => {
        const colSetting = colList.find((c) => c.Name === column.Name);
        if (!colSetting) {
            columns.splice(index, 0, { ...column, Hidden: colList.length > 0 ? true : false });
        }
    });
    return columns;
}
function GetVisibleValue(object, field) {
    let outputValue;
    if (object[field]?.$Caption !== undefined) {
        outputValue = object[field].$Caption;
    }
    else {
        outputValue = object[field + '$Caption'] !== undefined ? object[field + '$Caption'] : object[field];
    }
    return outputValue;
}
function GroupBy(collection, sortSettings) {
    const grouped = {};
    const groups = sortSettings.map((c) => c.Name);
    const getTitle = (mo, fieldName) => GetVisibleValue(mo, fieldName);
    collection.forEach((a) => {
        groups
            .reduce((o, g, i) => {
            const groupTitle = getTitle(a, g);
            o[groupTitle] = o[groupTitle] || (i + 1 === groups.length ? [] : {});
            if (Array.isArray(o[groupTitle])) {
                a.$Level = groups.length;
                let title = getTitle(a, groups[0]);
                let parent = grouped[title];
                parent.$Count = (parent.$Count ?? 0) + 1;
                for (let j = 1; j < groups.length - 1; j++) {
                    title = getTitle(a, groups[j]);
                    parent = parent[title];
                    parent.$Count = o[groupTitle].length + 1;
                }
            }
            else {
                const a2 = FindGroup(groupTitle, a);
                o[groupTitle].$Expanded = a2?.$Expanded;
                o[groupTitle].$Visibility = a2?.$Visibility;
            }
            return o[groupTitle];
        }, grouped)
            .push(a);
    });
    return { grouped, groups };
}
function FindGroup(groupTitle, a) {
    if (a.$Group === groupTitle) {
        return a;
    }
    if (a.$Parent) {
        return FindGroup(groupTitle, a.$Parent);
    }
}
function FillAllLayoutControls(item, layoutControls) {
    if (item.xtype === 'Ly.LayoutControl') {
        layoutControls.push(item);
        return;
    }
    if (!item.items?.length) {
        return;
    }
    item.items.forEach((c) => FillAllLayoutControls(c, layoutControls));
}
function FindToolbarItem(toolbarItems, value, prop = 'text') {
    if (!toolbarItems?.length) {
        return null;
    }
    const findInArray = (toolbarItems, value) => {
        let item = null;
        toolbarItems.forEach((c) => {
            if (typeof c === 'object' && !item) {
                if (c[prop] === value) {
                    item = c;
                    return;
                }
                else if (c.menu?.items?.length) {
                    item = findInArray(c.menu.items, value);
                }
            }
        });
        return item;
    };
    return findInArray(toolbarItems, value);
}
function FindLayoutSettingFromLayout94(layout94, layoutTitle) {
    if (!layoutTitle) {
        return null;
    }
    if (layout94.Caption === layoutTitle || layout94.Title === layoutTitle || layout94.ControlId === layoutTitle) {
        return layout94;
    }
    let tempLayout94 = null;
    if (layout94.items?.length) {
        for (let i = 0; i < layout94.items.length; i++) {
            if (!tempLayout94) {
                tempLayout94 = FindLayoutSettingFromLayout94(layout94.items[i], layoutTitle);
            }
        }
    }
    return tempLayout94;
}
function GetAllHorizontalFromLayout94(layout94) {
    const result = [];
    const tempFn = function (layout94, result) {
        if (layout94.Type?.indexOf('Horizontal') > -1) {
            result.push(layout94);
        }
        if (layout94.items?.length) {
            for (let i = 0; i < layout94.items.length; i++) {
                tempFn(layout94.items[i], result);
            }
        }
    };
    tempFn(layout94, result);
    return result;
}
function getGridSettings(context) {
    const gridSetting = BarsaApi.Common.Util.TryGetValue(context, 'Setting.View.GridSetting', null);
    return {
        ColSettingList: gridSetting?.ColSettingList ?? null,
        SortSettingList: gridSetting?.SortSettingList ?? [],
        AutoSizeColumns: gridSetting?.AutoSizeColumns ?? false
    };
}
function getResetGridSettings(columns, context) {
    const colList = columns;
    const settings = getGridSettings(context);
    settings.ColSettingList = colList.map((c) => ({
        IsHidden: c.Hidden,
        Name: c.Name,
        Width: c.Width,
        Caption: c.Caption
    }));
    return settings;
}
function GetDefaultMoObjectInfo(typeDefId) {
    return {
        Id: '0',
        $Caption: '',
        $TypeDefId: typeDefId,
        $State: 'New',
        $Type: 'Common.MetaObjectWeb',
        $FieldDict: {}
    };
}
function getLayout94ObjectInfo() {
    return {
        Type: 'Root',
        ControlId: 'ریشه',
        xtype: 'Ly.LayoutContainer',
        Bounds: { x: 0, y: 0, width: 432, height: 24 },
        items: [
            {
                Type: 'VerticalJoin',
                xtype: 'Ly.LayoutJoin',
                IsVertical: true,
                Bounds: { x: 0, y: 0, width: 432, height: 82 },
                items: []
            }
        ]
    };
}
function getFormSettings(typeDefId) {
    const mo = GetDefaultMoObjectInfo(typeDefId);
    const formPanelSettings = {
        View: {
            Layout94: getLayout94ObjectInfo,
            ControlInfo: [],
            TypeDefId: typeDefId
        },
        IsSearchPanel: true,
        Data: {
            Mo: mo
        }
    };
    return formPanelSettings;
}
function createFormPanelMetaConditions(typeDefId, controlsInfo, controlName, value) {
    const formSettings = getFormSettings(typeDefId);
    formSettings.View.ControlInfo = JSON.parse(JSON.stringify(controlsInfo));
    formSettings.View.Layout94.items[0].items.push(...controlsInfo.map((c) => getLayoutControl(c.ControlName)));
    formSettings.Data.Mo[controlName] = value;
    const formPanelCtrlr = new BarsaApi.Ul.FormPanelCtrlr({
        Setting: formSettings,
        Features: {
            Workflow: false,
            Toolbar: false,
            InfoBar: false
        }
    });
    return formPanelCtrlr;
}
function getNewMoGridEditor(formSettings, typedefId) {
    const newFormSettings = JSON.parse(JSON.stringify(formSettings));
    return { ...newFormSettings.Data.Mo, $TypeDefId: typedefId };
}
function createGridEditorFormPanel(formSettings, mo, typedef, relation, rewriteLayout = true, UlvMainCtrlr = null) {
    let newFormSettings = null;
    if (formSettings) {
        newFormSettings = JSON.parse(JSON.stringify(formSettings));
        if (newFormSettings) {
            newFormSettings.Data.Mo = { ...mo, $TypeDefId: typedef };
            if (rewriteLayout) {
                newFormSettings.View.Layout94 = getLayout94ObjectInfo();
                newFormSettings.View.Layout94.items[0].items.push(...newFormSettings.View.ControlInfo.map((c) => getLayoutControl(c.ControlName, c.ControlFieldCaptionTranslated, false)));
            }
        }
    }
    const formRequestParams = new BarsaApi.Ul.FormRequestParams({
        MoId: !newFormSettings ? mo?.Id : newFormSettings?.Data.Mo.Id,
        TypeDefId: typedef,
        Relation: relation
        // MoContext: {
        //     ReportId: '',
        //     ViewId: '',
        //     ViewName: '',
        //     CondFormating: '',
        //     IncludeInReport: ''
        // }
    });
    const formPanelCtrlr = new BarsaApi.Ul.FormPanelCtrlr({
        Setting: newFormSettings,
        Relation: relation,
        UlvMainCtrlr: UlvMainCtrlr,
        Features: {
            Workflow: false,
            Toolbar: false,
            InfoBar: false
        },
        FormRequestParams: formRequestParams
    });
    return formPanelCtrlr;
}
function getLayoutControl(controlName, controlCaption = '', hide = true) {
    return {
        xtype: 'Ly.LayoutControl',
        Type: 'LayoutControlItem',
        ControlId: controlName,
        IsVertical: false,
        TextLocation: 'Right',
        TextVisible: false,
        Visible: !hide,
        hide,
        UseLayoutItemTextForControl: false,
        Caption: controlCaption,
        AccessibleName: '',
        Bounds: { x: 0, y: 0, width: 432, height: 24 },
        MinSize: { width: 89, height: 24 },
        MaxSize: { width: 0, height: 24 },
        ControlBounds: { width: 388, height: 20 },
        ControlMinSize: { width: 45, height: 20 },
        ControlMaxSize: { width: 0, height: 20 },
        Padding: [2, 2, 2, 2],
        LabelSize: { width: 35, height: 13 },
        originalXtype: ''
    };
}
function getControlList(mo, controlDbNames, isSearchPanel, isGridEditor) {
    return new Promise((resolve, reject) => {
        BarsaApi.Common.Ajax.GetServerData('Form94.GetControlInfos', {
            controlInfoParameter: {
                FieldDbNames: controlDbNames,
                Mo: new BarsaApi.Common.MetaObjectWeb(mo),
                IsSearchPanel: isSearchPanel,
                IsGridEditor: isGridEditor
            }
        }, (m) => {
            resolve(m);
        }, (err) => {
            reject(err);
        });
    });
}
function shallowEqual(objA, objB) {
    if (objA === objB) {
        return true;
    }
    if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
        return false;
    }
    const keysA = Object.keys(objA);
    const keysB = Object.keys(objB);
    if (keysA.length !== keysB.length) {
        return false;
    }
    const bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
    for (let idx = 0; idx < keysA.length; idx++) {
        const key = keysA[idx];
        if (!bHasOwnProperty(key)) {
            return false;
        }
        if (objA[key] !== objB[key]) {
            return false;
        }
    }
    return true;
}
function toNumber(value, fallbackValue = 0) {
    return _isNumberValue(value) ? Number(value) : fallbackValue;
}
function propDecoratorFactory(name, fallback) {
    function propDecorator(target, propName, originalDescriptor) {
        const privatePropName = `$$__zorroPropDecorator__${propName}`;
        if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
            // warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
        }
        Object.defineProperty(target, privatePropName, {
            configurable: true,
            writable: true
        });
        return {
            get() {
                return originalDescriptor && originalDescriptor.get
                    ? originalDescriptor.get.bind(this)()
                    : this[privatePropName];
            },
            set(value) {
                if (originalDescriptor && originalDescriptor.set) {
                    originalDescriptor.set.bind(this)(fallback(value));
                }
                this[privatePropName] = fallback(value);
            }
        };
    }
    return propDecorator;
}
function InputNumber(fallbackValue) {
    return propDecoratorFactory('InputNumber', (value) => toNumber(value, fallbackValue));
}
var AffixRespondEvents;
(function (AffixRespondEvents) {
    AffixRespondEvents["resize"] = "resize";
    AffixRespondEvents["scroll"] = "scroll";
    AffixRespondEvents["touchstart"] = "touchstart";
    AffixRespondEvents["touchmove"] = "touchmove";
    AffixRespondEvents["touchend"] = "touchend";
    AffixRespondEvents["pageshow"] = "pageshow";
    AffixRespondEvents["load"] = "LOAD";
})(AffixRespondEvents || (AffixRespondEvents = {}));
function isTargetWindow(target) {
    return typeof window !== 'undefined' && target === window;
}
function getTargetRect(target) {
    return !isTargetWindow(target)
        ? target.getBoundingClientRect()
        : {
            top: 0,
            left: 0,
            bottom: 0
        };
}
function getFieldValue(name, mo, caption) {
    if (mo.GetFValueByCaption) {
        let result = mo.GetFValue(name);
        if (caption) {
            result = mo.GetFCaption(name);
        }
        if (typeof caption === 'undefined' && mo.InheritanceInfo && !(mo.$FieldDict && mo.$FieldDict[name])) {
            const { ParentFieldName } = mo.InheritanceInfo;
            const moParent = mo.GetFValue(ParentFieldName);
            let result = moParent.GetFValue(name);
            if (caption) {
                result = moParent.GetFCaption(name);
            }
        }
        return result;
    }
    const fieldName = mo.$FieldDict && mo.$FieldDict[name] ? mo.$FieldDict[name] : name;
    let val = mo[fieldName];
    if (caption) {
        let captionVal = mo[fieldName]?.$Caption;
        if (typeof captionVal !== 'string') {
            if (!captionVal) {
                captionVal = mo[fieldName + '$Caption'];
            }
            if (!captionVal) {
                captionVal = val;
            }
        }
        val = captionVal;
    }
    return val;
}
const availablePrefixes = ['moz', 'ms', 'webkit'];
function requestAnimationFramePolyfill() {
    let lastTime = 0;
    return function (callback) {
        const currTime = new Date().getTime();
        const timeToCall = Math.max(0, 16 - (currTime - lastTime));
        const id = setTimeout(() => {
            callback(currTime + timeToCall);
        }, timeToCall);
        lastTime = currTime + timeToCall;
        return id;
    };
}
function ExecuteDynamicCommand(command, mo = null) {
    const e = { command, DynamicSetting: mo, Mo: mo };
    BarsaApi.Common.CustomCodeManager.RunDynamicCommand(command.Id, e);
}
function ExecuteWorkflowChoiceDef(scope, param, success, failed) {
    BarsaApi.Common.Ajax.GetServerData('Workflow94.ChoiceSelect', param, (result) => {
        success(result);
    }, // success
    (error) => {
        failed(error);
    }, //  error
    () => { }, // doReturn
    scope, true);
}
function getRequestAnimationFrame() {
    if (typeof window === 'undefined') {
        return () => 0;
    }
    if (window.requestAnimationFrame) {
        // https://github.com/vuejs/vue/issues/4465
        return window.requestAnimationFrame.bind(window);
    }
    const prefix = availablePrefixes.filter((key) => `${key}RequestAnimationFrame` in window)[0];
    return prefix ? window[`${prefix}RequestAnimationFrame`] : requestAnimationFramePolyfill();
}
function cancelRequestAnimationFrame(id) {
    if (typeof window === 'undefined') {
        return null;
    }
    if (window.cancelAnimationFrame) {
        return window.cancelAnimationFrame(id);
    }
    const prefix = availablePrefixes.filter((key) => `${key}CancelAnimationFrame` in window || `${key}CancelRequestAnimationFrame` in window)[0];
    return prefix
        ? (window[`${prefix}CancelAnimationFrame`] ||
            window[`${prefix}CancelRequestAnimationFrame`])
            // @ts-ignore
            .call(this, id)
        : clearTimeout(id);
}
function easeInOutCubic(t, b, c, d) {
    const cc = c - b;
    let tt = t / (d / 2);
    if (tt < 1) {
        return (cc / 2) * tt * tt * tt + b;
    }
    else {
        return (cc / 2) * ((tt -= 2) * tt * tt + 2) + b;
    }
}
const WordMimeType = '.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document';
const ImageMimeType = '.jpeg,.jpg,.gif,.png,.bmp,.tif,image/*';
const PdfMimeType = '.pdf';
const AllFilesMimeType = '.txt,.ppt,.pdf,.*';
const VideoMimeType = 'video/*';
const AudioMimeType = 'audio/*';
const MimeTypes = {
    // اسناد متنی و وب
    html: 'text/html',
    htm: 'text/html',
    txt: 'text/plain',
    text: 'text/plain',
    log: 'text/plain',
    conf: 'text/plain',
    css: 'text/css',
    js: 'application/javascript',
    json: 'application/json',
    xml: 'application/xml',
    // تصاویر
    jpg: 'image/jpeg',
    jpeg: 'image/jpeg',
    png: 'image/png',
    gif: 'image/gif',
    svg: 'image/svg+xml',
    webp: 'image/webp',
    bmp: 'image/bmp',
    ico: 'image/x-icon',
    // اسناد کاربردی
    pdf: 'application/pdf',
    rtf: 'application/rtf',
    // مایکروسافت آفیس
    doc: 'application/msword',
    docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    xls: 'application/vnd.ms-excel',
    xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
    ppt: 'application/vnd.ms-powerpoint',
    pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
    // چندرسانه‌ای (صوت و ویدیو)
    mp4: 'video/mp4',
    webm: 'video/webm',
    ogg: 'video/ogg',
    mp3: 'audio/mpeg',
    wav: 'audio/wav'
};
function GetContentType(fileName) {
    const ext = fileName.substring(fileName.lastIndexOf('.')).toLowerCase();
    return MimeTypes[ext] || 'application/octet-stream';
}
function GetViewableExtensions() {
    return Object.keys(MimeTypes);
}
function ChangeLayoutInfoCustomUi(layoutInfo, componentUi) {
    layoutInfo.FieldUi.Setting.CustomUi = componentUi;
}
const mobile_regex = new RegExp('^(\\+98|0)?9\\d{9}$');
const number_only = new RegExp('^[0-9]+$');
function forbiddenValidator(nameRe) {
    return (control) => {
        const forbidden = nameRe.test(control.value);
        return !forbidden ? { forbiddenName: { value: control.value } } : null;
    };
}
function GetImgTags(setting) {
    let str = '';
    for (let i = 0; i < setting.sources.length; i++) {
        str +=
            "<img src='" +
                setting.sources[i] +
                "'  class='" +
                getCenter(setting.isCenter) +
                "'  style='" +
                setting.customCss +
                "' /> ";
    }
    return str;
}
function ImagetoPrint(setting) {
    return ('<html><head>' +
        '<script src="/Lib/scripts/jquery-x.min.js"></script><script src="Lib/ImagePrint/ImagePrintInternal.js"></script>' +
        '</head><body style="margin : 0 1 0 1">' +
        GetImgTags(setting) +
        '</body></html>');
}
function PrintImage(setting) {
    let pageLink = 'about:blank';
    let pwa = window.open(pageLink, '_new');
    pwa?.document.open();
    let imageToPrint = ImagetoPrint(setting);
    pwa?.document.write(imageToPrint);
    pwa?.document.close();
}
function getCenter(isCenter) {
    if (isCenter)
        return 'center';
    return '';
}
function SaveImageToFile(name, src) {
    const t = getUniqueId(4);
    var link = document.createElement('a');
    link.href = src;
    link.download = name ? name.split('.')[0] : '';
    document.body.appendChild(link);
    link.click();
    setTimeout(function () {
        link.parentNode?.removeChild(link);
    }, 10);
}
function validateAllFormFields(formGroup) {
    //{1}
    Object.keys(formGroup.controls).forEach((field) => {
        //{2}
        const control = formGroup.get(field); //{3}
        if (control instanceof FormControl) {
            //{4}
            control.markAsTouched({ onlySelf: true });
        }
        else if (control instanceof FormGroup) {
            //{5}
            validateAllFormFields(control); //{6}
        }
    });
}
function getFocusableTagNames() {
    return `button,button:not([disabled]),[href],input:not([disabled]),input,
                select,select:not([disabled]),textarea,textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;
}
function addCssVariableToRoot(variableName, variableValue) {
    const root = document.documentElement;
    root.style.setProperty(variableName, variableValue);
}
function flattenTree(root, prop) {
    const result = [];
    function traverse(node) {
        result.push(node);
        if (node[prop]) {
            node[prop].forEach(traverse);
        }
    }
    traverse(root);
    return result;
}
function IsDarkMode() {
    const x = document.documentElement.getAttribute('data-mode')?.includes('dark') || false;
    return x || Array.from(document.body.classList).some((className) => className.toLowerCase().includes('dark'));
}
function nullOrUndefinedString(param) {
    return `${param} can not be null or undefined.`;
}
function fromEntries(entries) {
    const result = {};
    for (const [key, value] of entries) {
        result[key] = value;
    }
    return result;
}
function bodyClick(document, el) {
    document?.body?.click();
    el.nativeElement.blur();
}
function removeDynamicStyle(style) {
    if (!style) {
        return;
    }
    const head = document.head || document.getElementsByTagName('head')[0];
    head.removeChild(style);
}
function addDynamicVariableTo(cssVariableName, cssVariableValue, id = ':root') {
    if (!cssVariableName) {
        return null;
    }
    const head = document.head || document.getElementsByTagName('head')[0];
    const style = document.createElement('style');
    head.appendChild(style);
    const cssStyles = `${id}{${cssVariableName}:${cssVariableValue}}`;
    style.type = 'text/css';
    if (style.styleSheet) {
        // This is required for IE8 and below.
        style.styleSheet.cssText = `${id}{${cssVariableName}:${cssVariableValue}}`;
    }
    else {
        style.appendChild(document.createTextNode(cssStyles));
    }
    return style;
}
function AddDynamicFormStyles(id, cssStyles) {
    if (!cssStyles) {
        return null;
    }
    cssStyles = cssStyles.replace(/:root/gi, `#${id}`);
    cssStyles = cssStyles.replace(/:html/gi, `:root`);
    const head = document.head || document.getElementsByTagName('head')[0];
    const style = document.createElement('style');
    head.appendChild(style);
    style.type = 'text/css';
    if (style.styleSheet) {
        // This is required for IE8 and below.
        style.styleSheet.cssText = cssStyles;
    }
    else {
        style.appendChild(document.createTextNode(cssStyles));
    }
    return style;
}
function RemoveDynamicFormStyles(style) {
    if (!style) {
        return;
    }
    const head = document.head || document.getElementsByTagName('head')[0];
    head.removeChild(style);
}

class MoReportValuePipe {
    transform(name, mo, Columns, caption) {
        return getColumnValueOfMoDataList(name, mo, Columns, caption);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoReportValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: MoReportValuePipe, isStandalone: false, name: "rval" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoReportValuePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'rval',
                    standalone: false
                }]
        }] });

class NumeralPipe {
    transform(value, decimalPrecision, showThousandSeperator) {
        if (value === '') {
            return value;
        }
        if (!value) {
            return '';
        }
        decimalPrecision = Number(decimalPrecision);
        const newVal = value.toString().replace(/,/g, '');
        if (typeof decimalPrecision === 'number' && decimalPrecision > 0) {
            const x = this._getReturnaValue(newVal, decimalPrecision);
            if (showThousandSeperator) {
                return x;
            }
            const reg = new RegExp(',', 'g');
            const v = x.replace(reg, '');
            return v;
        }
        else if (!showThousandSeperator) {
            return value;
        }
        return this._getReturnaValue(newVal, 0);
    }
    _getReturnaValue(newVal, decimal) {
        return newVal === '-' ? '-' : new BigNumber(newVal).toFormat(decimal);
    }
    floor(num, precision) {
        const factor = Math.pow(10, precision);
        const tempNumber = num * factor;
        const roundedTempNumber = Math.floor(tempNumber);
        return roundedTempNumber / factor;
    }
    getValue(value) {
        const newVal = value.toString().replace(/,/g, '');
        return newVal;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NumeralPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: NumeralPipe, isStandalone: false, name: "numeral" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NumeralPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'numeral',
                    standalone: false
                }]
        }] });

class GroupByPipe {
    resolveValue(current, property, $Caption = false, dot$Caption = false) {
        const isDate = current[property] instanceof Date;
        if (isDate) {
            return current[property + '$Caption'].split(' ')[0];
        }
        if ($Caption) {
            return current[property + '$Caption'];
        }
        if (dot$Caption) {
            return current[property].$Caption;
        }
        return current[property];
    }
    transform(collection, property) {
        // prevents the application from breaking if the array of objects doesn't exist yet
        if (!collection?.length) {
            return [];
        }
        const resolveValue = this.resolveValue;
        const first = collection[0];
        if (!(first[property] instanceof Date) && resolveValue(first, property, true)) {
            property = property + '$Caption';
        }
        const groupedCollection = collection.reduce((previous, current) => {
            if (typeof resolveValue(current, property) === 'object' && resolveValue(current, property, false, true)) {
                if (!previous[resolveValue(current, property, false, true)]) {
                    previous[resolveValue(current, property, false, true)] = [current];
                }
                else {
                    previous[resolveValue(current, property, false, true)].push(current);
                }
            }
            else {
                if (!previous[resolveValue(current, property)]) {
                    previous[resolveValue(current, property)] = [current];
                }
                else {
                    previous[resolveValue(current, property)].push(current);
                }
            }
            return previous;
        }, {});
        // this will return an array of objects, each object containing a group of objects
        return Object.keys(groupedCollection).map((key) => ({
            id: getUniqueId(2),
            key,
            value: groupedCollection[key]
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GroupByPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: GroupByPipe, isStandalone: false, name: "groupBy" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GroupByPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'groupBy',
                    standalone: false
                }]
        }] });

class BbbTranslatePipe {
    transform(key, addText) {
        if (!key) {
            return '';
        }
        if (!key.replace) {
            return key;
        }
        let result = BarsaApi.BBB[key];
        if (!result) {
            const tKey = key.trimStart().trimEnd();
            result = BarsaApi.BBB[tKey] ?? key;
        }
        if (addText) {
            result += ' ' + this.transform(addText);
        }
        return result;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BbbTranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: BbbTranslatePipe, isStandalone: false, name: "bbbTranslate" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BbbTranslatePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'bbbTranslate',
                    standalone: false
                }]
        }] });

class ContextMenuPipe {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this.bbbPipe = inject(BbbTranslatePipe);
    }
    transform(commands, checkList = false) {
        if (!commands) {
            return [];
        }
        return commands.filter((c) => {
            const isObject = typeof c === 'object';
            if (!isObject) {
                return false;
            }
            const EditText = this.bbbPipe.transform('Edit');
            if (c.text === EditText && c.Command?.IsBuiltin) {
                return false;
            }
            const DeleteText = this.bbbPipe.transform('Delete');
            if (checkList && c.text === DeleteText && c.Command?.IsBuiltin) {
                return false;
            }
            if (c.Command._isVisible === false) {
                return false;
            }
            return true;
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ContextMenuPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ContextMenuPipe, isStandalone: false, name: "contextMenu" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ContextMenuPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'contextMenu',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class HeaderFacetValuePipe {
    constructor() { }
    transform(value, type) {
        if (!type) {
            return getHeaderValue(value);
        }
        // rating-indicator && progress-indicator
        return Number(value.Value);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HeaderFacetValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: HeaderFacetValuePipe, isStandalone: false, name: "facetValue" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HeaderFacetValuePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'facetValue',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class SeperatorFixPipe {
    transform(buttons, removeSeperator = false) {
        if (Array.isArray(buttons)) {
            buttons?.forEach((c, i) => {
                if (typeof c === 'string') {
                    buttons[i] = { text: '', type: 'seperator' };
                }
            });
        }
        return !removeSeperator ? buttons : buttons.filter((c) => typeof c === 'object' && c.cls);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SeperatorFixPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: SeperatorFixPipe, isStandalone: false, name: "seperatorFix" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SeperatorFixPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'seperatorFix',
                    standalone: false
                }]
        }] });

class ConvertToStylePipe {
    constructor() { }
    transform(text) {
        if (text) {
            const style = text.replace(/\r?\n|\r/g, '');
            const styles = style.split(';');
            styles.splice(styles.length - 1, 1);
            let styleString = '{';
            styles.forEach((element, index) => {
                const keyVal = element.split(':');
                styleString += `"${keyVal[0]}":"${keyVal[1]}"`;
                if (index < styles.length - 1) {
                    styleString += `,`;
                }
            });
            styleString += '}';
            return JSON.parse(styleString);
        }
        return {};
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ConvertToStylePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ConvertToStylePipe, isStandalone: false, name: "convertToStyle" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ConvertToStylePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'convertToStyle',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class TlbButtonsPipe {
    constructor() { }
    transform(buttons, property, value, hideMoveButtons = false) {
        if (!buttons) {
            return [];
        }
        let lastIsString = false;
        const btns = buttons.filter((btn) => {
            let filter = false;
            if (typeof btn === 'string') {
                if (lastIsString) {
                    filter = false;
                }
                else {
                    filter = true;
                    lastIsString = true;
                }
            }
            else if (typeof property === 'string') {
                filter = this.filterBtn(btn, property, value, hideMoveButtons);
                if (lastIsString && filter) {
                    lastIsString = false;
                }
            }
            else if (Array.isArray(property)) {
                property.forEach((prop, i) => {
                    if (!filter) {
                        filter = this.filterBtn(btn, prop, value[i], hideMoveButtons);
                    }
                });
                if (filter && lastIsString) {
                    lastIsString = false;
                }
            }
            return filter;
        });
        return btns.length && typeof btns[0] === 'string' ? btns.filter((_c, index) => index > 0) : btns;
    }
    filterBtn(btn, property, value, hideMoveButtons) {
        const val = BarsaApi.Common.Util.TryGetValue(btn, property);
        if (hideMoveButtons) {
            const itemId = BarsaApi.Common.Util.TryGetValue(btn, 'itemId');
            if (itemId === 'MoveNext' || itemId === 'MovePrev') {
                return false;
            }
        }
        if ((val === null && (typeof value === 'undefined' || value === null)) ||
            (val === null && typeof value === typeof false && !value)) {
            return !btn.hidden && !btn.Command?.hide;
        }
        return value === val && !btn.hidden && !btn.Command?.hide;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TlbButtonsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: TlbButtonsPipe, isStandalone: false, name: "tlbButtons" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TlbButtonsPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'tlbButtons',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class RemoveNewlinePipe {
    constructor() { }
    transform(text) {
        if (text) {
            return text.replace(/\r?\n|\r/g, '');
        }
        return text;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RemoveNewlinePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: RemoveNewlinePipe, isStandalone: false, name: "removeNewline" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RemoveNewlinePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'removeNewline',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class MoValuePipe {
    constructor() { }
    transform(name, mo, caption) {
        return getFieldValue(name, mo, caption);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: MoValuePipe, isStandalone: false, name: "val" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoValuePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'val',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class FilterPipe {
    transform(collection, filterArgs) {
        if (!collection || !filterArgs) {
            return [];
        }
        return collection.filter((val) => this.matchFilter(val, filterArgs));
    }
    matchFilter(value, fitlerArgs) {
        const match = Object.keys(fitlerArgs).some((key) => {
            const filterValue = fitlerArgs[key];
            if (typeof filterValue === typeof true && !filterValue) {
                const val = BarsaApi.Common.Util.TryGetValue(value, key);
                return !val;
            }
            else {
                return BarsaApi.Common.Util.TryGetValue(value, key) === filterValue;
            }
        });
        return match;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FilterPipe, isStandalone: false, name: "filter" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filter',
                    standalone: false
                }]
        }] });

class FilterTabPipe {
    transform(collection) {
        if (!collection) {
            return [];
        }
        return collection.filter((val) => val.Visible !== false);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterTabPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FilterTabPipe, isStandalone: false, name: "filterTab" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterTabPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filterTab',
                    standalone: false
                }]
        }] });

class MoReportValueConcatPipe {
    constructor() { }
    transform(names, symbol, mo, Columns) {
        let result = '';
        names.forEach((name, i) => {
            const fieldName = Columns ? Columns.find((c) => c.Name === name || c.Alias === name)?.Name : name;
            if (i > 0) {
                result += symbol;
            }
            const caption = mo[fieldName]?.$Caption;
            const caption1 = mo[fieldName + '$Caption'];
            if (caption) {
                result += caption;
            }
            else if (caption1) {
                result += caption1;
            }
            else {
                result += mo[fieldName];
            }
        });
        return result;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoReportValueConcatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: MoReportValueConcatPipe, isStandalone: false, name: "rvalConcat" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoReportValueConcatPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'rvalConcat',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class FilterStringPipe {
    transform(collection, filterArgs) {
        if (!collection || !filterArgs) {
            return [];
        }
        return collection.filter((val) => this.matchFilter(val, filterArgs));
    }
    matchFilter(value, filterArgs) {
        const match = Object.keys(filterArgs).some((key) => {
            const filterVal = filterArgs[key];
            if (!filterVal) {
                return true;
            }
            const val = BarsaApi.Common.Util.TryGetValue(value, key);
            if (!val) {
                return false;
            }
            switch (filterArgs.mode) {
                case 'contains':
                    return val.indexOf(filterVal) > -1;
                case 'equals':
                    return val === filterVal;
                case 'startWith':
                    return val.startsWith(filterVal);
                case 'endWith':
                    return val.endsWith(filterVal);
            }
            return false;
        });
        return match;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FilterStringPipe, isStandalone: false, name: "filterStr" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterStringPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filterStr',
                    standalone: false
                }]
        }] });

class SortPipe {
    transform(value, sortOrder = 'asc', sortKey) {
        sortOrder = sortOrder && sortOrder.toLowerCase();
        if (!value || (sortOrder !== 'asc' && sortOrder !== 'desc')) {
            return value;
        }
        let numberArray = [];
        let stringArray = [];
        if (!sortKey) {
            numberArray = value.filter((item) => typeof item === 'number').sort();
            stringArray = value.filter((item) => typeof item === 'string').sort();
        }
        else {
            numberArray = value
                .filter((item) => typeof item[sortKey] === 'number')
                .sort((a, b) => a[sortKey] - b[sortKey]);
            stringArray = value
                .filter((item) => typeof item[sortKey] === 'string')
                .sort((a, b) => {
                if (a[sortKey] < b[sortKey]) {
                    return -1;
                }
                else if (a[sortKey] > b[sortKey]) {
                    return 1;
                }
                else {
                    return 0;
                }
            });
        }
        const sorted = numberArray.concat(stringArray);
        return sortOrder === 'asc' ? sorted : sorted.reverse();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: SortPipe, isStandalone: false, name: "sort" }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SortPipe }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SortPipe, decorators: [{
            type: Injectable
        }, {
            type: Pipe,
            args: [{
                    name: 'sort',
                    standalone: false
                }]
        }] });

class BarsaIconDictPipe {
    constructor() { }
    transform(type, size = '128') {
        const sizeField = size === '128' ? 'FileIconDict128' : 'FileIconDict16';
        return BarsaApi.Common.File[sizeField][type];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaIconDictPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: BarsaIconDictPipe, isStandalone: false, name: "barsaIconDict" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaIconDictPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'barsaIconDict',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class FileInfoCountPipe {
    constructor() { }
    transform(value) {
        if (!value || !value.Files) {
            return 0;
        }
        return value.Files.filter((c) => !c.IsDeleted).length;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FileInfoCountPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FileInfoCountPipe, isStandalone: false, name: "fileinfoCount" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FileInfoCountPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'fileinfoCount',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class ControlUiPipe {
    transform(caption, layout94, columnName) {
        return this.findLayoutItem(caption, layout94, columnName);
    }
    findLayoutItem(caption, layoutItem, columnName) {
        if (!layoutItem) {
            return null;
        }
        if (layoutItem.Caption === caption || (columnName && layoutItem.ControlId === columnName)) {
            return layoutItem;
        }
        let finded = null;
        layoutItem.items?.forEach((childItem) => {
            if (!finded) {
                finded = this.findLayoutItem(caption, childItem, columnName);
            }
        });
        return finded;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ControlUiPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ControlUiPipe, isStandalone: false, name: "controlUi" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ControlUiPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'controlUi',
                    standalone: false
                }]
        }] });

class VisibleValuePipe {
    constructor() { }
    transform(object, field) {
        return GetVisibleValue(object, field);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: VisibleValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: VisibleValuePipe, isStandalone: false, name: "barsaVisibleValue" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: VisibleValuePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'barsaVisibleValue',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class FilterToolbarControlPipe {
    transform(config) {
        return config.items.filter((c) => c.xtype !== 'Ly.LayoutControl' || (c.xtype === 'Ly.LayoutControl' && c.FieldUi)); // filter toolbar button.fieldui is undefined in toolbar layout control.
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterToolbarControlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FilterToolbarControlPipe, isStandalone: false, name: "filterToolbarControl" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterToolbarControlPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filterToolbarControl',
                    standalone: false
                }]
        }] });

class MultipleGroupByPipe {
    constructor() {
        this.bbbPipe = inject(BbbTranslatePipe);
    }
    transform(collection, sortSettings) {
        if (sortSettings.length === 0) {
            collection.forEach((c) => {
                delete c.$Parent;
            });
            return collection;
        }
        const { grouped, groups } = GroupBy(collection, sortSettings);
        const arr = [];
        this.prepareArr(arr, null, grouped, groups.length, 0);
        return arr;
    }
    findGroup(groupTitle, a) {
        if (a.$Group === groupTitle) {
            return a;
        }
        if (a.$Parent) {
            return this.findGroup(groupTitle, a.$Parent);
        }
    }
    prepareArr(arr, parent, item, maxlevel, level) {
        const keys = Object.keys(item);
        item.$Level = level;
        keys.forEach((key) => {
            if (key !== '$Count' &&
                key !== '$Level' &&
                key !== '$Parent' &&
                key !== '$Expanded' &&
                key !== '$Visibility') {
                const row = item[key];
                const newRow = {
                    $Group: !key ? (!parent ? this.bbbPipe.transform('Empty_Bracket') : key) : key,
                    $Level: level,
                    $Count: row.$Count,
                    $Expanded: row.$Expanded === false || parent?.$Expanded === false ? false : true,
                    $Parent: parent,
                    $Children: [],
                    $Visibility: row.$Visibility === false || parent?.$Visibility === false ? false : true
                };
                if (newRow.$Parent) {
                    if (newRow.$Parent?.$Children) {
                        newRow.$Parent.$Children.push(newRow);
                    }
                    else {
                        newRow.$Parent.$Children = [newRow];
                    }
                }
                if (Array.isArray(row)) {
                    if (row.length) {
                        newRow.$Expanded =
                            newRow.$Expanded === false || row[0].$Parent?.$Expanded === false ? false : true;
                    }
                    arr.push(newRow);
                    row.forEach((c, i) => {
                        c.$Parent = newRow;
                        c.$Visibility = true;
                        c.$IsLastChildGroup = i === row.length - 1;
                        newRow.$Children.push(c);
                    });
                    arr.push(...row);
                }
                else {
                    arr.push(newRow);
                    if (level < maxlevel) {
                        this.prepareArr(arr, newRow, row, maxlevel, level + 1);
                    }
                }
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MultipleGroupByPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: MultipleGroupByPipe, isStandalone: false, name: "multipleGroupBy" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MultipleGroupByPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'multipleGroupBy',
                    standalone: false
                }]
        }] });

class PictureFieldSourcePipe {
    constructor() { }
    transform(value, type, moId, fieldDefId, sw, sh) {
        if (typeof value === 'object') {
            value = value?.FileId;
        }
        const url = getImagePath(type, moId, value, fieldDefId, sw, sh);
        return url;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PictureFieldSourcePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: PictureFieldSourcePipe, isStandalone: false, name: "picFieldSrc" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PictureFieldSourcePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'picFieldSrc',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class FioriIconPipe {
    transform(value, defaultIcon) {
        if (!value) {
            return defaultIcon;
        }
        switch (value) {
            case 'New':
                return 'add';
            case 'Edit':
                return 'edit';
            case 'Delete':
                return 'delete';
            case 'MoveUp':
                return 'arrow-top';
            case 'MoveDown':
                return 'arrow-bottom';
            case 'RefreshReport':
                return 'refresh';
            case 'AddToList':
                return 'chain-link';
            case 'RemoveFromList':
                return 'broken-link';
            case 'ExportToExcel':
                return 'broken-link';
            case 'WorkflowHistory':
                return 'work-history';
            default:
                return defaultIcon;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FioriIconPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FioriIconPipe, isStandalone: false, name: "fioriIcon" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FioriIconPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'fioriIcon',
                    standalone: false
                }]
        }] });

class CanUploadFilePipe {
    constructor() { }
    transform(fileCount, maxFileCount = 1, disable = false, readonly = false
    // fileCount: number
    ) {
        let canUpload = true;
        if (disable || readonly) {
            canUpload = false;
        }
        if (maxFileCount !== 0 && fileCount && maxFileCount <= fileCount) {
            canUpload = false;
        }
        return canUpload;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CanUploadFilePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: CanUploadFilePipe, isStandalone: false, name: "canUploadFile" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CanUploadFilePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'canUploadFile',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class ListCountPipe {
    constructor() { }
    transform(list) {
        return list.length;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ListCountPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ListCountPipe, isStandalone: false, name: "listCount" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ListCountPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'listCount',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class TotalSummaryPipe {
    transform(moDataList, columnName) {
        return moDataList.reduce((curr, prev, currIndex) => currIndex === 0 ? Number(prev[columnName]) : curr + Number(prev[columnName]), 0);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TotalSummaryPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: TotalSummaryPipe, isStandalone: false, name: "totalSummary" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TotalSummaryPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'totalSummary',
                    standalone: false
                }]
        }] });

class MergeFieldsToColumnsPipe {
    transform(columns, mergeColumnMoDataList) {
        if (!mergeColumnMoDataList || !mergeColumnMoDataList.length) {
            return columns;
        }
        return this._mergeFieldsToColumns(columns, mergeColumnMoDataList);
    }
    _mergeFieldsToColumns(columns, mergeColumnMoDataList) {
        let mergeFieldsToColumns;
        if (mergeColumnMoDataList) {
            mergeFieldsToColumns = {};
            mergeColumnMoDataList
                .map((c) => c)
                .forEach((c) => (mergeFieldsToColumns[c.ColumnName] = mergeFieldsToColumns[c.ColumnName]
                ? [...mergeFieldsToColumns[c.ColumnName], c.FieldCaption]
                : [c.FieldCaption]));
        }
        if (mergeFieldsToColumns) {
            columns.forEach((c) => {
                const columnMerged = mergeFieldsToColumns[c.Alias];
                if (columnMerged) {
                    c.$MergedFieldsToColumn = columnMerged;
                }
            });
        }
        return columns;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MergeFieldsToColumnsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: MergeFieldsToColumnsPipe, isStandalone: false, name: "mergeFieldsToColumns" }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MergeFieldsToColumnsPipe }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MergeFieldsToColumnsPipe, decorators: [{
            type: Injectable
        }, {
            type: Pipe,
            args: [{
                    name: 'mergeFieldsToColumns',
                    standalone: false
                }]
        }] });

class FindColumnByDbNamePipe {
    transform(columns, name, secondaryColumns = []) {
        return this.findColumn(columns, name, secondaryColumns);
    }
    findColumn(columns, column, secondaryColumns) {
        let columnFound = this._findColumn(columns, column);
        if (!columnFound && secondaryColumns.length) {
            columnFound = this._findColumn(secondaryColumns, column);
        }
        return columnFound;
    }
    _findColumn(columns, name) {
        return columns.find((column) => column.Name === name || column.Caption === name || column.Alias === name);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FindColumnByDbNamePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FindColumnByDbNamePipe, isStandalone: false, name: "findColumnByDbName" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FindColumnByDbNamePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'findColumnByDbName',
                    pure: true,
                    standalone: false
                }]
        }] });

class FilterColumnsByDetailsPipe {
    transform(columns, detailsColumns, rowIndicator) {
        if (!columns?.length) {
            return columns;
        }
        const x = columns.filter((column, i) => (rowIndicator ? i > 0 : true) &&
            detailsColumns.map((c) => c.Caption).indexOf(column.Caption) === -1 &&
            detailsColumns.map((c) => c.Name).indexOf(column.Name) === -1);
        return x;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterColumnsByDetailsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FilterColumnsByDetailsPipe, isStandalone: false, name: "filterColumnsByDetails" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterColumnsByDetailsPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filterColumnsByDetails',
                    standalone: false
                }]
        }] });

class MoInfoUlvPagingPipe {
    transform(ulvAdapterPaging, ulvUiPaging) {
        return ulvAdapterPaging ? ulvAdapterPaging : ulvUiPaging;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoInfoUlvPagingPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: MoInfoUlvPagingPipe, isStandalone: false, name: "moInfoUlvPaging" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoInfoUlvPagingPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'moInfoUlvPaging',
                    standalone: false
                }]
        }] });

class MoInfoUlvMoListPipe {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this._moInfoUlvPaging = inject(MoInfoUlvPagingPipe);
    }
    transform(loading, isDataLoadedFirstTime, ulvAdapterMoDataList, ulvUiMoDataList, ulvAdapterPaging, ulvUiPaging) {
        const result = loading && !isDataLoadedFirstTime
            ? [{ Id: '-1', $Caption: '', $isLoading: true }]
            : ulvAdapterMoDataList
                ? ulvAdapterMoDataList?.length === 0
                    ? [{ Id: '-1', $Caption: '', isEmpty: true }]
                    : ulvAdapterMoDataList
                : ulvUiMoDataList
                    ? ulvUiMoDataList
                    : [];
        if (result.length > 0) {
            const paging = ulvAdapterPaging ? ulvAdapterPaging : ulvUiPaging;
            result.forEach((c) => {
                c.$__Index = undefined;
                c.$__IsFirst = undefined;
                c.$__IsLast = undefined;
            });
            result.forEach((c, index) => {
                c.$__Index = index;
                if (index === 0) {
                    c.$__IsFirst = true;
                    c.$IsChecked = true;
                }
                if (index === result.length - 1) {
                    c.$__IsLast = true;
                }
            });
            if (paging?.HasPaging) {
                // if (paging.Page + 1 < paging.TotalPages) {
                if (!result[result.length - 1].$LoadMore) {
                    result.push({ $Caption: 'More', $LoadMore: true, Id: '-1' });
                }
                // } else {
                //     if (result[result.length - 1].$LoadMore) {
                //         result.splice(result.length - 1, 1);
                //     }
                // }
            }
        }
        return result;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoInfoUlvMoListPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: MoInfoUlvMoListPipe, isStandalone: false, name: "moInfoUlvMoList" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MoInfoUlvMoListPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'moInfoUlvMoList',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class ReversePipe {
    transform(value, doReverse = true) {
        if (!doReverse) {
            return value;
        }
        if (!value) {
            return [];
        }
        return value.reverse();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReversePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ReversePipe, isStandalone: false, name: "reverse" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReversePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'reverse',
                    standalone: false
                }]
        }] });

class ColumnCustomUiPipe {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this._findColumnByDbNamePipe = inject(FindColumnByDbNamePipe);
    }
    transform(column, columnComponents) {
        if (!columnComponents) {
            return null;
        }
        let component = null;
        columnComponents.MoDataList.forEach((c) => {
            if (!component) {
                const columnItem = this._findColumnByDbNamePipe.transform([column], c.Title);
                if (columnItem) {
                    component = c.Component;
                }
            }
        });
        return component;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnCustomUiPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ColumnCustomUiPipe, isStandalone: false, name: "columnCustomUi" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnCustomUiPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'columnCustomUi',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class SanitizeTextPipe {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this._domSanitizer = inject(DomSanitizer);
    }
    transform(text) {
        return this._domSanitizer.bypassSecurityTrustHtml(text);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SanitizeTextPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: SanitizeTextPipe, isStandalone: false, name: "sanitizeText" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SanitizeTextPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'sanitizeText',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class ColumnCustomComponentPipe {
    transform(columns, customComponentMoDataList) {
        if (!customComponentMoDataList || !customComponentMoDataList.length) {
            return columns;
        }
        return this._setCustomComponentToColumns(columns, customComponentMoDataList);
    }
    _setCustomComponentToColumns(columns, customComponentMoDataList) {
        let allCustomComponents;
        if (customComponentMoDataList) {
            allCustomComponents = {};
            customComponentMoDataList
                .map((c) => c)
                .forEach((c) => (allCustomComponents[c.Title] = { ...c, ...c.Component }));
        }
        if (allCustomComponents) {
            columns.forEach((c) => {
                const customComponent = allCustomComponents[c.Alias];
                if (customComponent) {
                    c.$CustomComponent = customComponent;
                }
            });
        }
        return columns;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnCustomComponentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ColumnCustomComponentPipe, isStandalone: false, name: "columnCustomComponent" }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnCustomComponentPipe }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnCustomComponentPipe, decorators: [{
            type: Injectable
        }, {
            type: Pipe,
            args: [{
                    name: 'columnCustomComponent',
                    standalone: false
                }]
        }] });

class ColumnValuePipe {
    transform(column, mo) {
        const colName = column.Name;
        const data = mo[colName];
        let caption = mo[colName + '$Caption'];
        if (typeof data === 'object' && data) {
            if (data.$Caption) {
                caption = data.$Caption;
            }
            if (column.FieldTypeId.toString() === '6' && column.Tag === 'Image') {
                // Column is enum with image
                caption = '';
            }
        }
        if (!caption && typeof data !== 'object') {
            caption = data;
        }
        if (column.OnlyImage || (column.FieldTypeId.toString() === '6' && column.Tag === 'Image')) {
            caption = '';
        }
        return caption || '';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ColumnValuePipe, isStandalone: false, name: "columnValue" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnValuePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'columnValue',
                    standalone: false
                }]
        }] });

class ColumnIconPipe {
    transform(column, mo) {
        const colName = column.Name;
        const data = mo[colName];
        let icon = mo[colName + '$Icon'];
        if (typeof data === 'object' && data) {
            icon = data.$Icon;
        }
        return icon;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnIconPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ColumnIconPipe, isStandalone: false, name: "columnIcon" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnIconPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'columnIcon',
                    standalone: false
                }]
        }] });

class RowNumberPipe {
    transform(moId, setting, moDataList) {
        if (!moId) {
            return;
        }
        const rowIndex = moDataList.findIndex((c) => c.Id === moId);
        const firstRow = BarsaApi.Common.Util.TryGetValue(setting, 'StartIndex', 0);
        return rowIndex + Number(firstRow) + 1;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RowNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: RowNumberPipe, isStandalone: false, name: "rowNumber" }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RowNumberPipe }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RowNumberPipe, decorators: [{
            type: Injectable
        }, {
            type: Pipe,
            args: [{
                    name: 'rowNumber',
                    standalone: false
                }]
        }] });

class ComboRowImagePipe {
    transform(value, data) {
        return data.find((c) => c.id === value).url;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ComboRowImagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ComboRowImagePipe, isStandalone: false, name: "comboRowImg" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ComboRowImagePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'comboRowImg',
                    standalone: false
                }]
        }] });

class IsExpandedNodePipe {
    transform(value) {
        return this._isExpanded(value);
    }
    _isExpanded(value) {
        if (!value || !value.isExpand) {
            return false;
        }
        if (value.isExpand && !value.parentNode) {
            return true;
        }
        return this._isExpanded(value.parentNode);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IsExpandedNodePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: IsExpandedNodePipe, isStandalone: false, name: "isExpandedNode" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IsExpandedNodePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'isExpandedNode',
                    standalone: false
                }]
        }] });

class ThImageOrIconePipe {
    transform(column) {
        const fieldTypeId = +column.FieldTypeId;
        const displayType = column.Extra?.IconDisplayTypeEnum;
        const x = fieldTypeId === 42 ||
            ((fieldTypeId === 6 || fieldTypeId === 5) && displayType === 'Image');
        column.$IsImageOricon = x;
        return x;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ThImageOrIconePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ThImageOrIconePipe, isStandalone: false, name: "thImageOrIcon" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ThImageOrIconePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'thImageOrIcon',
                    standalone: false
                }]
        }] });

class FindPreviewColumnPipe {
    transform(columns) {
        if (!columns?.length) {
            return;
        }
        return columns.find((column) => column.IsPreview);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FindPreviewColumnPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FindPreviewColumnPipe, isStandalone: false, name: "findPreviewColumn" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FindPreviewColumnPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'findPreviewColumn',
                    standalone: false
                }]
        }] });

class ReplacePipe {
    transform(value, regexValue, replaceValue) {
        const regex = new RegExp(regexValue, 'g');
        return value.replace(regex, replaceValue);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReplacePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ReplacePipe, isStandalone: false, name: "replace" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReplacePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'replace',
                    standalone: false
                }]
        }] });

class FilterWorkflowInMobilePipe {
    constructor() { }
    transform(buttons, worfklowButtonsOnFooter = false
    // fileCount: number
    ) {
        // const isMobileOrTablet = getDeviceIsMobile() || worfklowButtonsOnFooter;
        if (!worfklowButtonsOnFooter) {
            return buttons;
        }
        return buttons.filter((button) => !button.isWorkflow);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterWorkflowInMobilePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FilterWorkflowInMobilePipe, isStandalone: false, name: "filterWorkflowInMobile" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterWorkflowInMobilePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filterWorkflowInMobile',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class HideColumnsInmobilePipe {
    transform(columns, hideColumnsInMobile) {
        if (!columns?.length || !hideColumnsInMobile || !getDeviceIsMobile()) {
            return columns;
        }
        const arrOfColumns = hideColumnsInMobile.split(',');
        const x = columns.filter((column, _i) => arrOfColumns.indexOf(column.Caption) === -1 && arrOfColumns.indexOf(column.Name) === -1);
        return x;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HideColumnsInmobilePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: HideColumnsInmobilePipe, isStandalone: false, name: "hideColumnsInmobile" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HideColumnsInmobilePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'hideColumnsInmobile',
                    standalone: false
                }]
        }] });

class StringToNumberPipe {
    transform(val) {
        let tvalue = NaN;
        if (typeof val === 'string') {
            if (isNaN(+val[0])) {
                tvalue = +val.substring(1, val.length);
            }
            else {
                tvalue = +val;
            }
        }
        return tvalue;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: StringToNumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: StringToNumberPipe, isStandalone: false, name: "strToNum" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: StringToNumberPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'strToNum',
                    standalone: false
                }]
        }] });

class ColumnValueOfParametersPipe {
    constructor() {
        this._findColumnByDbName = inject(FindColumnByDbNamePipe);
        this._columnValuePipe = inject(ColumnValuePipe);
        this._moValuePipe = inject(MoValuePipe);
    }
    transform(allColumns, mo, fieldname, defaultValue, caption) {
        if (fieldname) {
            const column = this._findColumnByDbName.transform(allColumns, fieldname, []);
            if (column) {
                return this._columnValuePipe.transform(column, mo);
            }
            else {
                return this._moValuePipe.transform(fieldname, mo, caption);
            }
        }
        return defaultValue;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnValueOfParametersPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ColumnValueOfParametersPipe, isStandalone: false, name: "columnValueOfParameters" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnValueOfParametersPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'columnValueOfParameters',
                    standalone: false
                }]
        }] });

class HideAcceptCancelButtonsPipe {
    constructor() { }
    transform(buttons, hideAcceptCancel) {
        if (!buttons) {
            return [];
        }
        if (!hideAcceptCancel) {
            return buttons;
        }
        return buttons.filter((c) => c.itemId !== 'Ok' && c.itemId !== 'Cancel');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HideAcceptCancelButtonsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: HideAcceptCancelButtonsPipe, isStandalone: false, name: "hideAcceptCancel" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HideAcceptCancelButtonsPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'hideAcceptCancel',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class FilterInlineActionListPipe {
    transform(actionList, hideDeleteButton, hideEditButton, hideShowButton) {
        return actionList.filter((action) => (action.itemId === 'Delete' && !hideDeleteButton) ||
            (action.itemId === 'Edit' && !hideEditButton) ||
            (action.itemId === 'Show' && !hideShowButton));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterInlineActionListPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: FilterInlineActionListPipe, isStandalone: false, name: "filterInlineActionList" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FilterInlineActionListPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'filterInlineActionList',
                    standalone: false
                }]
        }] });

class IsImagePipe {
    transform(type
    // fileCount: number
    ) {
        return isImage(type);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IsImagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: IsImagePipe, isStandalone: false, name: "isImageType" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IsImagePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'isImageType',
                    standalone: false
                }]
        }] });

class ToolbarSettingsPipe {
    transform(toolbarButtons, toolbarSettings) {
        if (!toolbarSettings?.MoDataList?.length || !toolbarButtons?.length) {
            return toolbarButtons;
        }
        const x = toolbarSettings.MoDataList;
        x.forEach((c) => {
            const indexOfItem = toolbarButtons.findIndex((d) => d.itemId === c.ItemId$Caption);
            if (indexOfItem > -1) {
                toolbarButtons[indexOfItem] = { ...toolbarButtons[indexOfItem], ...c, isCustom: true };
            }
        });
        return [...toolbarButtons.filter((c) => !c.HideButton)];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ToolbarSettingsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ToolbarSettingsPipe, isStandalone: false, name: "ulvToolbarSettings" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ToolbarSettingsPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'ulvToolbarSettings',
                    standalone: false
                }]
        }] });

class CardMediaSizePipe {
    transform(cardMediaSize, defaultValue) {
        if (!cardMediaSize) {
            return [+defaultValue, +defaultValue];
        }
        const x = cardMediaSize.split('x');
        return [+x[0], +x[1]];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardMediaSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: CardMediaSizePipe, isStandalone: false, name: "cardMediaSize" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardMediaSizePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'cardMediaSize',
                    standalone: false
                }]
        }] });

class LabelStarTrimPipe {
    transform(key) {
        if (!key) {
            return '';
        }
        if (!key.replace) {
            return key;
        }
        let hasStar = false;
        if (typeof key === 'string' && key.indexOf('*') > 0) {
            hasStar = true;
        }
        const key2 = !hasStar ? key.trim() : key.replace('*', '').trim();
        return key2;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LabelStarTrimPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: LabelStarTrimPipe, isStandalone: false, name: "lableStartTrim" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LabelStarTrimPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'lableStartTrim',
                    standalone: false
                }]
        }] });

class SplitPipe {
    transform(value, delimiter = ',') {
        return value ? value.split(delimiter).map((s) => s.trim()) : [];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SplitPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: SplitPipe, isStandalone: false, name: "split" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SplitPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'split',
                    standalone: false
                }]
        }] });

class DynamicDarkColorPipe {
    constructor() {
        this.cache = new Map();
        this.darkBackground = [18, 18, 18]; // #121212
        this.minContrast = 4.5;
    }
    transform(styleStr) {
        if (!IsDarkMode() || !styleStr) {
            return styleStr;
        }
        if (this.cache.has(styleStr)) {
            return this.cache.get(styleStr);
        }
        const colorRegex = /(?:^|;)\s*color\s*:\s*([^;!]+)[;!]?/i;
        const bgRegex = /(?:^|;)\s*background-color\s*:\s*([^;!]+)[;!]?/i;
        const colorMatch = styleStr.match(colorRegex);
        const bgMatch = styleStr.match(bgRegex);
        let newStyle = styleStr;
        // ---------------------------------------------------
        // BACKGROUND EXISTS BUT NO TEXT COLOR
        // ---------------------------------------------------
        if (bgMatch && !colorMatch) {
            const bgRgb = this.parseColor(bgMatch[1].trim());
            if (bgRgb) {
                const textColor = this.getReadableTextColor(bgRgb);
                newStyle += `; color: ${textColor};`;
            }
            this.cache.set(styleStr, newStyle);
            return newStyle;
        }
        // ---------------------------------------------------
        // NORMAL COLOR CONTRAST FIX
        // ---------------------------------------------------
        if (colorMatch) {
            const originalColor = colorMatch[1].trim();
            const rgb = this.parseColor(originalColor);
            if (!rgb) {
                return styleStr;
            }
            const contrast = this.getContrastRatio(rgb, this.darkBackground);
            if (contrast < this.minContrast) {
                const adjustedHex = this.adjustColorForDarkMode(rgb);
                newStyle = styleStr.replace(colorRegex, `; color: ${adjustedHex};`);
            }
        }
        this.cache.set(styleStr, newStyle);
        return newStyle;
    }
    getReadableTextColor(bgRgb) {
        const whiteContrast = this.getContrastRatio([255, 255, 255], bgRgb);
        const blackContrast = this.getContrastRatio([0, 0, 0], bgRgb);
        return whiteContrast > blackContrast ? '#ffffff' : '#000000';
    }
    // ---------------------------------------------------
    // 🎯 Adjust until contrast >= 4.5
    // ---------------------------------------------------
    adjustColorForDarkMode(rgb) {
        const [h, s, initialL] = this.rgbToHsl(rgb);
        let l = initialL;
        let attempts = 0;
        let newRgb = rgb;
        let contrast = this.getContrastRatio(newRgb, this.darkBackground);
        while (contrast < this.minContrast && attempts < 20) {
            l = Math.min(1, l + 0.05);
            newRgb = this.hslToRgb(h, s, l);
            contrast = this.getContrastRatio(newRgb, this.darkBackground);
            attempts++;
        }
        return this.rgbArrayToHex(newRgb);
    }
    // ---------------------------------------------------
    // 🎨 Color Utilities
    // ---------------------------------------------------
    parseColor(color) {
        const ctx = document.createElement('canvas').getContext('2d');
        if (!ctx) {
            return null;
        }
        ctx.fillStyle = color;
        const computed = ctx.fillStyle;
        // اگر خروجی hex بود
        if (computed.startsWith('#')) {
            const hex = computed.slice(1);
            return [
                parseInt(hex.substring(0, 2), 16),
                parseInt(hex.substring(2, 4), 16),
                parseInt(hex.substring(4, 6), 16)
            ];
        }
        // اگر rgb یا rgba بود
        const match = computed.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
        if (match) {
            return [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10)];
        }
        return null;
    }
    rgbArrayToHex(rgb) {
        return '#' + rgb.map((v) => v.toString(16).padStart(2, '0')).join('');
    }
    rgbToHsl(rgb) {
        const [r, g, b] = rgb.map((v) => v / 255);
        const max = Math.max(r, g, b);
        const min = Math.min(r, g, b);
        let h = 0, s = 0;
        const l = (max + min) / 2;
        if (max !== min) {
            const d = max - min;
            s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
            switch (max) {
                case r:
                    h = (g - b) / d + (g < b ? 6 : 0);
                    break;
                case g:
                    h = (b - r) / d + 2;
                    break;
                case b:
                    h = (r - g) / d + 4;
                    break;
            }
            h /= 6;
        }
        return [h, s, l];
    }
    hslToRgb(h, s, l) {
        const c = (1 - Math.abs(2 * l - 1)) * s;
        const x = c * (1 - Math.abs(((h * 6) % 2) - 1));
        const m = l - c / 2;
        let r1 = 0, g1 = 0, b1 = 0;
        if (h < 1 / 6) {
            [r1, g1, b1] = [c, x, 0];
        }
        else if (h < 2 / 6) {
            [r1, g1, b1] = [x, c, 0];
        }
        else if (h < 3 / 6) {
            [r1, g1, b1] = [0, c, x];
        }
        else if (h < 4 / 6) {
            [r1, g1, b1] = [0, x, c];
        }
        else if (h < 5 / 6) {
            [r1, g1, b1] = [x, 0, c];
        }
        else {
            [r1, g1, b1] = [c, 0, x];
        }
        return [Math.round((r1 + m) * 255), Math.round((g1 + m) * 255), Math.round((b1 + m) * 255)];
    }
    // ---------------------------------------------------
    // 📏 WCAG Contrast
    // ---------------------------------------------------
    getContrastRatio(rgb1, rgb2) {
        const lum1 = this.getLuminance(rgb1);
        const lum2 = this.getLuminance(rgb2);
        const brightest = Math.max(lum1, lum2);
        const darkest = Math.min(lum1, lum2);
        return (brightest + 0.05) / (darkest + 0.05);
    }
    getLuminance(rgb) {
        const a = rgb.map((v) => {
            v /= 255;
            return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
        });
        return 0.2126 * a[0] + 0.7152 * a[1] + 0.0722 * a[2];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicDarkColorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: DynamicDarkColorPipe, isStandalone: false, name: "dynamicDarkColor" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicDarkColorPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'dynamicDarkColor',
                    standalone: false
                }]
        }] });

class ChunkArrayPipe {
    transform(arr, size = 2) {
        if (!arr || !Array.isArray(arr) || size <= 0) {
            return [];
        }
        const out = [];
        for (let i = 0; i < arr.length; i += size) {
            out.push(arr.slice(i, i + size));
        }
        return out;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ChunkArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ChunkArrayPipe, isStandalone: false, name: "chunkArray" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ChunkArrayPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'chunkArray',
                    pure: true,
                    standalone: false
                }]
        }] });

class MapToChatMessagePipe {
    transform(message, index, messages) {
        if (!message || !messages?.length) {
            return [];
        }
        return {
            ...message,
            nextIsSame: messages?.[index + 1]?.owner?.id === message.owner.id,
            pervIsSame: messages?.[index - 1]?.owner?.id === message.owner.id,
            badge: !messages?.[index - 1] ||
                moment$2(message.createdAt).jDayOfYear() !== moment$2(messages?.[index - 1]?.createdAt).jDayOfYear(),
            nextHasBadge: !!messages?.[index + 1] &&
                moment$2(message.createdAt).jDayOfYear() !== moment$2(messages?.[index + 1]?.createdAt).jDayOfYear() &&
                message.owner.id === messages?.[index + 1]?.owner?.id,
            badgeLabel: moment$2(message.createdAt).format('jYYYY/jMM/jDD')
        };
    }
    matchFilter(value, fitlerArgs) {
        const match = Object.keys(fitlerArgs).some((key) => {
            const filterValue = fitlerArgs[key];
            if (typeof filterValue === typeof true && !filterValue) {
                const val = BarsaApi.Common.Util.TryGetValue(value, key);
                return !val;
            }
            else {
                return BarsaApi.Common.Util.TryGetValue(value, key) === filterValue;
            }
        });
        return match;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapToChatMessagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: MapToChatMessagePipe, isStandalone: false, name: "mapToChatMessage" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapToChatMessagePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'mapToChatMessage',
                    standalone: false
                }]
        }] });

class PicturesByGroupIdPipe {
    transform(value, groupId) {
        if (!value || !value.length) {
            return [];
        }
        return value.filter((c) => c.groupId === groupId);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PicturesByGroupIdPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: PicturesByGroupIdPipe, isStandalone: false, name: "picturesByGroupId" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PicturesByGroupIdPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'picturesByGroupId',
                    standalone: false
                }]
        }] });

class ScopedCssPipe {
    transform(value, scopeId) {
        if (!value) {
            return '';
        }
        const parser = new DOMParser();
        // اضافه کردن یک wrapper موقت برای جلوگیری از جابجایی تگ‌ها به head توسط مرورگر
        const doc = parser.parseFromString(`<div>${value}</div>`, 'text/html');
        const container = doc.body.firstChild;
        const styles = container.querySelectorAll('style');
        styles.forEach((style) => {
            let css = style.textContent || '';
            // بهبود ریجکس برای هندل کردن دقیق‌تر سلکتورها
            css = css.replace(/([^\r\n,{}]+)(?=\s*{)/g, (match) => {
                const selector = match.trim();
                if (!selector || selector.startsWith('@')) {
                    return selector;
                }
                // جلوگیری از تکرار در صورتی که قبلاً Scope اضافه شده باشد
                if (selector.startsWith(scopeId)) {
                    return selector;
                }
                return `${scopeId} ${selector}`;
            });
            style.textContent = css;
        });
        // حالا کل محتوای داخل wrapper را برگردانید
        return container.innerHTML;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScopedCssPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ScopedCssPipe, isStandalone: false, name: "scopedCss" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScopedCssPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'scopedCss',
                    standalone: false
                }]
        }] });

class ReportActionListPipe {
    constructor() { }
    transform(inlineEditMode, canView, hideOpenIcon, hasInlineDeleteButton, showViewButton, navigationArrow
    // fileCount: number
    ) {
        return this._createActionButtons(inlineEditMode, canView, hideOpenIcon, hasInlineDeleteButton, showViewButton, navigationArrow);
    }
    _createActionButtons(inlineEditMode, canView, hideOpenIcon, hasInlineEditButton, hasInlineDeleteButton, navigationArrow) {
        const showViewButton = !inlineEditMode && canView && !hideOpenIcon;
        const buttons = [];
        if (hasInlineEditButton) {
            buttons.push({
                glyph: 'edit',
                itemId: 'Edit',
                navigation: false,
                role: 'presentation',
                closeOnClick: true
            });
        }
        if (hasInlineDeleteButton) {
            buttons.push({
                glyph: 'delete',
                navigation: false,
                itemId: 'Delete',
                role: 'presentation',
                closeOnClick: true
            });
        }
        if (showViewButton) {
            buttons.push({
                glyph: navigationArrow,
                navigation: true,
                role: 'presentation',
                itemId: 'Show',
                closeOnClick: true
            });
        }
        return buttons;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportActionListPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: ReportActionListPipe, isStandalone: false, name: "reportActionList" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportActionListPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'reportActionList',
                    standalone: false
                }]
        }], ctorParameters: () => [] });

class GetCssVariableValuePipe {
    transform(cssVarName, removeUnit, element) {
        if (!cssVarName) {
            return null;
        }
        const target = element || document.documentElement;
        let value = getComputedStyle(target).getPropertyValue(cssVarName).trim();
        if (!value) {
            return null;
        }
        // remove unit
        if (removeUnit) {
            value = value.replace(removeUnit, '').trim();
            const numeric = Number(value);
            return isNaN(numeric) ? value : numeric;
        }
        return value;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GetCssVariableValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
    static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: GetCssVariableValuePipe, isStandalone: false, name: "getCssVarValue" }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GetCssVariableValuePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'getCssVarValue',
                    standalone: false
                }]
        }] });

class ApiService {
    constructor() {
        this.portalLoginUrl = `/api/auth/portal/login`;
        this.executeUrl = `api/base/execute`;
        this.httpClient = inject(HttpClient);
    }
    loginPortal() {
        return this.httpClient.get(this.portalLoginUrl);
    }
    GetCartableTemplate(keyOfCartableTemplates) {
        return from(this.loadFormAjax({ viewSettings: keyOfCartableTemplates }, 'List94.LoadCartableTemplates'));
    }
    loadPortalPageData(pageId, typeDefId) {
        return from(this.loadFormAjax({
            formParam: {
                IsNew: false,
                Mo: { Id: pageId, $TypeDefId: typeDefId }
            }
        }, 'Form94.GetPortal'));
    }
    loadPortal(portalId, typeDefId) {
        return from(this.loadFormAjax({
            formParam: {
                IsNew: false,
                Mo: { Id: portalId, $TypeDefId: typeDefId }
            }
        }, 'Form94.GetPortal'));
    }
    loadPortalSync(portalId, typeDefId) {
        return this.getServerDataSync({
            formParam: {
                IsNew: false,
                Mo: { Id: portalId, $TypeDefId: typeDefId }
            }
        }, 'Form94.GetPortal');
    }
    getServerDataSync(param, action) {
        return BarsaApi.Common.Ajax.GetServerData_SyncReturn(action, param, false);
    }
    loadFormAjax(param, action) {
        return new Promise((resolve, reject) => {
            BarsaApi.Common.Ajax.GetServerData(action, param, (m) => {
                resolve(m);
            }, (err) => {
                reject(err);
            });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ApiService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ApiService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }] });

class BreadcrumbService {
    constructor() {
        this.router = inject(Router);
        this._breadcrumbs$ = new BehaviorSubject([]);
        this.breadcrumbs$ = this._breadcrumbs$.asObservable();
        this.router.events
            .pipe(
        // Filter the NavigationEnd events as the breadcrumb is updated only when the route reaches its end
        filter((event) => event instanceof NavigationEnd), startWith(this.router), map(() => this.router.routerState.root))
            .subscribe((root) => {
            // Construct the breadcrumb hierarchy
            // const root = this.router.routerState.snapshot.root;
            this.ReBuild(root);
            // Emit the new hierarchy
        });
    }
    ReBuild(route) {
        const breadcrumbs = [];
        this.addBreadcrumb('', route, breadcrumbs);
        this._breadcrumbs$.next(breadcrumbs);
    }
    addBreadcrumb(lastPathWidthoutUrl, route, breadcrumbs) {
        if (route) {
            // Add an element for the current route part
            if (route.snapshot.data?.hideBreadCrumb !== true &&
                (route.snapshot.data?.breadcrumb ||
                    (typeof route.snapshot.data?.pageData?.BreadCrumb !== 'undefined' && route.snapshot.url.length))) {
                let url = '';
                let routeURL = route.snapshot.url
                    .map((segment) => `${segment.path}${Object.keys(segment.parameters).length
                    ? ';' +
                        Object.keys(segment.parameters)
                            .map((c) => `${c}=${segment.parameters[c]}`)
                            .join(';')
                    : ''}`)
                    .join('/');
                if (route.snapshot.routeConfig?.outlet) {
                    routeURL = `${lastPathWidthoutUrl}(${route.snapshot.routeConfig?.outlet}:${routeURL} ${!route.firstChild ? ')' : ''}`;
                }
                if (routeURL !== '') {
                    url += `/${routeURL}`;
                }
                const params2 = routeURL !== ''
                    ? ''
                    : Object.keys(route.snapshot.params).map((c) => '/' + route.snapshot.params[c]);
                const label = this.getLabel(route.snapshot.data);
                const breadcrumb = {
                    label,
                    url: url + params2,
                    route
                };
                breadcrumbs.push(breadcrumb);
                lastPathWidthoutUrl = '';
            }
            else if (route.snapshot.url.length && route.snapshot.routeConfig?.path) {
                lastPathWidthoutUrl = !lastPathWidthoutUrl
                    ? `${route.snapshot.routeConfig?.path}/`
                    : `${lastPathWidthoutUrl}${route.snapshot.routeConfig?.path}/`;
            }
            // Add another element for the next route part
            this.addBreadcrumb(lastPathWidthoutUrl, route.firstChild, breadcrumbs);
        }
    }
    getLabel(data) {
        // The breadcrumb can be defined as a static string or as a function to construct the breadcrumb element out of the route data
        const breadcrumb = data.breadcrumb || BarsaApi.Common.Util.TryGetValue(data, 'pageData.BreadCrumb', '');
        return typeof breadcrumb === 'function' ? data.breadcrumb(data) : breadcrumb;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BreadcrumbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BreadcrumbService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BreadcrumbService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [] });

class ModalRootComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.factoryResolver = inject(ComponentFactoryResolver);
        this.injector = inject(Injector);
        this._appRef = inject(ApplicationRef);
    }
    ngOnInit() {
        super.ngOnInit();
        // this.insertComponent();
    }
    close() {
        this._appRef.detachView(this.componentInstance.hostView);
    }
    insertComponent() {
        const factoryResolver = this.factoryResolver.resolveComponentFactory(this.componentType);
        this.componentInstance = factoryResolver.create(this.injector);
        this._appRef.attachView(this.componentInstance.hostView);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ModalRootComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ModalRootComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ModalRootComponent, decorators: [{
            type: Component,
            args: [{
                    template: ``,
                    standalone: false
                }]
        }] });

class CustomInjector {
    constructor(parentInjector, additionalTokens, activatedRoute) {
        this.parentInjector = parentInjector;
        this.additionalTokens = additionalTokens;
        this.activatedRoute = activatedRoute;
    }
    get(token, notFoundValue) {
        if (token === ActivatedRoute && this.activatedRoute) {
            return this.activatedRoute;
        }
        const value = this.additionalTokens.get(token);
        if (value) {
            return value;
        }
        return this.parentInjector.get(token, notFoundValue);
    }
}
class DialogParams {
    constructor() {
        this.afterClosed = new Subject();
        this.afterClosed$ = this.afterClosed?.asObservable();
    }
    close(result) {
        if (this.afterClosed != null) {
            this.afterClosed.next(result);
        }
    }
    ngOnDestroy() {
        this.afterClosed.unsubscribe();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DialogParams, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DialogParams }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DialogParams, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });
class BarsaDialogService {
    constructor() {
        this.injector = inject(Injector);
    }
    showForm(component, context, container) {
        const weakMap = new WeakMap();
        const dialogParams = new DialogParams();
        dialogParams.context = context;
        weakMap.set(DialogParams, dialogParams);
        const viewContainerRef = container ?? this.containerComponent.vcr;
        const modalRootComponentRef = container.createComponent(ModalRootComponent, {
            injector: new CustomInjector(viewContainerRef.injector, weakMap)
        });
        modalRootComponentRef.instance.componentType = component;
        modalRootComponentRef.instance.insertComponent();
        if (!context.inDialog) {
            // viewContainerRef.element.nativeElement.classList.add('deactive');
        }
        viewContainerRef.insert(modalRootComponentRef.hostView, 0);
        this.containerComponent.cdr.detectChanges();
        const sub = dialogParams.afterClosed$?.subscribe(() => {
            modalRootComponentRef.instance.close();
            viewContainerRef.remove(0);
            sub?.unsubscribe();
            // viewContainerRef.element.nativeElement.classList.remove('deactive');
        });
        // this.modalRootComponentRef.instance.navigate();
        return dialogParams.afterClosed$;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaDialogService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaDialogService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }] });

class NotFoundComponent extends BaseComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NotFoundComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: NotFoundComponent, isStandalone: false, selector: "bnrc-not-found", inputs: { componentName: "componentName", moduleName: "moduleName" }, usesInheritance: true, ngImport: i0, template: "<div fd-form-control>{{ moduleName + ' ' + componentName }}</div>\r\n", styles: [":host{border:1px solid red;display:flex;align-items:center;justify-content:center;opacity:.2}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NotFoundComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-not-found', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div fd-form-control>{{ moduleName + ' ' + componentName }}</div>\r\n", styles: [":host{border:1px solid red;display:flex;align-items:center;justify-content:center;opacity:.2}\n"] }]
        }], propDecorators: { componentName: [{
                type: Input
            }], moduleName: [{
                type: Input
            }] } });

class DynamicComponentService {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this.cfr = inject(ComponentFactoryResolver);
        this._injector = inject(Injector);
        this._dynamicModuleWithComponents = {};
        this._compiler = inject(Compiler);
    }
    addDynamicModuleResolver(modules) {
        this.requires = { ...this.requires, ...modules };
        return Promise.resolve(this.requires);
    }
    addModuleWithComponents(moduleName, ngModuleRef) {
        if (!this._dynamicModuleWithComponents[moduleName]) {
            this._dynamicModuleWithComponents[moduleName] = {
                ngModuleRef
            };
        }
    }
    getComponentType(componentSelector, componentName, moduleName) {
        const moName = `${moduleName}Module`;
        const module = this._dynamicModuleWithComponents[moName];
        const cmpName = `${componentName}Component`;
        if (!module) {
            return;
        }
        let x = module.ngModuleRef.dynamicComponents.find((c) => c.name.includes(cmpName));
        if (!x) {
            module.ngModuleRef.dynamicComponents.forEach((c) => {
                if (!x) {
                    const cmp = c['ɵcmp'];
                    cmp?.selectors?.length && (x = cmp.selectors[0].includes(componentSelector) ? c : null);
                }
            });
        }
        return x;
    }
    getComponentBySelector(selector, componentName, moduleName, injector) {
        const moName = `${moduleName}Module`;
        const module = this._dynamicModuleWithComponents[moName];
        if (module) {
            const componentFactory = module.ngModuleRef.getComponentFactory(selector);
            if (componentFactory) {
                return of(componentFactory.create(injector));
            }
        }
        else {
            if (this.requires[moduleName]) {
                return from(this.requires[moduleName]()).pipe(exhaustMap((m) => this._compiler.compileModuleAsync(m[moName])), map$1((c) => c.create(this._injector)), map$1((c) => c.componentFactoryResolver
                    .resolveComponentFactory(this.getComponentType(selector, componentName, moduleName))
                    .create(injector)));
            }
        }
        const componentRef = this.cfr.resolveComponentFactory(NotFoundComponent).create(injector);
        componentRef.instance.componentName = selector;
        componentRef.instance.moduleName = moduleName;
        return of(componentRef);
    }
    getComponentByName(componentName, moduleName, injector) {
        const cmpName = componentName + 'Component';
        const moName = moduleName + 'Module';
        const module = this._dynamicModuleWithComponents[moName];
        if (module && module.ngModuleRef.getComponentFactory) {
            const componentFactory = module.ngModuleRef.getComponentFactory(cmpName);
            if (componentFactory) {
                return of(componentFactory.create(injector));
            }
        }
        const componentRef = this.cfr.resolveComponentFactory(NotFoundComponent).create(injector);
        componentRef.instance.componentName = componentName;
        componentRef.instance.moduleName = moduleName;
        return of(componentRef);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicComponentService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicComponentService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [] });

class FormPanelService extends BaseComponent {
    constructor() {
        super();
        this._hideClose$ = new BehaviorSubject(false);
        this._hideTitle$ = new BehaviorSubject(false);
        this._hidePin$ = new BehaviorSubject(false);
        this.ColonInLabel = true;
        this.toolbarClick$ = new Subject();
        this._contextSource = new BehaviorSubject(null);
        this._formHeightSource = new BehaviorSubject(0);
        this._searchPanelIsObjectSource = new BehaviorSubject(false);
        this._isSearchPanelSource = new BehaviorSubject(false);
        this._isSearcPanelInSideContent = new BehaviorSubject(false);
        this._workflowPanelUiSource = new BehaviorSubject(null);
        this._infobars$ = new BehaviorSubject([]);
        this._moSource = new BehaviorSubject(null);
        this._viewSource = new BehaviorSubject(null);
        this._sidebarState$ = new BehaviorSubject('close');
        this._toolbarItemsSource = new BehaviorSubject([]);
        this._titleSource = new BehaviorSubject('');
        this._maxContentWidthSource = new BehaviorSubject('auto');
        this._wizardNextStepSource = new Subject();
        this._wizardPreviousStepSource = new Subject();
        this._layoutSource = new BehaviorSubject(null);
        this._forceCloseSource = new Subject();
        this._groupBRuleSource = new Subject();
        this._isSimpleFormSource = new BehaviorSubject(false);
        this._formWidthSource = new BehaviorSubject('100%');
        this._toolbarVisibleSource = new BehaviorSubject(true);
        this._headerLayoutSource = new BehaviorSubject(null);
        this._headerTitleSource = new BehaviorSubject('');
        this._maskSource = new BehaviorSubject(false);
        this._headerRemoveContentPaddingSource = new BehaviorSubject(false);
        this._hideBreadCrumbSource = new BehaviorSubject(false);
        this._headerDescriptionSource = new BehaviorSubject('');
        this._hideFooter$ = new BehaviorSubject(false);
        this._canSend$ = new BehaviorSubject(false);
        this._isModal = new BehaviorSubject(false);
        this._router = inject(Router);
        this._activatedRoute = inject(ActivatedRoute);
        this.context$ = this._contextSource.asObservable().pipe(tap((context) => this._prepareContext(context)), takeUntil(this._onDestroy$));
        this.toolbarClick$
            .pipe(exhaustMap$1((c) => {
            this._toolbarClick(c);
            return timer(1000); // ۱ ثانیه بلاک می‌شود
        }))
            .subscribe();
        this.searchPanelIsObject$ = this._searchPanelIsObjectSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.isSearchPanel$ = this._isSearchPanelSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.isSearcPanelInSideContent$ = this._isSearcPanelInSideContent
            .asObservable()
            .pipe(takeUntil(this._onDestroy$));
        this.workflowPanelUi$ = this._workflowPanelUiSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.formHeight$ = this._formHeightSource.asObservable();
        this.mo$ = this._moSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.fieldDict$ = this.mo$.pipe(map((c) => c.$FieldDict), takeUntil(this._onDestroy$));
        this.view$ = this._viewSource.asObservable().pipe(tap((view) => this._prepareView(view)), takeUntil(this._onDestroy$));
        this.toolbarItems$ = this._toolbarItemsSource.asObservable().pipe(map((items) => this._filterToolbarItems(items)), takeUntil(this._onDestroy$));
        this.workflowButtons$ = this.workflowPanelUi$.pipe(map((c) => c?.buttonList || []), withLatestFrom(this._toolbarItemsSource.asObservable().pipe(map((items) => this._filterToolbarItems(items)), map((items) => items.filter((c) => c.isWorkflow)))), map(([items1, items2]) => (items2.length > 0 ? [...items2] : [...items1])), takeUntil(this._onDestroy$));
        // this._toolbarItemsSource.asObservable().pipe(
        //     map((items) => this._filterToolbarItems(items)),
        //     map((items) => items.filter((c) => c.isWorkflow)),
        //     withLatestFrom(this.workflowPanelUi$.pipe(map((c) => c?.buttonList || []))),
        //     map(([items1, items2]) => (items1.length > 0 ? items1 : items2)),
        //     takeUntil(this._onDestroy$)
        // );
        this.maxContentWidth$ = this._maxContentWidthSource.asObservable().pipe(map((width) => (width ? width + 'px' : 'auto')), takeUntil(this._onDestroy$));
        this.wizardNextStep$ = this._wizardNextStepSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.wizardPreviousStep$ = this._wizardPreviousStepSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.layout$ = this._layoutSource.asObservable().pipe(map((layout) => {
            if (!layout) {
                return layout;
            }
            const deviceWidth = DeviceWidth();
            if (deviceWidth < layout.Bounds.width) {
                layout.Bounds.width = deviceWidth;
            }
            return { ...layout };
        }), takeUntil(this._onDestroy$));
        this.forceClose$ = this._forceCloseSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.groupLayout$ = this._groupBRuleSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.isSimpleForm$ = this._isSimpleFormSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.formWidth$ = this._formWidthSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.toolbarVisible$ = this._toolbarVisibleSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.title$ = combineLatest([this._headerTitleSource.asObservable(), this._titleSource.asObservable()]).pipe(map(([headerTitle, title]) => (headerTitle ? headerTitle : title)), takeUntil(this._onDestroy$));
        this.headerLayout$ = this._headerLayoutSource.asObservable().pipe(filter((headerLayout) => !!headerLayout), tap((headerLayout) => this._headerTitleSource.next(getHeaderValue(headerLayout?.Title))), tap((headerLayout) => this._hideClose$.next(headerLayout?.HideClose)), tap((headerLayout) => this._hideTitle$.next(headerLayout?.HideTitle)), tap((headerLayout) => this._hidePin$.next(headerLayout?.HidePin)), tap((headerLayout) => this._headerDescriptionSource.next(getHeaderValue(headerLayout?.Description))), tap((headerLayout) => this._headerRemoveContentPaddingSource.next(getHeaderValue(headerLayout?.RemoveContentPadding))), tap((headerLayout) => this._hideBreadCrumbSource.next(getHeaderValue(headerLayout?.HideBreadCrumb))), takeUntil(this._onDestroy$));
        this.headerDescription$ = this._headerDescriptionSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.headerRemoveContentPadding$ = this._headerRemoveContentPaddingSource
            .asObservable()
            .pipe(delay(0), takeUntil(this._onDestroy$));
        this.headerSubtitle$ = this.headerLayout$.pipe(map((headerLayout) => getHeaderValue(headerLayout?.SubTitle)), takeUntil(this._onDestroy$));
        this.avatar$ = this.headerLayout$.pipe(map((headerLayout) => getHeaderValue(headerLayout?.Avatar, true)), takeUntil(this._onDestroy$));
        this.circleAvatar$ = this.headerLayout$.pipe(map((headerLayout) => getHeaderValue(headerLayout?.CircleAvatar)), takeUntil(this._onDestroy$));
        this.mask$ = this._maskSource.asObservable().pipe(debounceTime(200), takeUntil(this._onDestroy$));
    }
    get infobars$() {
        return this._infobars$.asObservable().pipe(distinctUntilChanged());
    }
    get hideFooter$() {
        return this._hideFooter$.asObservable().pipe(distinctUntilChanged());
    }
    get sidebarState$() {
        return this._sidebarState$.asObservable();
    }
    get hideBreadCrumb$() {
        return this._hideBreadCrumbSource.asObservable();
    }
    get hidePin$() {
        return this._hidePin$.asObservable();
    }
    get hideClose$() {
        return this._hideClose$.asObservable();
    }
    get hideTitle$() {
        return this._hideTitle$.asObservable();
    }
    get canSend$() {
        return this._canSend$.asObservable();
    }
    get mo() {
        return this._moSource.getValue();
    }
    set context(val) {
        if (this._context) {
            this.destroy();
        }
        this._contextSource.next(val);
    }
    setIsModal(isModal) {
        this._isModal.next(isModal);
    }
    hideFooter(hideFooter) {
        this._hideFooter$.next(hideFooter);
    }
    setFormHeight(val) {
        this._formHeightSource.next(val);
    }
    destroy() {
        if (!this._context) {
            return;
        }
        this._context.un('CloseSideNavigator', this._closeSideNavigator);
        this._context.un('GroupBRuleChanged', this._groupBRuleChanged);
        this._context.un('TitleChanged', this._titleChanged);
        this._context.un('WizardNextStep', this._wizardNextStep);
        this._context.un('WizardPreviousStep', this._wizardPreviousStep);
        this._context.un('DoLayout', this._doLayout);
        this._context.un('MaskChanged', this._maskChanged);
        this._context.un('ForceClose', this._forceClose);
        this._context.toolbar?.un('ToolbarItemsChanged', this._toolbarItemsChanged);
        this._context = null;
        this._layoutSource.next(null);
        // this._onDestroy$.next();
    }
    wfChoice(btn) {
        this._context.fireEvent('TransitionSelect', this._context, btn);
    }
    changeSidebarState(state) {
        this._sidebarState$.next(state);
    }
    hideInfoBar(id) {
        const x = this._infobars$.getValue();
        const t = x.filter((c) => c.id !== id);
        this._infobars$.next(t);
    }
    _initialize(context) {
        this._workflowPanelUiSource.next(context?.WorkflowPanelUi);
        this._isSearchPanelSource.next(context?.Setting?.IsSearchPanel);
        this._isSearcPanelInSideContent.next(context?.Setting?.IsSearcPanelInSideContent);
        this._canSend$.next(context?.Setting?.CanSend);
        this._searchPanelIsObjectSource.next(context?.Setting?.ParameterTypeIsObject);
        this._moSource.next(context?.Mo);
        this._viewSource.next(context?.Setting?.View);
        this._toolbarItemsSource.next(context?.toolbar?.items);
        // if (context?.toolbar) {
        //     context.toolbar?.on({
        //         ToolbarItemsChanged: this._toolbarItemsChanged.bind(this)
        //     });
        // }
        this._titleSource?.next(context?.title);
        this._toolbarVisibleSource.next(this._getToolbarVisibility(context));
    }
    _prepareView(view) {
        this._layoutSource.next(view?.Layout94);
        this._prepareLayoutComponent(view);
        this._maxContentWidthSource.next(this._getMaxContentWidth(view));
        this._isSimpleFormSource.next(this._getIsSimpleForm(view));
        this._headerLayoutSource.next(this._getHeaderLayout(view));
        if (view) {
            this.ColonInLabel = view.ColonInLabel !== false;
        }
        this._formWidthSource.next(view?.inDialog ? view.Layout94.Bounds.width + 'px' : '100%');
    }
    _filterToolbarItems(items) {
        if (!items) {
            return [];
        }
        let groupIndex = 10;
        // در صورتی که در موبایل باشد دو دکمه نمایش داده شود از دکمه های کاربر و فرآیندی
        // در صورتی که دکمه ی وجود نداشت فقط دکمه ذخیره نمایش داده شود
        // در حالتهای دیگر ابتدا دکمه های کاربری و فرآیندی و بعد دکمه های تعریف شده سیستم نمایش داده میشود.
        const isMobile = getDeviceIsMobile();
        const isTablet = getDeviceIsTablet();
        let newItems = items.filter((c) => !c.hidden &&
            !((isMobile || isTablet || BarsaApi.LoginFormData.IsServiceDesk) &&
                (c.itemId === 'Next' ||
                    c.itemId === 'Previous' ||
                    c.itemId === 'MoveNext' ||
                    c.itemId === 'MovePrev' ||
                    c.itemId === 'MovePrevious')));
        newItems.sort((c, d) => (Number(c?.Data?.TabOrderNumber) < Number(d?.Data?.TabOrderNumber) ? 1 : -1));
        const nonStringItems = newItems.filter((c) => typeof c !== 'string');
        const t = nonStringItems.find((c) => !c.isBuiltin && !c.IAmMenu);
        if (t) {
            t.overflowPriority = 'high';
        }
        // let nonBuiltinCount = 0;
        // nonStringItems.forEach((item) => {
        //     if (typeof item === 'string') {
        //         return;
        //     }
        //     const inFooter = BarsaApi.Common.Util.TryGetValue(item, 'Data.CustomUi.Parameters.InFooter', false);
        //     if (item.isBuiltin || inFooter) {
        //         // سیستمی
        //         item.overflowPriority = 'always';
        //     } else {
        //         if (nonBuiltinCount > 1) {
        //             // دکمه های کاربری که بیشتر از دو هستند
        //             item.overflowPriority = 'low';
        //         } else {
        //             item.overflowPriority = 'low';
        //         }
        //         nonBuiltinCount++;
        //     }
        // });
        const noBuiltinItems = nonStringItems.filter((c) => typeof c === 'object' &&
            !c.isBuiltin &&
            BarsaApi.Common.Util.TryGetValue(c, 'Data.CustomUi.Parameters.InFooter', false) !== true);
        noBuiltinItems.forEach((item, _index) => {
            item.overflowPriority = 'high';
            item.overflowGroup = groupIndex++;
        });
        const nonBuiltinCount = noBuiltinItems.length;
        if (nonBuiltinCount === 0) {
            // اگر هیچ دکمه کاربری وجود نداشت
            nonStringItems.forEach((item, _) => {
                if (item.itemId === 'Save') {
                    item.overflowPriority = 'never';
                }
            });
        }
        const saveAndNew = newItems.find((c) => c.itemId === 'SaveAndNew');
        const saveAndClose = newItems.find((c) => c.itemId === 'SaveAndClose');
        if (saveAndClose && saveAndClose.menu) {
            const save = saveAndClose.menu.items[0];
            if (save) {
                save.isBuiltin = true;
                save.overflowPriority = 'low';
                save.overflowGroup = 1;
                newItems.push(save);
                if (saveAndNew) {
                    save.IAmMenu = true;
                    save.overflowPriority = 'low';
                    save.overflowGroup = 1;
                    save.menu = { items: [{ ...saveAndNew }] };
                    newItems = newItems.filter((c) => c.itemId !== 'SaveAndNew');
                }
            }
        }
        newItems.forEach((item) => {
            if (item.menu) {
                item.menu.items = item.menu.items.filter((c) => !c.hidden);
            }
        });
        const builtinsButtons = newItems.filter((c) => c?.isBuiltin);
        newItems = [
            ...builtinsButtons,
            ...newItems.filter((c) => !c?.isBuiltin && !c?.isWorkflow),
            ...newItems.filter((c) => c?.isWorkflow)
        ];
        const moveNextIndex = newItems.findIndex((c) => c.itemId === 'MoveNext');
        if (moveNextIndex > -1) {
            newItems[moveNextIndex].overflowPriority = 'low';
            newItems[moveNextIndex].overflowGroup = 2;
            const mos = newItems.splice(moveNextIndex - 1, 2);
            newItems = [...mos, ...newItems];
        }
        const movePrevIndex = newItems.findIndex((c) => c.itemId === 'MovePrev');
        if (movePrevIndex > -1) {
            newItems[movePrevIndex].overflowGroup = 2;
            newItems[movePrevIndex].overflowPriority = 'low';
        }
        // check toolbaritems in footer property
        newItems.forEach((c) => {
            const inFooter = BarsaApi.Common.Util.TryGetValue(c, 'Data.CustomUi.Parameters.InFooter', false);
            if (inFooter) {
                c.inFooter = true;
            }
        });
        return newItems.reverse();
        // return newItems.sort((a): number => (typeof a == 'string' ? 0 : a.IAmMenu ? 1 : -1));
    }
    _getHeaderLayout(view) {
        const headerLayout = BarsaApi.Common.Util.TryGetValue(view, 'HeaderLayout', null);
        if (headerLayout) {
            // this.setHeaderTitleAndSubtitleAndAvatar(headerLayout);
            const t = [];
            headerLayout.FacetList.MoDataList.forEach((facetColumn) => {
                t.push({
                    type: facetColumn.ColumnSettings.$FormPanelSetting.Data.Mo.Type,
                    mo: facetColumn.ColumnSettings.$FormPanelSetting.Data.Mo
                });
            });
            headerLayout.FacetList2 = t;
        }
        return headerLayout;
    }
    _prepareLayoutComponent(view) {
        if (!view) {
            return;
        }
        const layoutComponents = BarsaApi.Common.Util.TryGetValue(view, 'ExtraJsonProp.Components', null);
        if (!layoutComponents) {
            return;
        }
        if (!Array.isArray(layoutComponents)) {
            return;
        }
        layoutComponents.forEach((layoutComponent) => {
            const layoutSetting = FindLayoutSettingFromLayout94(view.Layout94, layoutComponent.LayoutTitle);
            if (layoutSetting == null) {
                return;
            }
            layoutSetting.component = { ...layoutComponent };
        });
    }
    _getIsSimpleForm(view) {
        const isSimple = BarsaApi.Common.Util.TryGetValue(view, 'ExtraJsonProp.IsSimple', false);
        return isSimple;
    }
    _getToolbarVisibility(context) {
        if (!context) {
            return false;
        }
        const hideToolbar = BarsaApi.Common.Util.TryGetValue(context, 'toolbar.hideToolbar', false);
        if (hideToolbar) {
            return false;
        }
        if (!context.Setting.View) {
            return false;
        }
        const { FormSettings } = context.Setting.View;
        if (FormSettings) {
            const showToolbar = FormSettings.ShowToolbar === false ? false : true;
            const featureToolbar = BarsaApi.Common.Util.TryGetValue(context, 'Features.Toolbar', false);
            const visible = (featureToolbar && showToolbar) !== false;
            return visible;
        }
        return true;
    }
    _getMaxContentWidth(view) {
        const maxContentWidth = BarsaApi.Common.Util.TryGetValue(view, 'ExtraJsonProp.MaxWidth', '0');
        return maxContentWidth;
    }
    _addListener(context) {
        if (!context) {
            return;
        }
        context.on({
            CloseSideNavigator: this._closeSideNavigator.bind(this),
            GroupBRuleChanged: this._groupBRuleChanged.bind(this),
            TitleChanged: this._titleChanged.bind(this),
            WizardNextStep: this._wizardNextStep.bind(this),
            WizardPreviousStep: this._wizardPreviousStep.bind(this),
            DoLayout: this._doLayout.bind(this),
            MaskChanged: this._maskChanged.bind(this),
            ForceClose: this._forceClose.bind(this),
            Refresh: this._refresh.bind(this),
            ShowInfoBar: this._showInfobar.bind(this),
            HideInfoBar: this.hideInfoBar.bind(this)
        });
        context.toolbar?.on({
            ToolbarItemsChanged: this._toolbarItemsChanged.bind(this)
        });
    }
    _showInfobar(id, text, type, buttons, handler, icon) {
        const x = this._infobars$.getValue();
        this._infobars$.next([
            ...x,
            {
                id,
                text,
                type,
                buttons,
                handler,
                icon: !icon ? `/assets/Images/InfoBar/${type}_24.png` : icon
            }
        ]);
    }
    _refresh() {
        this._initialize(this._context);
        const isModal = BarsaApi.Common.Util.TryGetValue(this, '_context.Setting.IsModal', false);
        if (this._context?.IsSubForm || isModal || this._isModal.getValue()) {
            return;
        }
        const mo = this._moSource.getValue();
        if (!mo) {
            return;
        }
        const breadCrumb = this._headerLayoutSource.getValue();
        const mainChild = this._activatedRoute.children.find((c) => c.outlet === 'main') || this._activatedRoute;
        const currentParams = mainChild?.snapshot.params ?? {};
        const queryParamsToUpdate = {
            id: mo.$State === 'New' ? '0' : mo.Id,
            tyid: mo.$TypeDefId,
            tycp: mo.$Caption ? mo.$Caption : null,
            repid: mo.$ReportId,
            vid: this._viewSource.getValue()?.TypeViewId,
            bc: breadCrumb ? breadCrumb : mo.$State === 'New' ? mo.$TypeDefName : mo.$Caption
        };
        const normalize = (v) => (v === 'undefined' || v === 'null' ? undefined : v);
        const currentRepId = normalize(currentParams.repid);
        const isSameReport = currentRepId == null || currentRepId === queryParamsToUpdate.repid;
        if (currentParams.id === queryParamsToUpdate.id &&
            currentParams.tyid === queryParamsToUpdate.tyid &&
            isSameReport &&
            currentParams.vid === queryParamsToUpdate.vid) {
            return;
        }
        const newParams = {
            ...currentParams,
            ...queryParamsToUpdate // پارامترهایی که می‌خواهی تغییر دهی
        };
        this._router.navigate([
            {
                outlets: {
                    main: ['show', newParams]
                }
            }
        ], { relativeTo: this._activatedRoute.parent, skipLocationChange: false });
    }
    _forceClose() {
        this._forceCloseSource.next();
    }
    _maskChanged(mask) {
        this._maskSource.next(mask);
    }
    _toolbarItemsChanged(items) {
        this._toolbarItemsSource.next(items);
    }
    _titleChanged(title) {
        this._titleSource.next(title);
    }
    _wizardNextStep() {
        this._wizardNextStepSource.next();
    }
    _wizardPreviousStep() {
        this._wizardPreviousStepSource.next();
    }
    _doLayout(context) {
        const view = context.Setting.View;
        this._viewSource.next(view);
    }
    _closeSideNavigator() {
        this._sidebarState$.next('close');
    }
    _groupBRuleChanged(groupItem) {
        this._groupBRuleSource.next(groupItem);
    }
    _prepareContext(context) {
        this._addListener(context);
        this._initialize(context);
        this._context = context;
    }
    _toolbarClick(btn) {
        btn.handler(btn, this._context);
    }
}

class FormService {
    constructor() {
        this.fromListSubject = new BehaviorSubject([]);
        this.formList$ = this.fromListSubject.asObservable();
    }
    openCompose(formComposeId) {
        this.fromListSubject.next([...this.fromListSubject.value, formComposeId]);
    }
    closeCompose(formComposeId) {
        this.fromListSubject.next(this.fromListSubject.value.filter((id) => id !== formComposeId));
    }
}

class ContainerService {
    constructor() {
        this.detachParent = true;
        this.state = 'attach';
        this.addModules = new Subject();
        this._onDestroy$ = new Subject();
        this._parentService = inject(ContainerService, { skipSelf: true, optional: true });
        this._scrollTop = 0;
        this._el = inject(ElementRef);
    }
    /** Inserted by Angular inject() migration for backwards compatibility */
    ngOnDestroy() {
        this._onDestroy$.next();
        this._onDestroy$.complete();
        if (this._parentService && this.detachParent) {
            this._parentService.insert();
        }
    }
    setViewContainerRef(viewContainerRef) {
        this._viewContainerRef = viewContainerRef;
        this.state = 'attach';
        if (this._parentService && this.detachParent) {
            this._parentService.detach();
        }
    }
    detach() {
        this._setScrollPosition();
        this.state = 'detach';
        this._viewRef = this._viewContainerRef.detach();
    }
    _setScrollPosition() {
        const elDom = this._el.nativeElement;
        if (elDom) {
            const x1 = elDom.querySelector('fd-dynamic-page-content');
            const x2 = elDom.querySelector('.fd-scrollbar[fd-scrollbar]');
            const scrollTopPage = x1?.scrollTop;
            const scrollTopScrollbar = x2?.scrollTop;
            if (scrollTopPage && scrollTopPage > 0) {
                this._scrollTop = scrollTopPage;
                this._elDomScrollbar = x1;
            }
            else if (scrollTopScrollbar && scrollTopScrollbar > 0) {
                this._scrollTop = scrollTopScrollbar;
                this._elDomScrollbar = x2;
            }
        }
    }
    _restoreScrollPostion() {
        if (this._scrollTop && this._scrollTop > 0) {
            if (this._elDomScrollbar) {
                this._elDomScrollbar.scrollTop = this._scrollTop;
            }
        }
    }
    insert() {
        if (this._viewRef) {
            this._viewContainerRef.insert(this._viewRef);
            this._restoreScrollPostion();
        }
        else {
            this.addModules.next();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ContainerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ContainerService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ContainerService, decorators: [{
            type: Injectable
        }] });

class HorizontalLayoutService {
    constructor() {
        this.controlFlexColumnSource = new BehaviorSubject({});
        this.displayTextFlexColumn$ = this.controlFlexColumnSource
            .asObservable()
            .pipe(map((controlFlexColumn) => Object.keys(controlFlexColumn).some((c) => controlFlexColumn[c])));
    }
    setFlexColumn(id, val) {
        const flexColumn = this.controlFlexColumnSource.getValue();
        flexColumn[id] = val;
        this.controlFlexColumnSource.next(flexColumn);
    }
}

class LayoutService {
    constructor() {
        this.rendered = new BehaviorSubject(false);
        this.maxWidth = new BehaviorSubject(0);
        this.refreshLayoutSource = new Subject();
        this.horizontalSource = new Subject();
        this._listOfHorizontal = [];
        this.rootRendered$ = this.rendered.asObservable();
        this.maxWidth$ = this.maxWidth.asObservable();
        this.refreshLayout$ = this.refreshLayoutSource.asObservable();
        this.horizontal$ = this.horizontalSource.asObservable().pipe(distinctUntilChanged((a, b) => a === b));
    }
    setRendered(val) {
        this.rendered.next(val);
    }
    setMaxWidth(val) {
        if (this.maxWidth.value < val) {
            this.maxWidth.next(val);
        }
    }
    refreshLayout() {
        this.refreshLayoutSource.next();
    }
    addHorizontal(id) {
        this._listOfHorizontal = [...this._listOfHorizontal, id];
        this.horizontalSource.next(this._listOfHorizontal);
    }
    removeHorizontal(id) {
        this._listOfHorizontal = this._listOfHorizontal.filter((c) => c !== id);
        this.horizontalSource.next(this._listOfHorizontal);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class PortalPageResolver {
    constructor() {
        this.portalService = inject(PortalService);
        /** Inserted by Angular inject() migration for backwards compatibility */
        this._titleService = inject(Title);
    }
    resolve(route
    // state: RouterStateSnapshot
    ) {
        // const url = decodeURI(route['_routerState'].url);
        // let url2=route.routeConfig?.path;
        // if(route.routeConfig?.path=='')
        // {
        //    url2 = url.split('/').find((c) => c && !c.startsWith('(')) ?? '';
        // }
        // if(url2=='**'){
        //   url2=route.url[0].path;
        // }
        // url2 = '/' + url2;
        const x = this.portalService.resolveData(route.data.pageData);
        x.subscribe((data) => {
            if (data) {
                data.TabPageTitle && this._titleService.setTitle(data.TabPageTitle);
            }
        });
        return x;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalPageResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalPageResolver, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalPageResolver, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

class AuthGuard {
    constructor() {
        this._portalService = inject(PortalService);
        this.router = inject(Router);
    }
    canActivate(activatedRouteSnapshot
    //    state: RouterStateSnapshot
    ) {
        const url = decodeURI(activatedRouteSnapshot._routerState.url);
        let url2 = url.split('/').find((c) => c && !c.startsWith('(')) ?? '';
        url2 = '/' + url2;
        return this._portalService.getPageData(url2, false).pipe(map((pageData) => {
            const pageNeedAuthorize = pageData?.HasAuthorize || pageData == null ? true : false;
            const hasAuthorized = (!BarsaApi.LoginFormData.IsAnonymous && BarsaApi.LoginFormData.IsUserLoggedIn) ||
                !pageNeedAuthorize;
            return { hasAuthorized, pageData };
        }), withLatestFrom(this._portalService.loginRoute$), tap(([pageInfo, loginRoute]) => {
            if (!pageInfo.hasAuthorized) {
                this.router.navigate([loginRoute]);
            }
        }), tap(([pageInfo, _]) => {
            if (pageInfo.hasAuthorized) {
                const needChangePassword = BarsaApi.Ul.ApplicationCtrlr.AdvancedSecurityLogin?.NeedChangePassword;
                const changepasswordRoute = this._portalService.getListOfChildPage(pageInfo.pageData).find((c) => c.IsChangePasswordRoute || c.IsChangePasswordRoute === 'True')?.Route || 'changepassword';
                const path = activatedRouteSnapshot.routeConfig?.path;
                if (changepasswordRoute &&
                    path &&
                    path?.indexOf(changepasswordRoute.replace('/', '')) < 0 &&
                    needChangePassword &&
                    !BarsaApi.LoginFormData.IsAnonymous) {
                    this.router.navigate([changepasswordRoute]);
                }
            }
        }), map(([pageInfo]) => pageInfo.hasAuthorized));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AuthGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AuthGuard }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AuthGuard, decorators: [{
            type: Injectable
        }] });

class LocalStorageService {
    constructor() {
        this.localstorage = false;
    }
    setItem(key, value) {
        let valueOfKey = '';
        if (typeof value === 'object' || Array.isArray(value)) {
            valueOfKey = JSON.stringify(value);
        }
        else {
            valueOfKey = value;
        }
        localStorage.setItem(key, valueOfKey);
    }
    getItem(key) {
        return localStorage.getItem(key);
    }
    remove(key) {
        localStorage.removeItem(key);
    }
    clear() {
        localStorage.clear();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LocalStorageService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LocalStorageService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

function formRoutes(authGuard = false) {
    return {
        path: 'form',
        canActivate: authGuard ? [AuthGuard] : [],
        loadChildren: () => Promise.resolve().then(function () { return barsaSapUiFormPage_module; }).then((m) => m.BarsaSapUiFormPageModule)
    };
}

class MultiAppCommandSearchProvider {
    constructor(apps) {
        this.apps = apps;
        this.key = 'command';
        this.priority = 5;
    }
    search(term) {
        return of(!this.apps ? [] : Object.values(this.apps).flatMap((app) => searchCommandsInApp(app, term)));
    }
}
function searchCommandsInApp(app, keyword) {
    const results = [];
    const term = keyword.toLowerCase();
    const groups = app?.ExtraData?.CommandGroups || [];
    const appTitle = app.ExtraData?.Navigator?.Root?.Caption;
    for (const group of groups) {
        for (const command of group.Commands || []) {
            if (command.Caption && command.Caption.toLowerCase().includes(term)) {
                results.push({
                    appId: app.Id,
                    appTitle,
                    source: 'Command',
                    id: command.Name || command.Key,
                    canPin: true,
                    caption: command.Caption,
                    path: `${group.Caption || group.Name}`,
                    original: command,
                    hidden: false,
                    depth: 0,
                    folderId: ''
                });
            }
            for (const menu of command.Menu || []) {
                if (menu.Caption && menu.Caption.toLowerCase().includes(term)) {
                    results.push({
                        appId: app.Id,
                        appTitle,
                        source: 'Command',
                        canPin: true,
                        id: menu.CommandId,
                        caption: menu.Caption,
                        path: `${group.Caption || group.Name} > ${command.Caption}`,
                        original: menu,
                        hidden: false,
                        folderId: '',
                        depth: 0
                    });
                }
            }
        }
    }
    return results;
}

class MultiAppNavigatorSearchProvider {
    constructor(apps) {
        this.apps = apps;
        this.key = 'navigator';
        this.priority = 10;
    }
    search(term) {
        return of(!this.apps ? [] : Object.values(this.apps).flatMap((app) => searchNavigatorInApp(app, term)));
    }
}
function searchNavigatorInApp(app, keyword) {
    const results = [];
    const root = app?.ExtraData?.Navigator?.Root;
    if (!root) {
        return results;
    }
    function walk(node, path, depth = 0) {
        const currentPath = path ? `${path} > ${node.Caption || node.Name}` : node.Caption || node.Name || '';
        if (node.Caption && node.Caption.toLowerCase().includes(keyword.toLowerCase())) {
            let url = '';
            let canPin = false;
            let source = 'Navigator';
            if (!node.IsRoot && node.ReportId && node.ReportId !== '0') {
                url = `#/application/report/${node.FolderId}__${node.Caption}__${node.ReportId}`;
                canPin = true;
                source = 'Report';
            }
            else if (node.IsRoot) {
                url = `#/application/${app.Id}`;
            }
            results.push({
                appId: app.Id,
                appTitle: root.Caption,
                source,
                id: node.Id,
                folderId: node.FolderId,
                url,
                caption: node.Caption,
                path: currentPath,
                original: node,
                hidden: depth === 1,
                depth,
                canPin
            });
        }
        node.Items?.forEach((child) => walk(child, currentPath, depth + 1));
    }
    walk(root, '');
    return results;
}

class SearchService {
    /**
     *
     */
    constructor() {
        this.providers = [];
        this.search$ = new Subject();
        this.results$ = this.search$.pipe(debounceTime$1(250), distinctUntilChanged$1(), switchMap((term) => {
            if (!term || term.length < 2) {
                return of([]);
            }
            return forkJoin(this.providers.map((p) => p.search(term))).pipe(map$1((groups) => groups.flat()));
        }), shareReplay(1));
    }
    register(provider) {
        this.providers.push(provider);
        this.providers.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
    }
    search(term) {
        this.search$.next(term);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SearchService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SearchService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SearchService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [] });

class ApplicationCtrlrService {
    constructor() {
        this._selectedNavGroupItemId$ = new BehaviorSubject({});
        this._selectedReportId$ = new BehaviorSubject({});
        this._selectedReportCaption$ = new BehaviorSubject({});
        this._selectedNavGroupId$ = new BehaviorSubject({});
        this._sidebarToggle$ = new BehaviorSubject(false);
        this._selectedAppTileGroup$ = new BehaviorSubject('');
        this._appMenuItems$ = new BehaviorSubject([]);
        this._systemsUi$ = new BehaviorSubject([]);
        this._selectedSystemId$ = new BehaviorSubject('');
        this._selectedSystemNavUi$ = new BehaviorSubject(null);
        this._selectedCommandId$ = new BehaviorSubject({});
        this._selectedCommandGroups$ = new BehaviorSubject({});
        this._searchNavigators$ = new BehaviorSubject({});
        this._selectedSystemTitle$ = new Subject();
        this._systemLocationHref$ = new BehaviorSubject({});
        this._isMobile = getDeviceIsMobile();
        this._document = inject(DOCUMENT);
        this._router = inject(Router);
        this._searchService = inject(SearchService);
        this._titleService = inject(Title);
    }
    get appMenuItems$() {
        return this._appMenuItems$.asObservable();
    }
    get systemCommandGroups$() {
        return this._selectedSystemNavUi$
            .asObservable()
            .pipe(map$1((c) => (!c ? [] : c.SystemData.CommandGroups || [])));
    }
    get selectedCommand$() {
        return combineLatest([this._selectedCommandId$, this._selectedSystemId$]).pipe(map$1(([selectedCommand, systemId]) => selectedCommand[systemId]));
    }
    get systemWorkflowList$() {
        return this._selectedSystemNavUi$.asObservable().pipe(map$1((c) => (!c ? [] : c.SystemData.WorkflowList || [])));
    }
    get selectedSystemNavUi$() {
        return this._selectedSystemNavUi$.asObservable();
    }
    get selectedCommandGroups$() {
        return combineLatest([this._selectedCommandGroups$, this._selectedSystemId$]).pipe(map$1(([selectedCommandGroups, systemId]) => selectedCommandGroups[systemId]));
    }
    get selectedSystemId$() {
        return this._selectedSystemId$
            .asObservable()
            .pipe(map$1((c) => c || BarsaApi.Ul.ApplicationCtrlr.DefaultSystemId));
    }
    get selectedAppTileGroup$() {
        return this._selectedAppTileGroup$.asObservable();
    }
    get sidebarToggle$() {
        return this._sidebarToggle$.asObservable();
    }
    get sidebarToggle() {
        return this._sidebarToggle$.getValue();
    }
    get selectedNavGroupId$() {
        return combineLatest([this._selectedNavGroupId$, this._selectedSystemId$]).pipe(map$1(([selectedNavGroupsId, systemId]) => selectedNavGroupsId[systemId]));
    }
    get selectedNavGroupItemId$() {
        return this._selectedNavGroupItemId$.pipe(withLatestFrom$1(this._selectedSystemId$), map$1(([selectedNavGroupId, systemId]) => selectedNavGroupId[systemId]));
    }
    get selectedReportId$() {
        return this._selectedReportId$.pipe(withLatestFrom$1(this._selectedSystemId$), map$1(([selectedNavGroupId, systemId]) => selectedNavGroupId[systemId]));
    }
    get selectedSystemId() {
        return this._selectedSystemId$.getValue();
    }
    get searchResults$() {
        return this._searchService.results$;
    }
    get systemCaption$() {
        return this._selectedSystemTitle$.asObservable();
    }
    getSelectedNavGroupItemId(systemId) {
        return this._selectedNavGroupItemId$.getValue()[systemId];
    }
    getSelectedReportId(systemId) {
        return this._selectedReportId$.getValue()[systemId];
    }
    getSelectedReportCaption(systemId) {
        return this._selectedReportCaption$.getValue()[systemId];
    }
    initialize(callback) {
        BarsaApi.Ul.ApplicationCtrlr.on({
            'MetaEventTopics.System_BeforeApplicationStart': () => {
                BarsaApi.Ul.ApplicationCtrlr.DefaultSystemId = this.selectedSystemId || 0;
            }
        });
        BarsaApi.Ul.ApplicationCtrlr.Initialize(() => {
            this._handleEvents();
            const selectedSystem = BarsaApi.Ul.ApplicationCtrlr.GetSelectedSystem();
            this.systemChange(selectedSystem.Id);
            callback && callback(true);
        });
        this._document.documentElement.setAttribute('data-layout', 'vertical');
        //  با تغییر سیستم اسم تب مرورگر تغییر نکند
        // this._selectedSystemTitle$
        //     .asObservable()
        //     .pipe(tap((c) => this._titleService.setTitle(c)))
        //     .subscribe();
    }
    systemChange(systemId) {
        const oldSystemId = this._selectedSystemId$.getValue();
        const systemData = BarsaApi.Ul.ApplicationCtrlr.SystemDict[systemId]?.SystemData;
        this.selectedSystem(systemId, false);
        if (!systemData) {
            //   console.error(`system data for systemid ${systemId} not found.`);
            return;
        }
        if (oldSystemId && !this._urlIsGloablPage()) {
            const href = window.location.href;
            const x = this._systemLocationHref$.getValue();
            x[oldSystemId] = href;
            this._systemLocationHref$.next(x);
            if (systemId && x[systemId] && Object.keys(x).length > 1) {
                window.location.href = x[systemId];
            }
        }
        if (this.deviceSize !== 's' && this.deviceSize !== 'm' && this.deviceSize !== 'l') {
            this.sidebarToggled(true);
        }
        !systemData.IsActive && this._selectedSystemTitle$.next(systemData.Caption);
        this._customApplicationMenuBodyUi.fireEvent('SelectedSystemChanged', this._customApplicationMenuBodyUi, systemData);
    }
    setGlobalPages(pages) {
        this._gloablPages = pages;
    }
    selectAppTileGroup(id) {
        this._selectedAppTileGroup$.next(id);
    }
    setBasePath(basePath) {
        this._basePath = basePath;
    }
    setCommandGroupsSelected(commandGroupCaption) {
        const groupsSelected = this._selectedCommandGroups$.getValue();
        const selectedSystemId = this._selectedSystemId$.getValue();
        const systemId = selectedSystemId;
        groupsSelected[systemId] = commandGroupCaption;
        this._selectedCommandGroups$.next(groupsSelected);
    }
    selectedSystem(systemId, openNavGroupAndItem = true) {
        this._selectedSystemId$.next(systemId);
        const selectedNavGroupId = this._selectedNavGroupId$.getValue()[systemId];
        const selectedNavGroupItemId = this._selectedNavGroupItemId$.getValue()[systemId];
        if (!openNavGroupAndItem) {
            return;
        }
        this.selectNavGroup(selectedNavGroupId, false);
        this.selectNavGroupItem(selectedNavGroupItemId);
    }
    selectSystemCommand(command) {
        // if (command && this._urlIsGloablPage()) {
        //     const x = `${window.location.origin}/${this._basePath}`;
        //     window.location.href = x;
        // }
        this.selectSystemCommandId(command.Key);
        new Promise((resolve, _reject) => {
            // this._routeToSystem(this._selectedSystemId$.getValue());
            if (command.DynamicCommand) {
                BarsaApi.Common.CustomCodeManager.RunDynamicCommand(command.Key, {}, resolve);
            }
            else {
                const key = `${this._selectedSystemId$.getValue()}:${command.Caption}`;
                BarsaApi.Common.CustomCodeManager.ExecFunctions(key, 'click', [
                    { Id: command.CommandId, Caption: command.Caption },
                    { System: BarsaApi.Bw._wrap(BarsaApi.Ul.ApplicationCtrlr.GetSelectedSystem()), E: command }
                ], resolve);
            }
        });
    }
    selectSystemCommandId(id) {
        const selectedCommandId = this._selectedCommandId$.getValue();
        const selectedSystemId = this._selectedSystemId$.getValue();
        const systemId = selectedSystemId;
        selectedCommandId[systemId] = id;
        this._selectedCommandId$.next(selectedCommandId);
    }
    selectNavGroupItem(navGroupItemId) {
        const selectedNavGroupItem = this._selectedNavGroupItemId$.getValue();
        const selectedSystemId = this._selectedSystemId$.getValue();
        const systemId = selectedSystemId;
        selectedNavGroupItem[systemId] = navGroupItemId;
        this._selectedNavGroupItemId$.next(selectedNavGroupItem);
    }
    selectNavGroup(navGroupId, toggle = true) {
        const selectedNavGroup = this._selectedNavGroupId$.getValue();
        const selectedSystemId = this._selectedSystemId$.getValue();
        const systemId = selectedSystemId;
        if (selectedNavGroup[systemId] === navGroupId) {
            toggle && (selectedNavGroup[systemId] = '');
        }
        else {
            selectedNavGroup[systemId] = navGroupId;
        }
        this._selectedNavGroupId$.next(selectedNavGroup);
    }
    sidebarToggled(value) {
        this._sidebarToggle$.next(value);
    }
    selectReportCaption(caption) {
        const selectedReportCaption = this._selectedReportCaption$.getValue();
        const selectedSystemId = this._selectedSystemId$.getValue();
        const systemId = selectedSystemId;
        selectedReportCaption[systemId] = caption;
        this._selectedReportCaption$.next(selectedReportCaption);
    }
    selectedReportId(reportId) {
        const selectedReport = this._selectedReportId$.getValue();
        const selectedSystemId = this._selectedSystemId$.getValue();
        const systemId = selectedSystemId;
        selectedReport[systemId] = reportId;
        this._selectedReportId$.next(selectedReport);
    }
    loadSystem(id, resolve, reject) {
        BarsaApi.Ul.ApplicationCtrlr._loadSystem(id, true, (data) => {
            resolve(data);
        }, (err) => {
            reject(err);
        });
    }
    loadSearchNavigators() {
        let canSupport = false;
        if (BarsaApi.LoginFormData.Version.startsWith('5')) {
            canSupport = isVersionBiggerThan('5.1.37');
        }
        else {
            canSupport = isVersionBiggerThan('4.1.178');
        }
        if (!canSupport) {
            return;
        }
        if (Object.keys(this._searchNavigators$.getValue()).length) {
            return;
        }
        BarsaApi.Common.Ajax.GetServerData('System94.Search', { term: '' }, (e) => {
            this._searchService.register(new MultiAppNavigatorSearchProvider(e));
            this._searchService.register(new MultiAppCommandSearchProvider(e));
        }, (e) => console.error(e), null, this);
    }
    search(e) {
        this._searchService.search(e.text);
    }
    searchItemClick(data) {
        if (data.original.IsRoot) {
            this._routeToSystem(data.appId);
            this.sidebarToggled(true);
        }
        else if (data.source === 'Command') {
            this.selectSystemCommand(data.original);
        }
        else if (data.source === 'Navigator') {
            if (data.original.ReportId === '0') {
                this._routeToSystem(data.appId);
                this.sidebarToggled(true);
                this.selectNavGroup(data.id, false);
            }
            else {
                this._routeToReport(data.id, data.original.Caption, data.original.ReportId);
            }
        }
    }
    _urlIsGloablPage() {
        return this._gloablPages?.some((c) => window.location.href.indexOf(c.Route) > -1) ? true : false;
    }
    _routeToSystem(systemId) {
        this.systemChange(systemId);
    }
    getLastActivatedRoute() {
        let route = this._router.routerState.root;
        while (route.firstChild) {
            route = route.firstChild;
        }
        return route;
    }
    _routeToReport(navGroupId, caption, reportId) {
        this._router.navigate(['application', 'report', navGroupId + '__' + caption + '__' + reportId]);
    }
    flattenLeafCommands(commands) {
        const result = [];
        for (const cmd of commands) {
            if (cmd.Menu && cmd.Menu.length > 0) {
                // خودش حذف میشه، فقط بچه‌هاش بررسی می‌شن
                result.push(...this.flattenLeafCommands(cmd.Menu));
            }
            else {
                result.push(cmd);
            }
        }
        return result;
    }
    // ساخت یک CommandGroup به نام System
    _mergeToSystemGroup(commandGroups) {
        for (const group of commandGroups) {
            !group.Caption && (group.Caption = 'Global');
        }
        return commandGroups;
    }
    _handleEvents() {
        const context = BarsaApi.Ul.ApplicationCtrlr.Adapter.Control;
        context.on({
            AddSystemUi: this._addSystemUi.bind(this),
            AddToMainTabPanel: this._addToMainTabPanel.bind(this),
            SystemChanged: this._selectedSystemChanged.bind(this),
            SetStatusBarValues: this._setStatusBarValues.bind(this),
            ShowReleaseNoteWindow: this._showReleaseNoteWindow.bind(this)
        });
        const appMenuBodyUi = context._appMenuBody;
        appMenuBodyUi.on({
            ButtonListChanged: this._appMenuBodyUi_itemsChanged.bind(this)
        });
        this._appMenuBodyUi_itemsChanged(appMenuBodyUi.items);
        this._customApplicationUi = context;
        if (context._systemsUi?.length) {
            this._selectedSystemChanged(context._selectedSystemId);
        }
        this._addSystemUi(context._systemsUi);
        this._customApplicationMenuBodyUi = appMenuBodyUi;
    }
    _appMenuBodyUi_itemsChanged(items) {
        items.forEach((c) => {
            const x = c.callback;
            c.callback = (e) => {
                x && x(e);
                this._document?.body?.click();
                this.sidebarToggled(true);
            };
        });
        this._appMenuItems$.next([...items]);
    }
    _addSystemUi(_systemUi) { }
    _addToMainTabPanel(_customSystemUi) { }
    _selectedSystemChanged(systemId, _forceRelayout = false) {
        const x = this._customApplicationUi._systemsUi.find((c) => c.SystemData.Id === systemId);
        this._selectSystem(x);
    }
    _selectSystem(system) {
        if (!system) {
            return;
        }
        this.selectedSystem(system.SystemData.Id);
        this._selectedSystemNavUi$.next(system.SystemNavUi);
    }
    _setStatusBarValues(_statusbarValues) { }
    _showReleaseNoteWindow(_releaseNoteData) { }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ApplicationCtrlrService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ApplicationCtrlrService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ApplicationCtrlrService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }] });

class RedirectHomeGuard {
    constructor() {
        this._portalService = inject(PortalService);
        this.router = inject(Router);
    }
    canActivate(route) {
        this._handle(route.queryParams);
        return of(!BarsaApi.LoginFormData.IsAnonymous && BarsaApi.LoginFormData.IsUserLoggedIn).pipe(withLatestFrom(this._portalService.portalData$), tap(([hasAuthorized, portalData]) => {
            if (hasAuthorized) {
                const homePage = this._portalService.DefaultPage ||
                    this._portalService.getListOfChildPage(portalData).find((c) => c.IsDefaultRoute === 'True');
                const homeRoute = homePage?.Route || '/';
                this.router.navigate([homeRoute]);
            }
        }), map(([hasAuthorized]) => !hasAuthorized));
    }
    _handle(params) {
        const { notificationTag, action, moid, tpid } = params;
        if (typeof notificationTag !== 'undefined' && action) {
            const pushAction = {
                notificationTag,
                action,
                moid,
                tpid
            };
            // if (notificationTag === '' && action === 'show') {
            //     setTimeout(() => {
            //         BarsaApi.Bw.Form.Show({
            //             MoId: params.moid,
            //             TypeDefId: params.tpid
            //         });
            //     }, 1000);
            //     return;
            // }
            this._portalService.pushActionNext(pushAction);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RedirectHomeGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RedirectHomeGuard }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RedirectHomeGuard, decorators: [{
            type: Injectable
        }] });

class ReportBreadcrumbResolver {
    resolve(route) {
        const x = this._extractIds(route.params);
        // برگرداندن شیء مورد نظر شما
        return x.ReportId2;
    }
    _extractIds(params) {
        return {
            Id: params.id.split('__')[0],
            ReportId: params.id.split('__').length > 2 ? params.id.split('__')[2] : '',
            ReportId2: params.id.split('__').length > 1 ? params.id.split('__')[1] : '',
            isReportPage: params.id.split('__').length > 3 ? params.id.split('__')[3] : null
        };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportBreadcrumbResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportBreadcrumbResolver, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportBreadcrumbResolver, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

function reportRoutes(authGuard = false) {
    return {
        path: 'report/:id',
        canActivate: authGuard ? [AuthGuard] : [],
        loadChildren: () => import('./barsa-novin-ray-core-barsa-report-page.module-7QOR1HJT.mjs').then((m) => m.BarsaReportPageModule),
        resolve: {
            breadcrumb: ReportBreadcrumbResolver
        }
    };
}

class PortalService {
    constructor() {
        this.offsetTop = 0;
        this.loginLoading = new BehaviorSubject(false);
        this.loaded = false;
        this.formPanels = {};
        this.cachedImages = {};
        this.cachedPageData = {};
        this.pages = [];
        this.rtlSource = new BehaviorSubject(true);
        this.dictionary = {};
        this.portalDataSource = new BehaviorSubject(null);
        this.openForm$ = new Subject();
        this._isAnonumousSource = new BehaviorSubject(true);
        this._pushAction$ = new BehaviorSubject(null);
        this.dcm = inject(DynamicComponentService);
        this.apiService = inject(ApiService);
        this._log = inject(LogService);
        this.dialogService = inject(BarsaDialogService);
        this.compiler = inject(Compiler);
        this._router = inject(Router);
        this._location = inject(Location);
        this._localStorage = inject(LocalStorageService);
        this._document = inject(DOCUMENT);
        this._applicationCtrlrService = inject(ApplicationCtrlrService);
        this._deviceSizeSource = new BehaviorSubject(this._initalizeDeviceSize());
        this._loggedInSource = new BehaviorSubject(false);
        this.routeInitializedSource = new BehaviorSubject(false);
        this.dateTextSource = new BehaviorSubject('');
        this._navigationStart$ = new BehaviorSubject(null);
        this._navigationEnd$ = new BehaviorSubject(null);
        this._userPortalSettings$ = new BehaviorSubject({});
        this._cssUrlSource = new BehaviorSubject(null);
        this._cssVariableUrlSource = new BehaviorSubject(null);
        this._cssCustomUrlSource = new BehaviorSubject(null);
        this._searchTerm$ = new BehaviorSubject('');
        this._windowResize$ = new Subject();
        this._deviceLandscape$ = new BehaviorSubject(!window.matchMedia('(orientation: portrait)').matches);
        this._standalone$ = new BehaviorSubject(window.matchMedia('(display-mode: standalone)').matches);
        this._documentVisibilitychange$ = new Subject();
        this.initialize();
        this._initLandscape();
        this._initStandalone();
        this._initVisibilityChange();
        this._initPushActions();
    }
    get isRtl() {
        return this.rtlSource.getValue();
    }
    get userLoggedIn() {
        return this._loggedInSource.getValue();
    }
    get pushAction$() {
        return this._pushAction$.asObservable().pipe();
    }
    get documentVisibilitychange$() {
        return this._documentVisibilitychange$.asObservable();
    }
    get isStandalone() {
        return this._standalone$.getValue();
    }
    get standalone$() {
        return this._standalone$.asObservable();
    }
    get landscape$() {
        return this._deviceLandscape$.asObservable();
    }
    get windowResize$() {
        return this._windowResize$.asObservable().pipe(debounceTime(100));
    }
    get portalData() {
        return this.portalDataSource.getValue();
    }
    get searchTerm$() {
        return this._searchTerm$.asObservable();
    }
    get cssUrl$() {
        return this._cssUrlSource.asObservable().pipe(distinctUntilChanged());
    }
    get cssVariableUrl$() {
        return this._cssVariableUrlSource.asObservable().pipe(distinctUntilChanged());
    }
    get cssCustomUrl$() {
        return this._cssCustomUrlSource.asObservable();
    }
    get userPortalSettings() {
        return this._userPortalSettings$.getValue();
    }
    get userPortalSettings$() {
        return this._userPortalSettings$.asObservable();
    }
    get deviceSize() {
        return this._deviceSizeSource.getValue();
    }
    get isAnonymous$() {
        return this._isAnonumousSource.asObservable();
    }
    get navigationEnd$() {
        return this._navigationEnd$.asObservable();
    }
    get navigationStart$() {
        return this._navigationStart$.asObservable();
    }
    loadMo(id, typedefId) {
        return this.apiService.loadPortalPageData(id, typedefId);
    }
    setSiteImageUrl(backgroundColor, imageUrl) {
        this.imageUrl = imageUrl;
        this.backgroundColor = backgroundColor;
    }
    pushActionNext(pushAction) {
        this._localStorage.setItem('pushAction', JSON.stringify(pushAction));
        this._pushAction$.next(pushAction);
    }
    setSearchTerm(term) {
        this._searchTerm$.next(term);
    }
    windowResize() {
        this._windowResize$.next();
    }
    naviationEnd(event) {
        this._navigationEnd$.next(event);
    }
    naviationStart(event) {
        this._navigationStart$.next(event);
    }
    setUserPortalSettings(userPortalSettings) {
        const value = this._userPortalSettings$.getValue();
        if (userPortalSettings.$TypeDefName) {
            value[userPortalSettings.$TypeDefName] = userPortalSettings;
            this._userPortalSettings$.next({ ...value });
        }
    }
    setCssUrlTheme(themeUrl, cssVariableUrl) {
        this._cssUrlSource.next(themeUrl);
        this._cssCustomUrlSource.next(themeUrl);
        if (cssVariableUrl) {
            this._cssVariableUrlSource.next(cssVariableUrl);
        }
    }
    setData(key, data) {
        if (!this.dictionary[key]) {
            this.dictionary[key] = new BehaviorSubject(data);
            this.dictionary[key].next(data);
        }
        else {
            const oldVal = this.dictionary[key].getValue();
            if (oldVal !== data) {
                this.dictionary[key].next(data);
            }
        }
    }
    getData(key, defaultValue = null) {
        if (!this.dictionary[key]) {
            this.dictionary[key] = new BehaviorSubject(defaultValue);
        }
        return this.dictionary[key].asObservable();
    }
    getDataSync(key, defaultValue = null) {
        if (!this.dictionary[key]) {
            return defaultValue;
        }
        return this.dictionary[key].getValue();
    }
    createForReport(navItem) {
        return from(new Promise((resolve, reject) => {
            BarsaApi.Ul.UlvMainCtrlr.CreateForReport({}, navItem, (err, result) => {
                if (err) {
                    reject(err);
                }
                else {
                    resolve(result);
                }
            });
        }));
    }
    renderUlvMainUi(navItem, vcr, injector, isReportPage = false) {
        return this.createForReport(navItem).pipe(exhaustMap$1((ulvMainCtrlr) => this.getUlvMainUiComponent(ulvMainCtrlr.Adapter.Control, injector, isReportPage).pipe(tap((ulvManiUiComponent) => vcr.insert(ulvManiUiComponent.hostView)), map(() => ulvMainCtrlr))));
    }
    getUlvMainUiComponent(customUlvMainUi, injector, isReportPage) {
        const customUiSetting = BarsaApi.Common.Util.TryGetValue(customUlvMainUi.Setting, 'CustomUi', null);
        const { moduleName, modulePath, componentName, selector } = getComponentDefined(customUlvMainUi, customUiSetting);
        return this.getComponent(moduleName, modulePath, componentName, selector, injector).pipe(map((component) => {
            const componentInstance = component.instance;
            componentInstance.id = customUlvMainUi.id;
            componentInstance.context = customUlvMainUi;
            componentInstance.isReportPage = isReportPage;
            customUlvMainUi.controlUi = componentInstance;
            return component;
        }));
    }
    initialize() {
        this.deviceSize$ = this._deviceSizeSource.asObservable();
        this.portalData$ = this.portalDataSource.asObservable();
        this.rtl$ = this.rtlSource.asObservable();
        this.userLoggedIn$ = this._loggedInSource.asObservable().pipe(map((isLoggedIn) => isLoggedIn && BarsaApi.LoginFormData.IsAnonymous === false), tap((isloggedIn) => isloggedIn && this._document.body.classList.add('loggedIn')));
        this.dirValue$ = this.rtl$.pipe(map((isRtl) => (isRtl ? 'rtl' : 'ltr')));
        this.routeInitialized$ = this.routeInitializedSource.asObservable().pipe(distinctUntilChanged());
        this._standalone$.asObservable().subscribe((c) => {
            if (c) {
                this._document.body.classList.add('standalone');
            }
            else {
                this._document.body.classList.add('noStandalone');
            }
        });
        this._deviceLandscape$.asObservable().subscribe((c) => {
            if (c) {
                this._document.body.classList.add('landscape');
            }
        });
        this._deviceSizeSource.asObservable().subscribe((c) => {
            if (c === 's') {
                this._document.body.classList.add('smalldevice');
            }
        });
        this.dateText$ = this.dateTextSource.asObservable();
        this.portalSettings$ = this.portalDataSource
            .asObservable()
            .pipe(map((portalData) => (portalData ? portalData.PortalSettings : {})));
        fromEvent(window, 'resize')
            .pipe(startWith(null), debounceTime(1000))
            .subscribe((_c) => {
            this._windowResize$.next();
            this._setDeviceSize();
        });
    }
    _setDeviceSize() {
        const deviceSize = this._initalizeDeviceSize();
        this._applicationCtrlrService.deviceSize = deviceSize;
        this._deviceSizeSource.next(deviceSize);
    }
    _initalizeDeviceSize() {
        const _ismobile = getDeviceIsMobile();
        if (_ismobile) {
            BarsaApi.Bw.IsMobile = true;
            this._document.body.classList.add('mobile');
        }
        const _isTablet = getDeviceIsTablet();
        let _windoWSize = 's';
        if (window.innerWidth <= 600) {
            _windoWSize = 's';
        }
        else if (window.innerWidth > 600 && window.innerWidth <= 992) {
            _windoWSize = 'm';
        }
        else if (window.innerWidth > 992 && window.innerWidth <= 1300) {
            _windoWSize = 'l';
        }
        else {
            _windoWSize = 'xl';
        }
        if (_ismobile && _windoWSize !== 'l' && _windoWSize !== 'xl' && _windoWSize !== 'm') {
            return 's';
        }
        if (_isTablet && _windoWSize !== 'l' && _windoWSize !== 'xl') {
            return 'm';
        }
        return _windoWSize;
    }
    compileModule(dependency) {
        const module$ = this.getModule(dependency);
        return module$.pipe(concatMap((modules) => {
            const moduleFactory = this.getNgModuleFactory(modules, dependency.name);
            return of(moduleFactory);
        }));
    }
    getModule(dependency) {
        const { name, kebabName, umd, exportAs } = dependency;
        const base = `/assets/modules/${kebabName}/bundles`;
        const date = BarsaApi.LoginFormData.abc;
        const path = `${base}/${kebabName}.umd.js?t=${date}`;
        return of(true).pipe(concatMap(() => {
            const modules = this.getRegisteredModules(umd, exportAs, name);
            if (modules) {
                return of(modules);
            }
            return this.loadJs$(path).pipe(map(() => this.getRegisteredModules(umd, exportAs, name)));
        }));
    }
    setValueOnObject(path, index, modules, object) {
        const splited = path.split('.');
        const prop = splited[index];
        if (typeof object[prop] === typeof undefined) {
            object[prop] = {};
        }
        if (index === splited.length - 1) {
            object[prop] = modules;
            return;
        }
        this.setValueOnObject(path, index + 1, modules, object[prop]);
    }
    getComponentType(moduleName, componentName, selector) {
        return this.dcm.getComponentType(selector, componentName, moduleName);
    }
    getComponent(moduleName, _modulePath, componentName, selector, parentInjector) {
        return this.dcm.getComponentBySelector(selector, componentName, moduleName, parentInjector);
    }
    loadJs$(path) {
        return from(new Promise((resolve, reject) => {
            const script = document.createElement('script');
            script.setAttribute('type', 'text/javascript');
            script.setAttribute('src', path);
            script.onload = () => {
                resolve(path);
            };
            document.getElementsByTagName('head')[0].appendChild(script);
            setTimeout(() => {
                reject();
            }, 5000);
        }));
    }
    ReportExecuteById(reportId) {
        const ulvParams = this._getUlvParamsBy('', reportId);
        return from(this._reportExecutePromise(ulvParams));
    }
    ReportExecute(reportName) {
        return from(this.ReportExecutePromise(reportName));
    }
    ReportExecutePromise(reportName) {
        const ulvParams = this._getUlvParamsBy(reportName);
        return this._reportExecutePromise(ulvParams);
    }
    addFormPanelCtrlr(id, formpanelCtrlr) {
        this.formPanels[id] = formpanelCtrlr;
    }
    setUserLoginStatus(status) {
        this._loggedInSource.next(status);
    }
    getListOfChildPage(model) {
        return !model
            ? []
            : model.ChildPageList2?.MoDataList.length
                ? model.ChildPageList2.MoDataList
                : model.ChildPageList?.MoDataList || [];
    }
    extractAllPages(portalData) {
        if (!portalData) {
            return;
        }
        this.getListOfChildPage(portalData).forEach((pageData) => {
            this.addChildPages(pageData);
        });
    }
    extractAllPages_Old(portalData) {
        if (!portalData) {
            return;
        }
        const config = this._router.config;
        this.getListOfChildPage(portalData).forEach((pageData) => {
            const path = pageData.Route.replace('/', '');
            config.push(this.createRoute(pageData, path, pageData.HasAuthorize, pageData.PageModule?.$Caption, null, null));
            if (pageData.IsDefaultRoute || pageData.IsDefaultRoute === 'True') {
                this.defaultRoute = path;
                config.push(this.createRoute(pageData, '', false, portalData.PageModule?.$Caption, path, null));
            }
            this.addChildPages(pageData);
        });
        this._router.resetConfig(config);
        if (this._location.path() === '') {
            // this._router.navigate([this.defaultRoute]);
            this._router.navigate(['']);
        }
        // this.routeInitialized();
    }
    ssoLogin() {
        AjaxHelper.AjaxRequest('/api/base/ssologin', null, false, () => { }, () => {
            alert('error in sso login.');
        }, null);
    }
    ssoLogout() {
        AjaxHelper.AjaxRequest('/api/base/ssologout', null, false, () => { }, () => {
            alert('error in sso logout.');
        }, null);
    }
    addChildPages(pageData) {
        this.pages.push(pageData);
        if (!this.getListOfChildPage(pageData).length) {
            return;
        }
        this.getListOfChildPage(pageData).forEach((childPage) => {
            this.addChildPages(childPage);
        });
    }
    /* eslint-disable */
    createRoute(pageData, path, hasAuthorized, moduleName, redirectTo, isDynamicRoute) {
        return {};
    }
    createRoute2(pageData, path, hasAuthorized, moduleName, redirectTo = null, isDynamicRoute = false) {
        let modulePath = BarsaApi.Common.Util.GetKebabCase(moduleName);
        const umd = moduleName;
        modulePath = modulePath.substring(1, modulePath.length);
        const dynamicRoute = {};
        dynamicRoute.path = path;
        dynamicRoute.data = { pageData };
        if (!isDynamicRoute) {
            dynamicRoute.resolve = {
                pageData: PortalPageResolver
            };
        }
        if (path === '') {
            dynamicRoute.pathMatch = 'full';
        }
        if (redirectTo) {
            dynamicRoute.redirectTo = redirectTo;
        }
        else {
            if (hasAuthorized) {
                dynamicRoute.canActivate = [AuthGuard];
            }
            dynamicRoute.loadChildren = () => {
                const dependencies = JSON.parse(pageData.Dependencies); // eval(pageData.Dependencies);
                const pageLibrary = {
                    name: moduleName,
                    kebabName: modulePath,
                    umd,
                    exportAs: [moduleName]
                };
                const dependencies$ = from(dependencies).pipe(concatMap((dependency) => this.compileModule(dependency)));
                return forkJoin([dependencies$]).pipe(concatMap(() => this.getModule(pageLibrary)), map((modules) => modules[moduleName + 'Module']), tap(() => this.routeInitialized()));
            };
        }
        return dynamicRoute;
    }
    routeInitialized() {
        this.routeInitializedSource.next(true);
    }
    loginByAnonymous() {
        this.loginLoading.next(true);
        return this.apiService.loginPortal().pipe(map((result) => {
            if (typeof result === 'object' && result !== null) {
                this._log.debug(result);
                window.localStorage.setItem(BarsaApi.LoginAction.token2StorageKey, result.data.sth);
                return true;
            }
            else {
                return false;
            }
        }), finalize(() => {
            this.loginLoading.next(false);
        }));
    }
    getPageData(url, isRoot) {
        if (isRoot || url === '' || url === '/') {
            return this.portalData$;
        }
        if (url.indexOf('?') > -1) {
            url = url.substr(0, url.indexOf('?'));
        }
        if (this.cachedPageData[url]) {
            return this.cachedPageData[url];
        }
        const pageData = this.findPageByRoute(url);
        this._addToCachePageData(pageData, url);
        // this.cachedPageData[url] = this.portalData$.pipe(
        //   filter((portalData) => portalData != null),
        //   map((portalData) => ),
        //   concatMap((pageData) => {
        //     return
        //   }),
        //   tap(pageData=>{})
        // );
        return this.cachedPageData[url];
    }
    resolveData(routePageData) {
        // const pageData = this.pages.find((c) => c.Route === routePageData.Route && c.Module === routePageData.Module);
        const pageData = this.pages.find((c) => c.Route === routePageData.Route);
        if (!pageData) {
            return of(null);
        }
        const id = pageData.Id;
        if (this.cachedPageData[id]) {
            return this.cachedPageData[id];
        }
        this._addToCachePageData(pageData, id);
        // this.cachedPageData[url] = this.portalData$.pipe(
        //   filter((portalData) => portalData != null),
        //   map((portalData) => ),
        //   concatMap((pageData) => {
        //     return
        //   }),
        //   tap(pageData=>{})
        // );
        return this.cachedPageData[id];
    }
    addChildRoute(pageMo, ChildPageList) {
        return;
    }
    addChildRoute_Old(pageMo, ChildPageList) {
        if (!ChildPageList?.MoDataList?.length) {
            return;
        }
        const config = this._router.config;
        const parentPath = pageMo.Route.replace('/', '');
        const parentRoute = config.find((c) => (c.path = parentPath));
        const children = [];
        if (parentRoute) {
            ChildPageList.MoDataList.forEach((child) => {
                const path = child.Route.replace('/', '');
                const childroute = this.createRoute(child, path, child.HasAuthorize, child.PageModule?.$Caption, null, true);
                children.push(childroute);
            });
            // debugger;
            parentRoute._loadedConfig.routes[0].children = children;
            this._router.resetConfig(config);
        }
    }
    loadPortalData_Old1() {
        return this.apiService.loadPortal(BarsaApi.LoginFormData.PortalId, BarsaApi.LoginFormData.PortalTypeDefId).pipe(tap((portalSetting) => {
            const portalData = portalSetting.Data.Mo;
            this.extractAllPages(portalData);
            this.portalDataSource.next(portalData);
        }), concatMap(() => from(this.loadSystem())), tap((all) => this.dateTextSource.next(BarsaApi.LoginFormData.DateText)));
    }
    loadPortalDataSync_Old2() {
        const portalSetting = this.apiService.loadPortalSync(BarsaApi.LoginFormData.PortalId, BarsaApi.LoginFormData.PortalTypeDefId);
        const portalData = portalSetting.Data.Mo;
        this.extractAllPages(portalData);
        this.portalDataSource.next(portalData);
        this.loadSystem();
        this.dateTextSource.next(BarsaApi.LoginFormData.DateText);
    }
    _getDefaultPage(c) {
        if (!c || !c.length) {
            return null;
        }
        let x = c.find((c) => c.IsDefaultRoute === 'True');
        if (x) {
            return x;
        }
        let x2 = null;
        c.forEach((element) => {
            if (x2) {
                return;
            }
            x2 = this._getDefaultPage(this.getListOfChildPage(element));
        });
        return x2;
    }
    _addPage(routes, page) {
        const portalService = this;
        const traverse = (children, cpage) => {
            if (!children) {
                return;
            }
            const path = cpage.RoutePath;
            const x = this.getListOfChildPage(cpage);
            const pageComponent = portalService.getComponentType(cpage.Module, cpage.ComponentName, cpage.ComponentSelector);
            const newRoute = {
                path: (cpage.IsDefaultRoute === 'True' && path === '') || (path !== '' && typeof path !== 'undefined')
                    ? path
                    : cpage.Route.replace('/', ''),
                canActivate: cpage.HasAuthorize === 'True'
                    ? [AuthGuard]
                    : cpage.IsLoginRoute === 'True'
                        ? [RedirectHomeGuard]
                        : [],
                resolve: { pageData: PortalPageResolver },
                component: pageComponent,
                outlet: cpage.Outlet ? cpage.Outlet : undefined,
                data: {
                    pageData: {
                        ...cpage
                    }
                },
                children: []
            };
            const constChildRoutes = [reportRoutes(), formRoutes()];
            if (!x.length || x.find((c) => c.IsDefaultRoute !== 'True')) {
                newRoute.children = constChildRoutes;
            }
            children.push(newRoute);
            // Recursively process each MetaObjectModel inside MoDataList
            x.forEach((c) => traverse(newRoute.children, c));
        };
        traverse(routes, page);
    }
    loadPortalDataSync() {
        if (BarsaApi.LoginFormData?.error?.userMessage) {
            return;
        }
        const portalSettingStr = BarsaApi.Bw.RunBlMethod('GetPortal', BarsaApi.LoginFormData.PortalId);
        const portalSetting = BarsaApi.Ext.decode(portalSettingStr);
        const portalData = portalSetting;
        if (portalData) {
            const defaultPage = this._getDefaultPage(this.getListOfChildPage(portalData));
            const isdynamicroute = portalData.IsDynamicRoute === 'True';
            this.DefaultPage = defaultPage;
            let configRoute = this._router.config;
            const removePaged = [];
            configRoute.forEach((c, index) => {
                const route = '/' + c.path;
                if (c.path !== '' && this.getListOfChildPage(portalData).findIndex((d) => d.Route === route) === -1) {
                    removePaged.push(c);
                }
            });
            const pathToRemove = removePaged.map((d) => d.path);
            configRoute = configRoute.filter((c) => pathToRemove.indexOf(c.path) === -1);
            const newConfigRoutes = [];
            this.getListOfChildPage(portalData).forEach((c) => {
                this._addPage(newConfigRoutes, c);
            });
            if (defaultPage != null) {
                const defaultPageRoute = defaultPage.Route.replace('/', '');
                if (isdynamicroute) {
                    const defaultPath = newConfigRoutes.find((c) => c.path === '');
                    defaultPath && (defaultPath.redirectTo = defaultPageRoute);
                    newConfigRoutes.push({ path: '**', redirectTo: defaultPageRoute });
                    newConfigRoutes.push({ path: '', redirectTo: defaultPageRoute, pathMatch: 'full' });
                }
                else {
                    const defaultPath = configRoute.find((c) => c.path === '');
                    defaultPath && (defaultPath.redirectTo = defaultPageRoute);
                    configRoute.push({ path: '**', redirectTo: defaultPageRoute });
                }
                // const notFoundPath = configRoute.find((c) => c.path === '**');
                // notFoundPath && (notFoundPath.redirectTo = defaultPage.Route.replace('/', ''));
                this._router.resetConfig(isdynamicroute ? newConfigRoutes : configRoute);
            }
        }
        this.extractAllPages(portalData);
        this.portalDataSource.next(portalData);
        this.dateTextSource.next(BarsaApi.LoginFormData.DateText);
    }
    ShowForm(e) {
        BarsaApi.Bw.Form.Show({
            Mo: e.mo,
            MoContext: {
                ViewName: e.nama
            },
            EventHandlers: {
                AfterReady: function (sender, ee) {
                    //do something here
                    e.afterReady?.(ee);
                }
            }
        });
    }
    get loginRoute$() {
        return this.portalData$.pipe(map((portalData) => {
            const loginPage = this.getListOfChildPage(portalData).find((c) => c.IsLoginRoute === 'True');
            return loginPage?.Route || 'login';
        }));
    }
    RunBlMethodAsync(methodName, parameters) {
        return new Promise((resolve, reject) => {
            BarsaApi.Bw.RunBlMethodAsync({
                Parameters: parameters,
                Method: methodName,
                SuccessFn: (data) => {
                    resolve(data);
                },
                FailFn: (err) => {
                    reject(err);
                }
            });
        });
    }
    ExecuteNotificationAction(id, actionTitle) {
        BarsaApi.Bw.RunBlMethodAsync({
            Parameters: [id, actionTitle],
            Method: 'ExecuteNotificationAction',
            SuccessFn: (e) => {
                this._removePushAction();
                if (e.DynamicCommandId) {
                    ExecuteDynamicCommand({ Id: e.DynamicCommandId }, e.Mo);
                }
                else if (e.ShowFormSetting) {
                    const { MoId, ViewName } = e.ShowFormSetting;
                    setTimeout(() => BarsaApi.Bw.Form.Show({ MoId, MoContext: { ViewName } }), 500);
                }
            },
            FailFn: (e) => {
                this._removePushAction();
                this._log.error(e);
            }
        });
    }
    loadUserPortalSetting() {
        if (BarsaApi.LoginFormData?.error?.userMessage) {
            return;
        }
        const ulvParams = {
            Flags: {
                Data: 'True',
                Extra: 'False',
                Search: 'False',
                View: 'False'
                // General:"False", // ulvmainctrl does not craete ui control raise error
            },
            ReportName: '_تنظيمات_پايه_پورتال',
            UsageEnum: 'SystemContainer'
        };
        BarsaApi.Bw.ExecuteReport({ ulvParams }, (result) => {
            const molist = result.Data.MoDataList;
            const userPortalSetting = {};
            molist.forEach((mo) => {
                if (mo.Inheritance && mo.Inheritance.$TypeDefName) {
                    userPortalSetting[mo.Inheritance.$TypeDefName] = mo.Inheritance;
                }
            });
            this._userPortalSettings$.next(userPortalSetting);
        }, (err) => {
            this._log.error(err);
        });
        // BarsaApi.Bw.RunBlMethodAsync({
        //     Parameters: [],
        //     Method: 'GetUserPortalSettings',
        //     SuccessFn: (userPortalSetting: MetaobjectDataModel) => {
        //     },
        //     FailFn: (e) => {
        //         this.logService.error(e);
        //     }
        // });
    }
    loadServerStartupData() {
        return new Promise((resolve, reject) => {
            if (!BarsaApi.Offline.hasInit) {
                BarsaApi.Offline.afterInitCallback = () => {
                    this._loadServerStartupData(resolve, reject);
                };
            }
            else
                this._loadServerStartupData(resolve, reject);
        });
    }
    _loadServerStartupData(resolve, reject) {
        const ajaxHelper = typeof AjaxHelper2 === 'undefined' ? AjaxHelper : AjaxHelper2;
        ajaxHelper.AjaxRequest('/api/base/ServerStartupData', {}, false, (response) => {
            let dataText = response.responseText;
            dataText = dataText.replace(/'/g, '"');
            dataText = BarsaApi.Common.Util.ReplaceArabicCharchter(dataText);
            BarsaApi.LoginForm.PortalInitialize(dataText);
            if (typeof BarsaApi.LoginFormData.IsAnonymous === 'undefined') {
                if (BarsaApi.LoginFormData?.error?.userMessage) {
                    BarsaApi.Bw.Msg.Error(BarsaApi.LoginFormData?.error?.userMessage);
                }
                else {
                    BarsaApi.Bw.Msg.Error('امکان ورود با کاربر پورتال وجود ندارد.');
                }
            }
            if (BarsaApi.LoginFormData.IsServiceDesk) {
                const config = this._router.config;
                config[0].redirectTo = 'servicedesk';
                this._router.resetConfig(config);
            }
            this._initAfterLoginFormData();
            resolve(BarsaApi.LoginFormData);
        }, () => {
            alert('error in get server startup data.');
            reject('error in get server startup data.');
        }, null);
    }
    ShowFormPanelControl(formpanelCtrlr, router, activatedRoute, dialogComponent, isPage, vcr, isReload = false) {
        if (!formpanelCtrlr) {
            console.warn('form panel controler is undefined!');
            return;
        }
        const mo = formpanelCtrlr.Mo;
        const headerLayout = BarsaApi.Common.Util.TryGetValue(formpanelCtrlr, 'Setting.View.HeaderLayout', null);
        let isModal = BarsaApi.Common.Util.TryGetValue(formpanelCtrlr, 'Setting.View.ExtraJsonProp.Modal', false);
        isModal =
            isModal ||
                BarsaApi.Common.Util.TryGetValue(formpanelCtrlr, 'Setting.View.CustomUi.Parameters.IsModal', false);
        const modalSetting = BarsaApi.Common.Util.TryGetValue(formpanelCtrlr, 'Setting.View.CustomUi.Parameters.ModalSetting', null);
        if (modalSetting) {
            isModal = true;
        }
        formpanelCtrlr.Setting.IsModal = isModal;
        formpanelCtrlr.IsModal = isModal;
        const breadCrumb = getHeaderValue(headerLayout?.BreadCrumb);
        const queryParams = {
            id: mo.$State === 'New' ? '0' : mo.Id,
            tyid: mo.$TypeDefId,
            tycp: mo.$Caption ? mo.$Caption : null,
            repid: mo.$ReportId,
            vid: formpanelCtrlr?.Setting?.View?.TypeViewId,
            bc: breadCrumb ? breadCrumb : mo.$State === 'New' ? mo.$TypeDefName : mo.$Caption
        };
        const id = getUniqueId(4);
        this.addFormPanelCtrlr(id, formpanelCtrlr);
        this.openForm$.next(); // event emit for other components to know form open
        if (isModal) {
            if (dialogComponent) {
                this.dialogService.showForm(dialogComponent, {
                    ...queryParams,
                    formpanelCtrlr
                }, vcr);
            }
            else {
                this._log.error(nullOrUndefinedString('portelService => dialogComponent'));
            }
        }
        else {
            const state = { formPanelCtrlrId: id };
            if (isPage) {
                router.navigate([
                    'form',
                    {
                        outlets: {
                            main: ['show', { ...queryParams, formPanelCtrlrId: id, isFirst: true }]
                        }
                    }
                ], {
                    state,
                    relativeTo: activatedRoute,
                    skipLocationChange: isReload
                });
            }
            else {
                router.navigate([
                    'popup',
                    {
                        outlets: {
                            main: ['show', { ...queryParams, formPanelCtrlrId: id }]
                        }
                    }
                ], {
                    relativeTo: activatedRoute,
                    state,
                    queryParamsHandling: 'preserve',
                    skipLocationChange: isReload
                });
            }
        }
    }
    loadSystem(id = 0) {
        if (BarsaApi.LoginFormData?.error?.userMessage) {
            return Promise.reject(BarsaApi.LoginFormData?.error?.userMessage);
        }
        if (id === 0) {
            BarsaApi.Ul.ApplicationCtrlr.DefaultSystemId = null;
        }
        return new Promise((resolve, reject) => {
            this._applicationCtrlrService.loadSystem(id, (data) => {
                resolve(data);
            }, (err) => {
                reject(err);
            });
        });
    }
    _addToCachePageData(pageData, url) {
        const x = this.portalDataSource.getValue();
        const typedefIdX = x?.ChildPageList?.TypeDefId || x?.ChildPageList2?.TypeDefId;
        this.cachedPageData[url] = this.apiService.loadPortalPageData(pageData?.Id, typedefIdX).pipe(map((pageMo) => pageMo.Data.Mo), tap((pageMo) => {
            this.addChildPages(pageMo);
        }), publishReplay(1), refCount());
    }
    _getUlvParamsBy(reportName, reportId) {
        return {
            Flags: {
                Data: 'True',
                Extra: 'False',
                Search: 'False',
                View: 'False'
                // General:"False", // ulvmainctrl does not craete ui control raise error
            },
            ReportName: reportName,
            ReportId: reportId,
            UsageEnum: 'SystemContainer'
        };
    }
    _reportExecutePromise(ulvParams) {
        return new Promise((resolve, reject) => {
            BarsaApi.Bw.ExecuteReport({ ulvParams }, (result) => {
                resolve(result.Data);
            }, (err) => {
                reject(err);
            });
        });
    }
    _removePushAction() {
        const pushActionStr = this._localStorage.getItem('pushAction');
        if (pushActionStr) {
            this._localStorage.remove('pushAction');
            const pushAction = JSON.parse(pushActionStr);
            this._pushAction$.next(pushAction);
        }
    }
    _checkLocalStoragePushAction() {
        const pushActionStr = this._localStorage.getItem('pushAction');
        if (pushActionStr) {
            this._localStorage.remove('pushAction');
            const pushAction = JSON.parse(pushActionStr);
            this._pushAction$.next(pushAction);
        }
    }
    _initAfterLoginFormData() {
        this._setRtl(BarsaApi.LoginFormData.IsRtl);
        this._isAnonumousSource.next(BarsaApi.LoginFormData.IsAnonymous);
        this.setUserLoginStatus(BarsaApi.LoginFormData.IsUserLoggedIn);
        this._loggedInSource.next(this._loggedInSource.getValue() && BarsaApi.LoginFormData.IsAnonymous === false);
    }
    _setRtl(isRtl) {
        this.rtlSource.next(isRtl);
        this._document.documentElement.setAttribute('dir', isRtl ? 'rtl' : 'ltr');
    }
    _initVisibilityChange() {
        document.addEventListener('visibilitychange', () => {
            if (document.visibilityState === 'visible') {
                this._documentVisibilitychange$.next(false);
            }
            else {
                this._documentVisibilitychange$.next(true);
            }
        });
    }
    _initStandalone() {
        window.matchMedia('(display-mode: standalone)').addEventListener('change', (e) => {
            const isMatch = e.matches;
            if (isMatch) {
                this._standalone$.next(true);
            }
            else {
                this._standalone$.next(false);
            }
        });
    }
    _initPushActions() {
        this._checkLocalStoragePushAction();
        combineLatest([this.userLoggedIn$, this.pushAction$])
            .pipe(
        // withLatestFrom(this._portalService.pushAction$),
        // filter(([userLoggedin, action]) => userLoggedin)
        filter(([userLoggedin, pushAction]) => userLoggedin))
            .subscribe(([userLoggedin, pushAction]) => {
            if (pushAction != null) {
                if (!pushAction.notificationTag) {
                    if (pushAction.moid && pushAction.tpid && pushAction.action == 'show') {
                        setTimeout(() => BarsaApi.Bw.Form.Show({ MoId: pushAction.moid }), 500);
                    }
                }
                else {
                    this.ExecuteNotificationAction(pushAction.notificationTag, pushAction.action);
                }
            }
        });
    }
    _initLandscape() {
        window.matchMedia('(orientation: portrait)').addEventListener('change', (e) => {
            const isMatch = e.matches;
            if (isMatch) {
                this._deviceLandscape$.next(false); // portrait
            }
            else {
                this._deviceLandscape$.next(true); // landscape
            }
        });
    }
    findPageByRoute(url) {
        const findedPage = this.pages.find((c) => c.Route === url);
        return findedPage || null;
    }
    getNgModuleFactory(modules, moduleName) {
        const moduleClass = modules[moduleName + 'Module'];
        let moduleFactory;
        if (moduleClass instanceof NgModuleFactory) {
            moduleFactory = moduleClass;
        }
        else {
            const compiled = this.compiler.compileModuleAndAllComponentsSync(moduleClass);
            moduleFactory = compiled.ngModuleFactory;
        }
        return moduleFactory;
    }
    getRegisteredModules(umd, exportAs, moduleName) {
        let modules;
        if (umd !== '') {
            modules = window;
            umd.split('.').forEach((c) => {
                if (typeof modules !== typeof undefined) {
                    modules = modules[c];
                }
            });
        }
        else {
            modules = window[moduleName];
        }
        if (exportAs.length > 0 && modules) {
            exportAs.forEach((c) => {
                this.setValueOnObject(c, 0, modules, window);
            });
        }
        return modules;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [] });

class UiService {
    constructor() {
        this.tabSelected = new Subject();
        this.tabSelected$ = this.tabSelected.asObservable();
        this.menuToggleSubject = new Subject();
        this.menuToggle$ = this.menuToggleSubject.asObservable();
    }
    toggleMenu(toggle) {
        this.menuToggleSubject.next(toggle);
    }
    setTabSelected(val) {
        this.tabSelected.next(val);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UiService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UiService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class UlvMainService {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this.moDataListSource = new BehaviorSubject([]);
        this._cartableTemplates$ = new BehaviorSubject({});
        this._cartableChildsMo$ = new BehaviorSubject({});
        this.openOneClick = false;
        this._bbbPipe = inject(BbbTranslatePipe);
        this._apiService = inject(ApiService);
        this._setUiViewerSelector$ = new Subject();
        this._gridFreeColumnSizing$ = new BehaviorSubject(false);
        this._layoutInfoSource = new Subject();
        this._contextSource = new Subject();
        this._canSaveGridSetting$ = new BehaviorSubject(false);
        this._inDialog$ = new BehaviorSubject(false);
        this._isMultiSelect$ = new BehaviorSubject(false);
        this._fullscreen$ = new BehaviorSubject(false);
        this._conditionalFormatsSource = new BehaviorSubject([]);
        this._reportSource = new BehaviorSubject(null);
        this._viewerControlSource = new BehaviorSubject(null);
        this._hideToolbarSource = new BehaviorSubject(true);
        this._onDestroy$ = new Subject();
        this._maskSource = new BehaviorSubject(false);
        this._showContextMenuSource = new Subject();
        this._viewerMaskSource = new BehaviorSubject(false);
        this._visibleSource = new BehaviorSubject(true);
        this._enableSource = new BehaviorSubject(true);
        this._readonlySource = new BehaviorSubject(false);
        this._menuItemsSource = new BehaviorSubject([]);
        this._onlyInlineEditSource = new BehaviorSubject(false);
        this._inlineEditModeSource = new BehaviorSubject(false);
        this._allowInlineEditSource = new BehaviorSubject(false);
        this._gridSettingSource = new BehaviorSubject(DefaultGridSetting);
        this._gridAllowSortSource = new BehaviorSubject(false);
        this._contentHeightSource = new BehaviorSubject(0);
        this._hiddenOverflowContentSource = new BehaviorSubject(false);
        this._cartableKeySeperator = '@';
        this._titleSource = new BehaviorSubject({
            text: '',
            image: ''
        });
        this._hideUlvPageTitle$ = new BehaviorSubject(false);
        this._searchPanelUiSource = new BehaviorSubject(null);
        this._pagingSettingSource = new BehaviorSubject(null);
        this._toolbarButtonsSource = new BehaviorSubject([]);
        this._toolbarButtonsReportViewSource = new BehaviorSubject([]);
        this._toolbarButtonsWorkflowButtons = new BehaviorSubject([]);
        this._destroySource = new Subject();
        this._firstApplyAutomatically = true;
        this._controlInfosMetaobject = [];
        this._selectedSearchPanelSettingsIdSource = new BehaviorSubject('');
        this._defaultSearchPanelSettingsSource = new Subject();
        this._allSearchPanelSettingsSource = new BehaviorSubject([]);
        this._cssBackgroundSource = new BehaviorSubject(null);
        this._shortCutsSource = new BehaviorSubject({});
        this._hidePagingSource = new BehaviorSubject(false);
        this._openSearchPanelHiddenSettingsSource = new Subject();
        this._openSearchFilesManageSource = new Subject();
        this._searchPanelMoChangedSource = new BehaviorSubject(false);
        this._newInlineEditMoSource = new BehaviorSubject(null);
        this._hideSearchapanelSource = new BehaviorSubject(false);
        this._workflowShareButtons = [];
        this._prepareMoForNewForm$ = new Subject();
        this._hideViewerLoadingSource = new BehaviorSubject(false);
        this._commandsAccessSource = new BehaviorSubject(DefaultCommandsAccessValue);
        this._viewCollectionSource = new BehaviorSubject([]);
        this._useLayoutItemTextForControlSource = new BehaviorSubject(false);
        this._hideTitleSource = new BehaviorSubject(true);
        this._createNewInlineMo$ = new Subject();
        this._sortSettingChanged$ = new Subject();
        this._updateGridSettingByUser$ = new Subject();
        this._selectedView$ = new BehaviorSubject(null);
        this._ulvHeightSizeTypeSource = new BehaviorSubject(UlvHeightSizeType.Default);
        this._ulvHeightSizeSource = new BehaviorSubject(0);
        this._toolbarSettingsSource = new BehaviorSubject(null);
        this._viewSettingsSource = new BehaviorSubject({});
        this.context$ = this._contextSource
            .asObservable()
            .pipe(takeUntil(this._onDestroy$), tap((context) => (this.context = context)), tap((context) => this._initialize(context)), tap((context) => this._addEventListener(context)))
            .subscribe();
        this.newInlineEditMo$ = this._newInlineEditMoSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.viewer$ = this._viewerControlSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.conditionalFormats$ = this._conditionalFormatsSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.hideToolbar$ = this._hideToolbarSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.mask$ = this._maskSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.viwerMask$ = this._viewerMaskSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.visible$ = this._visibleSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.enable$ = this._enableSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.readonly$ = this._readonlySource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.hideUlvPageTitle$ = this._hideUlvPageTitle$.asObservable().pipe(takeUntil(this._onDestroy$));
        this.uiViewerSelector$ = this._setUiViewerSelector$.asObservable();
        this.menuItems$ = this._menuItemsSource.asObservable().pipe(takeUntil(this._onDestroy$), filter((items) => items?.length > 0), map((items) => items.filter((c) => c.itemId !== 'ExportToExcel' && c.itemId !== 'Delete')));
        this.title$ = this._titleSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.searchPanelUi$ = this._searchPanelUiSource.asObservable().pipe(takeUntil(this._onDestroy$), tap((searchPanel) => this._addDefaultSearchPanelSettings(searchPanel)));
        this.openSearchPanelHiddenSettings$ = this._openSearchPanelHiddenSettingsSource.asObservable();
        this.pagingSetting$ = this._pagingSettingSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.toolbarButtons$ = combineLatest([
            this._toolbarButtonsWorkflowButtons.asObservable(),
            this._toolbarButtonsSource.asObservable()
        ]).pipe(takeUntil(this._onDestroy$), map(([wfBtns, c]) => !c
            ? []
            : [
                ...wfBtns,
                ...c.map((d) => ({
                    ...d,
                    hideText: !d.Command?.IsBuiltin ||
                        d.itemId === 'New' ||
                        d.itemId === 'AddToList' ||
                        d.itemId === 'RemoveFromList'
                        ? false
                        : true
                }))
            ].reverse()), map((c) => !c ? [] : [...c.filter((d) => !d.Command?.IsBuiltin), ...c.filter((d) => d.Command?.IsBuiltin)]), map((c) => c.reduce((acc, b) => (acc.length > 0 && acc[acc.length - 1]['0'] && b['0'] ? acc : [...acc, b]), [])), map((c) => this._setPriorityAndPriorityGroup(c)));
        this.destroy$ = this._destroySource.asObservable().pipe(tap(() => this._unscubscribeContext()));
        this.moDataList$ = this.moDataListSource.asObservable().pipe();
        this.selectedCount$ = this.moDataList$.pipe(map((items) => items.filter((d) => d.$IsChecked).length));
        this.reportId$ = this._reportSource.asObservable().pipe(map((report) => report?.Id));
        this.allowInlineEdit$ = this._allowInlineEditSource.asObservable();
        this.inlineEditMode$ = this._inlineEditModeSource.asObservable();
        this.onlyInlineEdit$ = this._onlyInlineEditSource.asObservable();
        this.openSearchFilesManage$ = this._openSearchFilesManageSource.asObservable();
        this.searchPanelMoChanged$ = this._searchPanelMoChangedSource.asObservable().pipe(distinctUntilChanged());
        this.layoutInfo$ = this._layoutInfoSource.asObservable().pipe(shareReplay$1(1));
        this.allSearchPanelSettings$ = combineLatest([
            this._allSearchPanelSettingsSource.asObservable(),
            this._defaultSearchPanelSettingsSource.asObservable()
        ]).pipe(map(([allSettings, defaultSettings]) => {
            if (defaultSettings && allSettings) {
                defaultSettings.IsDefault = !allSettings.some((c) => c.IsDefault);
                allSettings = [defaultSettings, ...allSettings];
            }
            return allSettings;
        }), delay(0), shareReplay$1(1));
        this.selectedSearchPanelSettingsId$ = this._selectedSearchPanelSettingsIdSource
            .asObservable()
            .pipe(distinctUntilChanged());
        this.selectedSearchPanelSettings$ = combineLatest([
            this.selectedSearchPanelSettingsId$,
            this.allSearchPanelSettings$
        ]).pipe(map(([id, settings]) => settings?.find((c) => c.Id === id)), shareReplay$1(1));
    }
    _setPriorityAndPriorityGroup(toolbarButtons) {
        let counter = 10;
        toolbarButtons.forEach((btn) => {
            if (btn.Command?.IsBuiltin) {
                switch (btn.itemId) {
                    case 'AddToList': {
                        btn.priorityGroup = 1;
                        btn.priority = 'never';
                        break;
                    }
                    case 'RemoveFromList': {
                        btn.priorityGroup = 1;
                        btn.priority = 'never';
                        break;
                    }
                    case 'New': {
                        btn.priorityGroup = 2;
                        btn.priority = 'high';
                        break;
                    }
                    case 'Edit': {
                        btn.priorityGroup = 3;
                        btn.priority = 'low';
                        break;
                    }
                    case 'Delete': {
                        btn.priorityGroup = 4;
                        btn.priority = 'low';
                        break;
                    }
                    case 'InlineEdit': {
                        btn.priorityGroup = 5;
                        btn.priority = 'low';
                        break;
                    }
                    case 'ExportToExcel': {
                        btn.priorityGroup = 6;
                        btn.priority = 'low';
                        break;
                    }
                    case 'WorkflowHistory': {
                        btn.priorityGroup = 7;
                        btn.priority = 'low';
                        break;
                    }
                    case 'RefreshReport': {
                        btn.priorityGroup = 7;
                        btn.priority = 'low';
                        break;
                    }
                    case 'MoveUp': {
                        btn.priorityGroup = 7;
                        btn.priority = 'low';
                        break;
                    }
                    case 'MoveDown': {
                        btn.priorityGroup = 7;
                        btn.priority = 'low';
                        break;
                    }
                }
            }
            else {
                btn.priorityGroup = ++counter;
                btn.priority = 'high';
            }
        });
        return toolbarButtons;
    }
    get viewSettings$() {
        return this._viewSettingsSource.asObservable();
    }
    get toolbarSettings$() {
        return this._toolbarSettingsSource.asObservable();
    }
    get ulvHeightSizeType$() {
        return this._ulvHeightSizeTypeSource.asObservable();
    }
    get ulvHeightSize$() {
        return this._ulvHeightSizeSource.asObservable();
    }
    get hiddenOverflowContent$() {
        return this._hiddenOverflowContentSource.asObservable();
    }
    get contentHeight$() {
        return this._contentHeightSource.asObservable();
    }
    get toolbarButtonsReportView$() {
        return this._toolbarButtonsReportViewSource.asObservable();
    }
    get selectedView$() {
        return this._selectedView$.asObservable();
    }
    get inlineEditMode() {
        return this._inlineEditModeSource.getValue();
    }
    get gridSettingChangedByUser$() {
        return this._updateGridSettingByUser$.asObservable();
    }
    get sortSettingChanged$() {
        return this._sortSettingChanged$.asObservable();
    }
    get createNewInlineMo$() {
        return this._createNewInlineMo$.asObservable();
    }
    get hideTitle$() {
        return this._hideTitleSource.asObservable();
    }
    get useLayoutItemTextForControl$() {
        return this._useLayoutItemTextForControlSource.asObservable();
    }
    get viewCollection$() {
        return this._viewCollectionSource.asObservable();
    }
    get commandsAccess() {
        return this._commandsAccessSource.getValue();
    }
    get commandsAccess$() {
        return this._commandsAccessSource.asObservable();
    }
    get hasSelected$() {
        return this.moDataList$.pipe(map((moList) => moList.some((c) => c.$IsChecked)));
    }
    get gridAllowSort$() {
        return this._gridAllowSortSource.asObservable();
    }
    get gridSetting() {
        return this._gridSettingSource.getValue();
    }
    get gridSetting$() {
        return this._gridSettingSource.asObservable();
    }
    get hideViewerLoading$() {
        return this._hideViewerLoadingSource.asObservable();
    }
    get hidePaging$() {
        return this._hidePagingSource.asObservable();
    }
    get prepareMoForNewForm$() {
        return this._prepareMoForNewForm$.asObservable();
    }
    get showContextMenu$() {
        return this._showContextMenuSource.asObservable();
    }
    get gridFreeColumnSizing$() {
        return this._gridFreeColumnSizing$.asObservable();
    }
    get canSaveGridSetting$() {
        return this._canSaveGridSetting$.asObservable();
    }
    get inDialog$() {
        return this._inDialog$.asObservable();
    }
    get isMultiSelect() {
        return this._isMultiSelect$.getValue();
    }
    get isMultiSelect$() {
        return this._isMultiSelect$.asObservable();
    }
    get fullscreen$() {
        return this._fullscreen$.asObservable();
    }
    get cartableChildsMo$() {
        return this._cartableChildsMo$.asObservable();
    }
    get cartableTemplates$() {
        return this._cartableTemplates$.asObservable();
    }
    get searchPanelUi() {
        return this._searchPanelUiSource.getValue();
    }
    get reportId() {
        return this._reportSource.getValue()?.Id;
    }
    get allSearchPanelSettings() {
        return this._allSearchPanelSettingsSource.getValue();
    }
    get hideSearchpanel$() {
        return this._hideSearchapanelSource.asObservable().pipe(distinctUntilChanged());
    }
    get hideSearchpanel() {
        return this._hideSearchapanelSource.getValue();
    }
    get cssBackground$() {
        return this._cssBackgroundSource.asObservable();
    }
    get shortCuts$() {
        return this._shortCutsSource.asObservable();
    }
    setToolbarSettings(toolbarSettings) {
        this._toolbarSettingsSource.next(toolbarSettings);
    }
    setUlvHeightSize(ulvHeightSize) {
        this._ulvHeightSizeSource.next(ulvHeightSize);
    }
    setUlvHeightSizeType(ulvSizeType) {
        this._ulvHeightSizeTypeSource.next(ulvSizeType);
    }
    setHiddenOverflowContent(hiddenOverflow) {
        this._hiddenOverflowContentSource.next(hiddenOverflow);
    }
    setSelectedView(selectedView) {
        this._selectedView$.next(selectedView);
    }
    userChangeGridSetting(setting, isSort = false, raiseEvent = true) {
        this._updateGridSettingByUser$.next({ setting, isSort, raiseEvent });
    }
    sortSettingChange(gridSetting) {
        this._sortSettingChanged$.next(gridSetting);
    }
    newInlineMo(checked) {
        this._createNewInlineMo$.next(checked);
    }
    setHideTitle(hideTitle) {
        this._hideTitleSource.next(hideTitle);
    }
    setUseLayoutItemTextForControl(useLayoutItemTextForControl) {
        this._useLayoutItemTextForControlSource.next(useLayoutItemTextForControl);
    }
    setViewCollection(collection) {
        this._viewCollectionSource.next(collection);
    }
    setAccess(access) {
        this._commandsAccessSource.next(access);
    }
    setViewSettings(viewSettings) {
        this._viewSettingsSource.next(viewSettings);
    }
    setAllowGridColumnSort(allow) {
        this._gridAllowSortSource.next(allow);
    }
    setGridSetting(gridSetting) {
        this._gridSettingSource.next(gridSetting);
    }
    prepareMoForNewForm(mo) {
        this._prepareMoForNewForm$.next(mo);
    }
    setShortCuts(shortCuts) {
        this._shortCutsSource.next(shortCuts);
    }
    setBackground(cssBackground) {
        return this._cssBackgroundSource.next(cssBackground);
    }
    hidePaging(hide) {
        this._hidePagingSource.next(hide);
    }
    setUiViewerClass(selector) {
        this._setUiViewerSelector$.next(selector);
    }
    hideUlvTitlePage() {
        this._hideUlvPageTitle$.next(true);
    }
    setCanSaveGridSettings(val) {
        this._canSaveGridSetting$.next(val);
    }
    executeToolbarButton(itemId, options) {
        const buttons = this._toolbarButtonsSource.getValue();
        if (!buttons.length) {
            return;
        }
        const btn = buttons.find((c) => c.itemId === itemId);
        if (btn) {
            executeUlvCommandHandler(btn, options);
        }
    }
    addWorkflowButtonsInToolbar(e) {
        const arrOfShareButtons = this._createWorkflowShareButtons(e);
        const value = arrOfShareButtons.map((c) => ({
            icon: '',
            text: c,
            itemId: c,
            Data: null,
            $ShareWorkflowButtons: true,
            Command: { _isVisible: true, _isEnable: true, JsonExtraProp: { Design: 'attention' } },
            handler: (d) => this.onWorkflowButtonInToolbarClick(d),
            IsBuiltin: false
        }));
        this._toolbarButtonsWorkflowButtons.next(value);
    }
    _excludeWrapperFromMo(mo) {
        /* eslint-disable no-unused-vars */
        const { $Wrapper, ...newMo } = mo;
        return newMo;
    }
    onWorkflowButtonInToolbarClick(shareButton) {
        BarsaApi.Bw.Msg.OKCancel('آیا از تایید موارد کارتابل مطمئن هستید؟', 'تایید', (res) => {
            if (res === 'ok') {
                this._workflowShareButtons.forEach((c) => {
                    const choiceDef = c.choiceList.find((d) => d.Title === shareButton.text);
                    if (choiceDef) {
                        c.formPanelCtrlr.WorkflowTransition(choiceDef, () => {
                            // this._setWorkflowState('Finish', [c.mo]);
                        });
                    }
                });
                // this._setWorkflowState(
                //     'Pending',
                //     this._workflowShareButtons.map((c) => c.mo)
                // );
                // const params = this._workflowShareButtons.map((c) => ({
                //     mo: this._excludeWrapperFromMo(c.mo.RelatedMo),
                //     choiceDef: c.choiceList.find((d) => d.Title === shareButton.text)
                // }));
                // this._setWorkflowState('Pending', params);
                // BarsaApi.Common.Ajax.GetServerData(
                //     'Workflow94.OnGroupOfChoiceDefsSelect',
                //     { parameter: { DataList: params } },
                //     () => {
                //         this._setWorkflowState('Success', params);
                //     }, // success
                //     () => {
                //         this._setWorkflowState('Failed', params, 'متاسفانه عملیات ناموفق بود.');
                //     }, // failure
                //     null,
                //     this
                // );
            }
        });
    }
    setTitle(title) {
        this._titleSource.next({ text: title, image: '' });
    }
    ulvSetHideViewerLoading(hideViewerLoading) {
        this._hideViewerLoadingSource.next(hideViewerLoading);
    }
    toggleHideSearchpanel(val) {
        this._hideSearchapanelSource.next(typeof val !== 'undefined' ? val : !this._hideSearchapanelSource.getValue());
    }
    setContext(context) {
        this._contextSource.next(context);
    }
    setInDialog(val) {
        this._inDialog$.next(val);
    }
    setIsMultiSelect(val) {
        this._isMultiSelect$.next(val);
    }
    setOpenOneClick(val) {
        this.openOneClick = val;
    }
    setFullscreen(val) {
        this._fullscreen$.next(val);
    }
    setContentHeight(height) {
        this._contentHeightSource.next(height);
    }
    addUlvButtons(e) {
        const tlbButtons = this._toolbarButtonsReportViewSource.getValue();
        this._toolbarButtonsReportViewSource.next([...tlbButtons, ...e]);
    }
    enableUlvButtonsReportView(id, isEnable) {
        const tlbButtons = this._toolbarButtonsReportViewSource.getValue();
        const x = tlbButtons.find((c) => c.id === id);
        x && (x.isEnable = isEnable);
        this._toolbarButtonsReportViewSource.next(tlbButtons);
    }
    createNewInlineMo(isChecked) {
        const context = this.context;
        const formSetting = context.Setting.FormTemplate;
        const typeDefId = context.Setting.Extra.Report.TypeDefId;
        const newMo = getNewMoGridEditor(formSetting, typeDefId);
        newMo.Id = genrateInlineMoId();
        newMo.$IsChecked = isChecked;
        newMo.$NewInlineMo = true;
        if (this._isComposite(context)) {
            const relation = BarsaApi.Common.Util.TryGetValue(this.context.Setting, 'Extra.Relation');
            newMo[relation.ParentFdName] = relation.ParentMoId;
        }
        //  this._newInlineEditMoSource.next(newMo);
        return newMo;
    }
    setLayoutInfo(layoutInfo) {
        this._layoutInfoSource.next(layoutInfo);
    }
    destroy() {
        this._onDestroy$.next();
        this._unscubscribeContext();
    }
    pageSizeChanged(pageIndex) {
        this.context.fireEvent('PageChange', this.context, pageIndex);
    }
    pageChanged(pageIndex) {
        this.context.currentPage = pageIndex;
        this.context.fireEvent('PageChange', this.context, pageIndex);
    }
    reSetMoDataList(moDataList) {
        const newMoDataList = moDataList ?? this.moDataListSource.getValue();
        this._moDataListChanged([...newMoDataList]);
        if (!this.context.Setting?.IsCartableReport) {
            return;
        }
        const keyOfCatableTemplates = new Set();
        newMoDataList.forEach((c) => {
            const tpdfId = c.RelatedMo?.$TypeDefId;
            if (tpdfId) {
                const key = `${tpdfId}${this._cartableKeySeperator}${c.CartableSettings?.Id || '0'}`;
                keyOfCatableTemplates.add(key);
            }
        });
        if (keyOfCatableTemplates.size > 0) {
            this._loadCartableTemplate(keyOfCatableTemplates);
        }
    }
    // Search Setting Manager
    clearSearch() {
        const searchPanelUi = this.searchPanelUi;
        if (!searchPanelUi) {
            return;
        }
        const fieldUi = searchPanelUi._dictFieldUi.$Search ?? searchPanelUi._dictFieldUi.جستجو;
        fieldUi.fireEvent('ClearClick');
    }
    search() {
        const searchPanelUi = this.searchPanelUi;
        if (!searchPanelUi) {
            return;
        }
        let fieldUi = searchPanelUi._dictFieldUi.$Search ?? searchPanelUi._dictFieldUi.جستجو;
        if (!fieldUi) {
            Object.keys(searchPanelUi._dictFieldUi).forEach((c) => {
                const e = searchPanelUi._dictFieldUi[c];
                if (e.originalXtype === 'Ui.SearchCommandInfoUi') {
                    fieldUi = e;
                }
            });
        }
        if (fieldUi) {
            fieldUi.fireEvent('SearchClick');
        }
    }
    getValueInlineEdit() {
        return this._inlineEditModeSource.getValue();
    }
    getAllowInlineEdit() {
        return this._allowInlineEditSource.getValue();
    }
    setInlineEdit(value) {
        this._inlineEditModeSource.next(value);
    }
    openSearchFieldsHiddenSettings() {
        this._openSearchPanelHiddenSettingsSource.next();
    }
    openSearchFilesManage() {
        this._openSearchFilesManageSource.next();
    }
    searchPanelMoChanged(change) {
        this._searchPanelMoChangedSource.next(change);
    }
    loadSearchPanelSettings() {
        if (this.context.FormPanelUi || !this._canSaveGridSetting$.getValue()) {
            return;
        }
        this.reportId$
            .pipe(takeUntil(this._onDestroy$), tap((reportId) => this._loadSearchPanelSettings(reportId)))
            .subscribe();
    }
    addSearchPanelSettings(searchPanelSettings) {
        const allSearchPanelSettings = this._allSearchPanelSettingsSource.getValue();
        allSearchPanelSettings.push(searchPanelSettings);
        this._allSearchPanelSettingsSource.next(allSearchPanelSettings);
    }
    saveSearchPanelSetting(selectedSearchPanelSettings) {
        const searchMo = this.getSearchPanelMo();
        const fieldsSetting = this.getSearchPanelFieldsSetting();
        if (!selectedSearchPanelSettings) {
            return;
        }
        selectedSearchPanelSettings.SearchMo = JSON.stringify(searchMo);
        selectedSearchPanelSettings.FieldsSetting = JSON.stringify(fieldsSetting);
        BarsaApi.Bw.RunBlMethod('SaveSearchPanelSettings', new BarsaApi.Common.MetaObjectWeb({
            Id: selectedSearchPanelSettings.Id,
            $Caption: selectedSearchPanelSettings.Title,
            ReportId: selectedSearchPanelSettings.Report?.Id,
            Title: selectedSearchPanelSettings.Title,
            IsDefault: selectedSearchPanelSettings.IsDefault,
            IsPublic: selectedSearchPanelSettings.IsPublic,
            ApplyAutomatically: selectedSearchPanelSettings.ApplyAutomatically,
            HideSearchPanel: selectedSearchPanelSettings.HideSearchPanel,
            SearchMo: selectedSearchPanelSettings.SearchMo,
            FieldsSetting: selectedSearchPanelSettings.FieldsSetting
        }), true);
        this.searchPanelMoChanged(false);
    }
    applySearchPanelSettings(searchPanelSettings) {
        const searchPanelUi = this.searchPanelUi;
        if (!searchPanelSettings) {
            return;
        }
        if (this._firstApplyAutomatically && searchPanelSettings.IsPrimary) {
            this._firstApplyAutomatically = false;
            return;
        }
        this._firstApplyAutomatically = false;
        this.resetSearchPanelSettings(searchPanelUi);
        if (searchPanelSettings.SearchMo) {
            const searchMo = JSON.parse(searchPanelSettings.SearchMo);
            Object.keys(searchMo).forEach((c) => {
                const field = searchPanelUi._dictFieldUi[c];
                if (field && c.indexOf('$') === -1) {
                    field.SetValue(searchMo[c]);
                    searchPanelUi.Mo.SetFValue(c, searchMo[c]);
                }
            });
            if (searchPanelSettings.IsPrimary && !searchPanelUi.Setting.ImmediateExecute) {
                this.searchPanelMoChanged(false);
                return;
            }
            if (searchPanelSettings.ApplyAutomatically) {
                this.search();
            }
        }
        // TODO set hidden fields
        if (searchPanelSettings.FieldsSetting) {
            const settings = JSON.parse(searchPanelSettings.FieldsSetting);
            this.setAndApplySearchPanelSettingFieldsSetting(typeof settings === 'string' ? JSON.parse(settings) : settings);
        }
        this.searchPanelMoChanged(false);
    }
    getSearchPanelMo() {
        return this.searchPanelUi.Mo;
    }
    getSearchPanelFieldsSetting() {
        const searchPanelUi = this.searchPanelUi;
        const fields = searchPanelUi.Setting.View.ControlInfo.filter((c) => c.ControlName !== '$Search' && c.ControlName !== 'جستجو');
        const fieldsSetting = fields.map((c) => ({
            Name: c.ControlName,
            Caption: c.ControlFieldCaptionTranslated,
            Hidden: searchPanelUi._dictFieldUi[c.ControlName].Setting.IsVisible === false ? true : false,
            IsMandatory: c.IsMandatory
        }));
        return fieldsSetting;
    }
    setAndApplySearchPanelSettingFieldsSetting(fieldsSetting) {
        const searchPanelUi = this.searchPanelUi;
        fieldsSetting.forEach((c) => {
            const field = searchPanelUi._dictFieldUi[c.Name];
            if (field) {
                searchPanelUi.fireEvent('ChangeFieldVisible', field.Setting.ControlFieldCaption, !c.Hidden);
            }
        });
    }
    updateSearchPanelSettings(allSearchPanelSettings) {
        allSearchPanelSettings = allSearchPanelSettings.filter((c) => !c.IsPrimary && !c.IsDeleted);
        this._allSearchPanelSettingsSource.next(allSearchPanelSettings);
    }
    removeSearchPanelSettings(searchPanelSettingsId) {
        const allSearchPanelSettings = this._allSearchPanelSettingsSource.getValue();
        allSearchPanelSettings.filter((c) => c.Id !== searchPanelSettingsId);
        this._allSearchPanelSettingsSource.next(allSearchPanelSettings);
    }
    changeSelectedSearchPanel(selectedSearchPanelSettingsId) {
        this._selectedSearchPanelSettingsIdSource.next(selectedSearchPanelSettingsId);
    }
    loadMetaConditionsControlInfos(typeDefId, fieldDbNames) {
        const mo = GetDefaultMoObjectInfo(typeDefId);
        return of(this._controlInfosMetaobject).pipe(switchMap$1((controlsInfo) => {
            if (controlsInfo.length > 0) {
                return of(controlsInfo);
            }
            return getControlList(mo, fieldDbNames, true, false);
        }), tap((controlsInfo) => (this._controlInfosMetaobject = controlsInfo)));
    }
    _createWorkflowShareButtons(e) {
        let shareButtons = [];
        if (e.add) {
            this._workflowShareButtons.push(e);
        }
        else {
            this._workflowShareButtons = this._workflowShareButtons.filter((c) => c.mo.Id !== e.mo.Id);
        }
        if (!this._workflowShareButtons.length) {
            return [];
        }
        // this._workflowShareButtons = this._workflowShareButtons.filter((c) => c.mo?.$IsChecked);
        if (this._workflowShareButtons.length > 0) {
            shareButtons = this._workflowShareButtons[0].choiceList.map((d) => d.Title);
            const unShareButtons = [];
            for (let i = 1; i < this._workflowShareButtons.length; i++) {
                const item = this._workflowShareButtons[i];
                for (let j = 0; j < shareButtons.length; j++) {
                    if (item.choiceList.map((d) => d.Title).indexOf(shareButtons[j]) < 0) {
                        unShareButtons.push(shareButtons[j]);
                    }
                }
            }
            shareButtons = shareButtons.filter((c) => unShareButtons.indexOf(c) === -1);
        }
        return shareButtons;
    }
    _initCreateNewInlineMo(context) {
        if (!context) {
            return;
        }
        const formSetting = context.Setting.FormTemplate;
        if (formSetting) {
            this.createNewInlineMo(false);
        }
    }
    _isComposite(context) {
        const relationType = BarsaApi.Common.Util.TryGetValue(context.Setting, 'Extra.Relation.RelationType');
        return relationType === BarsaApi.Common.Enums.RelationType.Composition;
    }
    _addEventListener(context) {
        context.on({
            scope: this,
            ShowContextMenu: this._showContextMenu,
            MaskChanged: this._maskChanged,
            ViewerMaskChanged: this._viewerMaskChanged,
            ViewerControlChanged: this._viewerControlChanged,
            VisibleChanged: this._visibleChanged,
            ReadonlyChanged: this._readonlyChanged,
            MenuItemsChanged: this._menuItemsChanged,
            TitleChanged: this._titleChanged,
            SearchPanelChanged: this._searchPanelChanged,
            PagingSettingChanged: this._pagingSettingChanged,
            ToolbarButtonsChanged: this._toolbarButtonsChanged,
            EnableChanged: this._enableChanged,
            Destroy: this._destroyChanged,
            ExitInlineEdit: this._existInlineEdit
        });
    }
    _initialize(context) {
        this._initCartablesFormTemplate(context);
        this._initConditionalFormats(context);
        this._initAllowInlineEdit(context);
        this._initOnlyInlineEdit(context);
        this._initInlineEditMode(context);
        this._initReport(context);
        this._initViewerControl(context);
        this._initHideToolbar(context);
        this._initToolbarButtons(context);
        this._initVisible(context);
        this._initEnable(context);
        this._initTitle(context);
        this._initReadonly(context);
        this._initMoDataList(context);
        this._initPagingSetting(context);
        this._initMenuItems(context);
        this._initSearchpanel(context);
        this._initCreateNewInlineMo(context);
        this._initGridFreeColumnSizing(context);
    }
    _initGridFreeColumnSizing(context) {
        if (context && context.Setting.View?.Grid_FreeColumnSizing) {
            this._gridFreeColumnSizing$.next(context.Setting.View?.Grid_FreeColumnSizing);
        }
    }
    _initCartablesFormTemplate(context) {
        const cartableTemplates = context.Setting.CartableTemplates;
        if (cartableTemplates) {
            const keys = Object.keys(cartableTemplates);
            keys.forEach((key) => {
                if (typeof cartableTemplates[key] === 'string') {
                    cartableTemplates[key] = BarsaApi.Ext.decode(cartableTemplates[key]);
                }
            });
            this._cartableTemplates$.next(cartableTemplates);
        }
        this._cartableChildsMo(context);
    }
    _initSearchpanel(context) {
        if (context && context._searchPanelControl) {
            this._searchPanelChanged(context._searchPanelControl);
        }
    }
    _initConditionalFormats(context) {
        if (context && context.Setting.View?.ConditionalFormats) {
            this._conditionalFormatsChanged(context.Setting.View?.ConditionalFormats);
        }
    }
    _initMenuItems(context) {
        if (context && context.menuItems) {
            // const newItems = context.menuItems;
            this._menuItemsChanged(context.menuItems);
        }
    }
    _initReport(context) {
        const report = BarsaApi.Common.Util.TryGetValue(context, 'Setting.Extra.Report', []);
        this._reportSource.next(report);
    }
    _initMoDataList(context) {
        const moDataList = BarsaApi.Common.Util.TryGetValue(context, 'Setting.Data.MoDataList', []);
        this._moDataListChanged(moDataList);
    }
    _cartableChildsMo(context) {
        if (context.Setting.CartableChildsMo) {
            this._cartableChildsMo$.next(context.Setting.CartableChildsMo);
        }
    }
    _initPagingSetting(context) {
        const pagingSetting = BarsaApi.Common.Util.TryGetValue(context, 'Setting.Data.Paging', null);
        this._pagingSettingChanged(pagingSetting);
    }
    _initTitle(context) {
        let title = BarsaApi.Common.Util.TryGetValue(context, 'title', null);
        if (title === null) {
            title = BarsaApi.Common.Util.TryGetValue(context, 'Setting.Extra.Report.Caption', '');
        }
        this._titleChanged({ text: title, image: '' });
    }
    _initReadonly(context) {
        const readonly = context.readonly === true ? true : false;
        this._readonlyChanged(readonly);
    }
    _initEnable(context) {
        const enable = context.enable === false ? false : true;
        this._enableChanged(enable);
    }
    _initVisible(context) {
        const visible = context.Setting.IsVisible === false ? false : true;
        this._visibleChanged(visible);
    }
    _initToolbarButtons(context) {
        const buttons = context.tlbButtons;
        if (Array.isArray(buttons)) {
            this._toolbarButtonsChanged(buttons);
        }
    }
    _initInlineEditMode(context) {
        const inlineEditMode = context.Setting?.View?.AutoInlineEdit;
        this._inlineEditModeSource.next(inlineEditMode);
    }
    _initAllowInlineEdit(context) {
        const allowInlineEdit = context.Setting?.View?.AllowInlineEdit;
        const allowEdit = context.Setting.Extra?.DefaultCommandsAccess?.Edit;
        this._allowInlineEditSource.next(allowInlineEdit && allowEdit);
    }
    _initOnlyInlineEdit(context) {
        const onlyInlineEdit = context.Setting?.View?.OnlyInlineEdit;
        this._onlyInlineEditSource.next(onlyInlineEdit);
    }
    _initViewerControl(context) {
        const viewerControl = context.viewerControl;
        if (viewerControl) {
            this._viewerControlChanged(viewerControl);
        }
    }
    _initHideToolbar(context) {
        const hideToolbar = BarsaApi.Common.Util.TryGetValue(context, 'Setting.Extra.Report.HideToolbar', false);
        this._hideToolbarSource.next(hideToolbar);
    }
    _unscubscribeContext() {
        this.context.un('ShowContextMenu', this._showContextMenu);
        this.context.un('MaskChanged', this._maskChanged);
        this.context.un('ViewerControlChanged', this._viewerControlChanged);
        this.context.un('ViewerMaskChanged', this._viewerMaskChanged);
        this.context.un('VisibleChanged', this._visibleChanged);
        this.context.un('ReadonlyChanged', this._readonlyChanged);
        this.context.un('MenuItemsChanged', this._menuItemsChanged);
        this.context.un('TitleChanged', this._titleChanged);
        this.context.un('PagingSettingChanged', this._pagingSettingChanged);
        this.context.un('ToolbarButtonsChanged', this._toolbarButtonsChanged);
        this.context.un('EnableChanged', this._enableChanged);
        this.context.un('Destroy', this._destroyChanged);
        this.context.un('ExitInlineEdit', this._existInlineEdit);
    }
    _conditionalFormatsChanged(conditionalFormats) {
        this._conditionalFormatsSource.next(conditionalFormats);
    }
    _moDataListChanged(moDataList) {
        this.moDataListSource.next(moDataList);
        if (this.context) {
            this._cartableChildsMo(this.context);
            this._initCartablesFormTemplate(this.context);
            this._checkCartableWorkflowShareButtons(moDataList);
        }
    }
    _checkCartableWorkflowShareButtons(moDataList) {
        const hasSelected = moDataList.some((c) => c.$IsChecked);
        const moIds = moDataList.map((c) => c.Id);
        this._workflowShareButtons = this._workflowShareButtons.filter((c) => moIds.indexOf(c.mo.Id) > -1);
        if (!hasSelected) {
            this._toolbarButtonsWorkflowButtons.next([]);
        }
    }
    _viewerControlChanged(viewerControl) {
        this._viewerControlSource.next(viewerControl);
        this._initConditionalFormats(this.context);
        this._initInlineEditMode(this.context);
        this._initAllowInlineEdit(this.context);
        this._initOnlyInlineEdit(this.context);
    }
    _maskChanged(mask) {
        this._maskSource.next(mask);
    }
    _showContextMenu(xy) {
        this._showContextMenuSource.next(xy);
    }
    _viewerMaskChanged(viewerMask) {
        this._viewerMaskSource.next(viewerMask);
    }
    _readonlyChanged(readonly) {
        this._readonlySource.next(readonly);
    }
    _visibleChanged(viewerMask) {
        this._visibleSource.next(viewerMask);
    }
    _removeExtraMenuItems(menuItems) {
        if (!menuItems) {
            return [];
        }
        const newItems = menuItems.filter((c) => c.itemId !== 'Delete' && c.itemId !== 'AddToList' && c.itemId !== 'RemoveFromList' && c.itemId !== 'MoveUp' && c.itemId !== 'MoveDown');
        return newItems;
    }
    _menuItemsChanged(menuItems) {
        const newMenuItems = this._removeExtraMenuItems(menuItems);
        this._menuItemsSource.next(newMenuItems);
    }
    _titleChanged(titleObj) {
        this._titleSource.next(titleObj);
    }
    _searchPanelChanged(searchPanel) {
        this._searchPanelUiSource.next(searchPanel);
    }
    _pagingSettingChanged(pageingSetting) {
        this._pagingSettingSource.next(pageingSetting);
    }
    _toolbarButtonsChanged(buttons) {
        this._toolbarButtonsSource.next(buttons);
    }
    _enableChanged(enable) {
        this._enableSource.next(enable);
    }
    _destroyChanged() {
        this._destroySource.next();
    }
    _existInlineEdit() {
        this._inlineEditModeSource.next(false);
    }
    _addDefaultSearchPanelSettings(searchPanel) {
        const searchMo = JSON.stringify(searchPanel?.Mo ?? new MetaobjectDataModel());
        const StandardText = this._bbbPipe.transform('Standard');
        const standardSettings = {
            Id: '',
            $Caption: StandardText,
            IsStandard: true,
            IsDefault: true,
            IsPublic: true,
            IsPrimary: true,
            ApplyAutomatically: true,
            HideSearchPanel: false,
            Title: StandardText,
            SearchMo: searchMo,
            ReportId: ''
        };
        this._defaultSearchPanelSettingsSource.next(standardSettings);
    }
    _loadSearchPanelSettings(reportId) {
        BarsaApi.Bw.RunBlMethodAsync({
            Parameters: [reportId],
            Method: 'LoadAllUserSearchPanelSettings',
            SuccessFn: (allSearchPanelSettings) => {
                if (Array.isArray(allSearchPanelSettings)) {
                    allSearchPanelSettings = BarsaApi.Bw._unwrap(allSearchPanelSettings);
                    this._allSearchPanelSettingsSource.next(allSearchPanelSettings);
                    const defaultSearch = allSearchPanelSettings.find((c) => c.IsDefault);
                    if (defaultSearch) {
                        this._selectedSearchPanelSettingsIdSource.next(defaultSearch.Id);
                    }
                }
            },
            FailFn: () => { }
        });
    }
    resetSearchPanelSettings(searchPanelUi) {
        this.clearSearch();
        const fieldUi = searchPanelUi._dictFieldUi;
        const changed = searchPanelUi.Mo.GetChangedObject();
        Object.keys(changed).forEach((c) => {
            const field = searchPanelUi._dictFieldUi[c];
            if (field) {
                field.SetValue(null);
                searchPanelUi.Mo.SetFValue(c, null);
            }
            searchPanelUi.Mo.SetState('New');
        });
        Object.keys(fieldUi).forEach((c) => {
            if (c !== '$Search' && fieldUi[c].LayoutControl) {
                searchPanelUi.fireEvent('ChangeFieldVisible', fieldUi[c].Setting.ControlFieldCaption, true);
            }
        });
    }
    _loadCartableTemplate(keyOfCartableTemplates) {
        let cartableTemplates = this._cartableTemplates$.getValue();
        if (!cartableTemplates) {
            return;
        }
        const keys = [];
        keyOfCartableTemplates.forEach((key) => {
            const values = key.split(this._cartableKeySeperator);
            if (!cartableTemplates[key]) {
                keys.push({ TypeDefId: values[0], SettingsId: values[1] });
            }
        });
        if (keys.length === 0) {
            return;
        }
        this._apiService.GetCartableTemplate(keys).subscribe((c) => {
            if (!c) {
                return;
            }
            const templates = {};
            Object.keys(c).forEach((cId) => {
                templates[cId] = BarsaApi.Ext.decode(c[cId]);
            });
            cartableTemplates = { ...cartableTemplates, ...templates };
            this._cartableTemplates$.next(cartableTemplates);
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UlvMainService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UlvMainService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UlvMainService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class UploadService {
    constructor() {
        this.cancelation$ = new Subject();
        this.uploadURL = `/Fields/File/Base/FileUploadFormMulti.ashx`;
        this.httpClient = inject(HttpClient);
        this._uploadingStateSource = new Subject();
        this.uploadingState$ = this._uploadingStateSource.asObservable();
    }
    upload(data, fdId, key = '', tagId = '') {
        let state = {
            key,
            progress: 0,
            state: 'Start',
            uploading: false
        };
        this._setUploadingStatus(state);
        return this.httpClient
            .post(this.uploadURL, data, {
            reportProgress: true,
            observe: 'events',
            headers: { fdId, tagId, IsPortal: 'true' }
        })
            .pipe(map((event) => {
            switch (event.type) {
                case HttpEventType.UploadProgress: {
                    const total = event.total || 0;
                    const progress = Math.round((100 * event.loaded) / total);
                    return { status: 'progress', message: progress };
                }
                case HttpEventType.Response:
                    return event.body;
                default:
                    return `Unhandled event: ${event.type}`;
            }
        }), map((res) => {
            if (Array.isArray(res)) {
                state = this._setUploadingStatus({ ...state, state: 'Complete', uploading: false });
            }
            else if (res !== null && typeof res === 'object') {
                if (res.status === 'error') {
                    state = this._setUploadingStatus({ ...state, state: 'Error', uploading: false });
                }
                else if (res.status === 'progress') {
                    state = this._setUploadingStatus({
                        ...state,
                        state: 'Uploading',
                        uploading: true,
                        progress: res.message
                    });
                }
            }
            return res;
        }), takeUntil(this.cancelation$.asObservable()), catchError((err) => {
            if (err instanceof HttpErrorResponse) {
                BarsaApi.Bw.Toast.Error(`${err.status} : ${err.message}`);
            }
            return throwError(() => new Error(err));
        }), finalize(() => {
            state = this._setUploadingStatus({
                ...state,
                uploading: false
            });
        }));
    }
    compressFiles$(files) {
        return from(this.compressFiles(files));
    }
    _setUploadingStatus(state) {
        if (state.state === 'Start') {
            state.uploading = true;
        }
        this._uploadingStateSource.next(state);
        return state;
    }
    compressFiles(files) {
        const formData = new FormData();
        return new Promise((resolve, _reject) => {
            files.forEach((file, _index) => {
                formData.append('file', file, file.name);
            });
            resolve(formData);
            //     const file2 = file; // get the file
            //     const blobURL = URL.createObjectURL(file2);
            //     const img = new Image();
            //     img.src = blobURL;
            //     const biggerThan1MB = file.size / 1024 > 1000;
            //     const mimeTypeJpg = 'image/jpeg';
            //     const MAX_WIDTH = 1920;
            //     const MAX_HEIGHT = 1080;
            //     const MIME_TYPE = biggerThan1MB ? mimeTypeJpg : file.type;
            //     const QUALITY = biggerThan1MB && file.type === mimeTypeJpg ? 0.5 : 1;
            //     if (MIME_TYPE === file.type && QUALITY === 1) {
            //         formData.append('file', file, file.name);
            //         if (index === files.length - 1) {
            //             resolve(formData);
            //         }
            //     }
            //     img.onerror = function (): void {
            //         URL.revokeObjectURL(img.src);
            //         // Handle the failure properly
            //         console.log('Cannot load image');
            //         reject(new Error('Cannot load image'));
            //     };
            //     img.onload = function (): void {
            //         URL.revokeObjectURL(img.src);
            //         const [newWidth, newHeight] = calculateSize(img, MAX_WIDTH, MAX_HEIGHT);
            //         const canvas = document.createElement('canvas');
            //         canvas.width = newWidth;
            //         canvas.height = newHeight;
            //         const ctx = canvas.getContext('2d');
            //         ctx?.drawImage(img, 0, 0, newWidth, newHeight);
            //         canvas.toBlob(
            //             (blob) => {
            //                 // Handle the compressed image. es. upload or save in local state
            //                 if (blob) {
            //                     // formData.append(
            //                     //     'unicFileName',
            //                     //     'x' + BarsaApi.Common.Util.GetNewMetaGuid() + ';;;' + file.name
            //                     // );
            //                     formData.append('file', blob, file.name);
            //                 }
            //                 if (index === files.length - 1) {
            //                     resolve(formData);
            //                 }
            //             },
            //             MIME_TYPE,
            //             QUALITY
            //         );
            //     };
            //     function calculateSize(img1, maxWidth, maxHeight): number[] {
            //         let width = img1.width;
            //         let height = img1.height;
            //         // calculate the width and height, constraining the proportions
            //         if (width > height) {
            //             if (width > maxWidth) {
            //                 height = Math.round((height * maxWidth) / width);
            //                 width = maxWidth;
            //             }
            //         } else {
            //             if (height > maxHeight) {
            //                 width = Math.round((width * maxHeight) / height);
            //                 height = maxHeight;
            //             }
            //         }
            //         return [width, height];
            //     }
            // });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UploadService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UploadService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [] });

class NetworkStatusService {
    get networkStatus$() {
        return merge(of(null), fromEvent(window, 'online'), fromEvent(window, 'offline')).pipe(map(() => navigator.onLine));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NetworkStatusService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NetworkStatusService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NetworkStatusService, decorators: [{
            type: Injectable
        }] });

class AudioRecordingService {
    constructor() {
        this._recorded = new Subject();
        this._recordingTime = new Subject();
        this._recordingFailed = new Subject();
    }
    getRecordedBlob() {
        return this._recorded.asObservable();
    }
    getRecordedTime() {
        return this._recordingTime.asObservable();
    }
    recordingFailed() {
        return this._recordingFailed.asObservable();
    }
    startRecording() {
        if (this.recorder) {
            // It means recording is already started or it is already recording something
            return;
        }
        this._recordingTime.next('00:00');
        navigator.mediaDevices
            .getUserMedia({ audio: true })
            .then((s) => {
            this.stream = s;
            this.record();
        })
            .catch((_) => {
            this._recordingFailed.next('');
        });
    }
    abortRecording() {
        this.stopMedia();
    }
    stopRecording() {
        if (this.recorder) {
            this.recorder.stop((blob) => {
                if (this.startTime) {
                    const mp3Name = encodeURIComponent('audio_' + new Date().getTime() + '.mp3');
                    this.stopMedia();
                    this._recorded.next({ blob, title: mp3Name });
                }
            }, () => {
                this.stopMedia();
                this._recordingFailed.next('');
            });
        }
    }
    record() {
        this.recorder = new RecordRTC.StereoAudioRecorder(this.stream, {
            type: 'audio',
            mimeType: 'audio/mp3'
        });
        this.recorder.record();
        this.startTime = moment();
        this.interval = setInterval(() => {
            const currentTime = moment();
            const diffTime = moment.duration(currentTime.diff(this.startTime));
            const time = this.toString(diffTime.minutes()) + ':' + this.toString(diffTime.seconds());
            this._recordingTime.next(time);
        }, 500);
    }
    toString(value) {
        let val = value;
        if (!value) {
            val = '00';
        }
        if (value < 10) {
            val = '0' + value;
        }
        return val;
    }
    stopMedia() {
        if (this.recorder) {
            this.recorder = null;
            clearInterval(this.interval);
            this.startTime = null;
            if (this.stream) {
                this.stream.getAudioTracks().forEach((track) => track.stop());
                this.stream = null;
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AudioRecordingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AudioRecordingService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AudioRecordingService, decorators: [{
            type: Injectable
        }] });

class VideoRecordingService {
    constructor() {
        this._stream = new Subject();
        this._recorded = new Subject();
        this._recordedUrl = new Subject();
        this._recordingTime = new Subject();
        this._recordingFailed = new Subject();
    }
    getRecordedUrl() {
        return this._recordedUrl.asObservable();
    }
    getRecordedBlob() {
        return this._recorded.asObservable();
    }
    getRecordedTime() {
        return this._recordingTime.asObservable();
    }
    recordingFailed() {
        return this._recordingFailed.asObservable();
    }
    getStream() {
        return this._stream.asObservable();
    }
    startRecording(conf) {
        const browser = navigator;
        if (this.recorder) {
            // It means recording is already started or it is already recording something
            return Promise.resolve(this.stream);
        }
        this._recordingTime.next('00:00');
        return new Promise((resolve, reject) => {
            browser.mediaDevices
                .getUserMedia(conf)
                .then((stream) => {
                this.stream = stream;
                this.record();
                resolve(this.stream);
            })
                .catch((error) => {
                this._recordingFailed.next('');
                reject(error);
            });
        });
    }
    abortRecording() {
        this.stopMedia();
    }
    stopRecording() {
        if (this.recorder) {
            this.recorder.stopRecording(this.processVideo.bind(this));
            // this.processVideo.bind(this.recorder)
            // this.processVideo(this.recorder);
            // this.stopMedia();
        }
    }
    record() {
        this.recorder = new RecordRTC(this.stream, {
            type: 'video',
            mimeType: 'video/webm',
            bitsPerSecond: 44000
        });
        this.recorder.startRecording();
        this.startTime = moment();
        this.interval = setInterval(() => {
            const currentTime = moment();
            const diffTime = moment.duration(currentTime.diff(this.startTime));
            const time = this.toString(diffTime.minutes()) + ':' + this.toString(diffTime.seconds());
            this._recordingTime.next(time);
            this._stream.next(this.stream);
        }, 500);
    }
    toString(value) {
        let val = value;
        if (!value) {
            val = '00';
        }
        if (value < 10) {
            val = '0' + value;
        }
        return val;
    }
    processVideo(audioVideoWebMURL) {
        // console.log(audioVideoWebMURL);
        const recordedBlob = this.recorder.getBlob();
        this.recorder.getDataURL(function (_) { });
        const recordedName = encodeURIComponent('video_' + new Date().getTime() + '.webm');
        this._recorded.next({ blob: recordedBlob, url: audioVideoWebMURL, title: recordedName });
        this.stopMedia();
        // this.recorder.save(recordedName);
    }
    stopMedia() {
        if (this.recorder) {
            this.recorder = null;
            clearInterval(this.interval);
            this.startTime = null;
            if (this.stream) {
                this.stream.getAudioTracks().forEach((track) => track.stop());
                this.stream.getVideoTracks().forEach((track) => track.stop());
                this.stream.stop();
                this.stream = null;
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: VideoRecordingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: VideoRecordingService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: VideoRecordingService, decorators: [{
            type: Injectable
        }] });

class IndexedDbService {
    constructor() {
        this._db = null;
    }
    open(dbName, version) {
        const DBOpenRequest = window.indexedDB.open(dbName, version);
        // Register two event handlers to act on the database being opened successfully, or not
        DBOpenRequest.onerror = (_event) => {
            // TODO: Handle error
        };
        DBOpenRequest.onsuccess = (_event) => {
            // TODO: Handle success
            this._db = DBOpenRequest.result;
        };
        // This event handles the event whereby a new version of the database needs to be created
        // Either one has not been created before, or a new version number has been submitted via the
        // window.indexedDB.open line above
        // it is only implemented in recent browsers
        DBOpenRequest.onupgradeneeded = (_event) => {
            // TODO: Handle upgradeneeded
        };
    }
    delete(dbName) {
        window.indexedDB.deleteDatabase(dbName);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IndexedDbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IndexedDbService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IndexedDbService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class BarsaStorageService {
    constructor() {
        this.STARTUP_DATA_KEY = 'STARTUP_DATA';
        this.DBNAME_KEY = 'BARSA_DB';
        this.DBNAME_VERSION_KEY = `${this.DBNAME_KEY}_VERSION`;
        this.BAZAVARI_VERSION_KEY = `BAZAVARI_VERSION`;
        this._logService = inject(LogService);
        this._localStorageService = inject(LocalStorageService);
        this._indexedDbService = inject(IndexedDbService);
    }
    get currentBazavariVersion() {
        return BarsaApi.LoginFormData.ChangeKeyVersion;
    }
    interceptXhr() {
        const origOpen = XMLHttpRequest.prototype.open;
        const logService = this._logService;
        // const isAnonymous = BarsaApi.LoginFormData.IsAnonymous;
        // const startupData = JSON.stringify(BarsaApi.LoginFormData);
        // localStorage.setItem(this.STARTUP_DATA_KEY, startupData);
        // const me = this;
        return;
        XMLHttpRequest.prototype.open = function (method, url, async, username, password) {
            // console.log('request started!');
            // if(isAnonymous){
            //     var responseText=me._indexedDbService.get(url);
            //     if(responseText){
            //     }
            //     return;
            // }
            this.addEventListener('load', function () {
                //    console.log('request completed!');
                //   console.log(this.readyState); // will always be 4 (ajax is completed successfully)
                // console.log(this.responseText); // whatever the response was
                if (this.status === 401 && BarsaApi.LoginFormData.succeed !== false) {
                    logService.info(`unauthorized ${this.status}`);
                    // console.log('clear localstorage');
                    // localStorage.clear();
                }
            });
            origOpen.call(this, method, url, async === false ? false : true, username, password);
        };
    }
    init() {
        this.interceptXhr();
        const localStorage = this._localStorageService;
        const db_version = localStorage.getItem(this.DBNAME_VERSION_KEY);
        const bazavari_version = localStorage.getItem(this.BAZAVARI_VERSION_KEY);
        let dbVer = 0;
        dbVer = Number.parseInt(db_version ?? '0', 10);
        if (isNaN(dbVer) || !db_version) {
            this.deleteDatabase();
        }
        if (bazavari_version !== this.currentBazavariVersion) {
            dbVer++;
        }
        localStorage.setItem(this.DBNAME_VERSION_KEY, dbVer.toString());
        localStorage.setItem(this.BAZAVARI_VERSION_KEY, this.currentBazavariVersion);
        this.openDatabase(dbVer);
    }
    deleteDatabase() {
        this._indexedDbService.delete(this.DBNAME_KEY);
    }
    openDatabase(version) {
        this._indexedDbService.open(this.DBNAME_KEY, version);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaStorageService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaStorageService, decorators: [{
            type: Injectable
        }] });

class PromptUpdateService {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this._logService = inject(LogService);
        this.swUpdate = inject(SwUpdate);
        const _logService = this._logService;
        const swUpdate = this.swUpdate;
        _logService.info(`sw enable ${swUpdate.isEnabled}`);
        if (swUpdate.isEnabled) {
            swUpdate.checkForUpdate();
            _logService.info('sw check for update');
            swUpdate.unrecoverable.subscribe((event) => {
                // TODO: handle unrecoverable
                alert('An error occurred that we cannot recover from:\n' + event.reason + '\n\nPlease reload the page.');
                document.location.reload();
            });
            interval(1e3 * 60 * 60).subscribe(() => swUpdate.checkForUpdate());
        }
    }
    checkForUpdate() {
        this.swUpdate.versionUpdates
            .pipe(filter$1((evt) => evt.type === 'VERSION_READY'))
            .subscribe((_evt) => {
            this._logService.info('sw new version found.');
            this.promptUser(() => {
                // Reload the page to update to the latest version.
                document.location.reload();
            });
        });
    }
    promptUser(callback) {
        setTimeout(() => {
            BarsaApi.Bw.Msg.YesNo(BarsaApi.BBB.NewVersionFound, BarsaApi.BBB.UpdateApplication, function (buttonId) {
                if (buttonId === 'yes') {
                    return callback();
                }
            });
        }, 1000);
    }
    showError(callback) {
        BarsaApi.Bw.Msg.Error(BarsaApi.BBB.Error, BarsaApi.BBB.NeedReload, function (buttonId) {
            if (buttonId === 'yes') {
                return callback();
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PromptUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PromptUpdateService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PromptUpdateService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

const APP_VERSION = new InjectionToken('AppVersion');
const DIALOG_SERVICE = new InjectionToken('DIALOG_SERVICE');
const FORM_DIALOG_COMPONENT = new InjectionToken('FORM_DIALOG_COMPONENT');
const NOTIFICATAION_POPUP_SERVER = new InjectionToken('NOTIFICATAION_POPUP_SERVER');
const TOAST_SERVICE = new InjectionToken('TOAST_SERVICE');
const NOTIFICATION_WEBWORKER_FACTORY = new InjectionToken('notificaion-worker');

class ServiceWorkerNotificationService {
    constructor() {
        this.hasRegistration = false;
        this._swPush = inject(SwPush);
        this._portalService = inject(PortalService);
        this.init();
    }
    // بررسی وضعیت فعلی
    get isEnabled() {
        return this._swPush.isEnabled && this.hasRegistration;
    }
    async closeNotifications(tags) {
        const sw = await this.getSw();
        if (!sw) {
            return;
        }
        tags.forEach(async (tag) => {
            const notifs = await sw?.getNotifications({ tag });
            if (notifs?.length) {
                notifs.forEach((c) => c.close());
            }
        });
    }
    // نمایش دستی نوتیفیکیشن (برای تست)
    async showNotification(payload) {
        const sw = await this.getSw();
        if (!sw) {
            return;
        }
        const { isRtl, lang, notificationItem } = payload;
        const tag = notificationItem.Tag;
        const dir = isRtl ? 'rtl' : 'ltr';
        const actions = !notificationItem.UiActions
            ? []
            : notificationItem.UiActions.map((action) => ({
                title: action.Title,
                icon: action.Icon,
                action: action.Title
            }));
        const moInfo = !tag ? `&moid=${notificationItem.Id}&tpid=${notificationItem.$TypeDefId}` : ``;
        const data = {
            onActionClick: {
                default: { operation: 'openWindow', url: `#/login?notificationTag=${tag}&action=show${moInfo}` }
            }
        };
        actions.forEach((action) => {
            data.onActionClick[action.title] = {
                operation: 'focusLastFocusedOrOpen',
                url: `#/login?notificationTag=${tag}&action=${action.title}`
            };
        });
        sw?.showNotification(notificationItem.Title, {
            dir,
            tag,
            body: notificationItem.Content,
            image: notificationItem.Image,
            icon: notificationItem.Icon ? notificationItem.Icon : '/notif.png',
            badge: '/notif.png',
            lang,
            actions,
            data
        });
    }
    async init() {
        console.log(`SwPush enabled: ${this._swPush.isEnabled}`);
        // مدیریت کلیک روی نوتیفیکیشن‌ها
        this._swPush.notificationClicks.subscribe((e) => {
            if (!e.notification.tag) {
                return;
            }
            const actionTitle = e.action || 'show';
            if (!BarsaApi?.LoginFormData?.IsUserLoggedIn) {
                return;
            }
            this._portalService.ExecuteNotificationAction(e.notification.tag, actionTitle);
        });
        // بررسی مجوز و ثبت سرویس‌ورکر
        await this.registerServiceWorker();
    }
    async registerServiceWorker() {
        if (!('serviceWorker' in navigator)) {
            return;
        }
        const reg = await navigator.serviceWorker.getRegistration();
        this.hasRegistration = !!reg;
    }
    async getSw() {
        const reg = await navigator.serviceWorker.getRegistration();
        this.hasRegistration = !!reg;
        return reg;
    }
    _isSupported() {
        if (!('serviceWorker' in navigator)) {
            // Service Worker isn't supported on this browser, disable or hide UI.
            return false;
        }
        if (!('PushManager' in window)) {
            // Push isn't supported on this browser, disable or hide UI.
            return false;
        }
        return true;
    }
    _isActionsSupported() {
        return 'actions' in Notification.prototype;
    }
    _isIconSupported() {
        return 'icon' in Notification.prototype;
    }
    isBadgeSupported() {
        return 'badge' in Notification.prototype;
    }
    _isDirSupported() {
        return 'dir' in Notification.prototype;
    }
    isImageSupported() {
        return 'image' in Notification.prototype;
    }
    isTitleBodySupported() {
        return 'title' in Notification.prototype && 'body' in Notification.prototype;
    }
    isVibrateSupported() {
        return 'vibrate' in Notification.prototype;
    }
    isTimestampSupported() {
        return 'timestamp' in Notification.prototype;
    }
    isTagSupported() {
        return 'tag' in Notification.prototype;
    }
    isSoundSupported() {
        return 'sound' in Notification.prototype;
    }
    isSilentSupported() {
        return 'silent' in Notification.prototype;
    }
    isReqInterSupported() {
        return 'requireInteraction' in Notification.prototype;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ServiceWorkerNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ServiceWorkerNotificationService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ServiceWorkerNotificationService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class NotificationService {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this.pageCount = 1;
        this.pageIndex = 0;
        this._popupService = inject(NOTIFICATAION_POPUP_SERVER);
        this._logService = inject(LogService);
        this._bbbTranslate = inject(BbbTranslatePipe);
        this._domSanitizer = inject(DomSanitizer);
        this._serviceWorkerNotification = inject(ServiceWorkerNotificationService);
        this._portalService = inject(PortalService);
        this._ngZone = inject(NgZone);
        this._notifications$ = new BehaviorSubject([]);
        this._notificationUnreadCount$ = new BehaviorSubject(0);
        this._notificationLoading$ = new BehaviorSubject(false);
        this._notifiationCountLoaded$ = new BehaviorSubject(false);
        this._portalService.userPortalSettings$.pipe().subscribe((userPortalSettings) => {
            this.userNotificationSettings = userPortalSettings['UserNotificationSetting'];
        });
    }
    get notificationCountLoaded$() {
        return this._notifiationCountLoaded$.asObservable();
    }
    get notificationUnreadCount$() {
        return this._notificationUnreadCount$.asObservable();
    }
    get notifications$() {
        return this._notifications$.asObservable().pipe();
    }
    get notificationLoading$() {
        return this._notificationLoading$.asObservable();
    }
    ShowNotificationRelatedMo(e) {
        const ee = {
            ...e,
            afterReady: (_e2) => {
                BarsaApi.Bw.RunBlMethodAsync({
                    Parameters: [e.tag],
                    Method: 'Barsa_SetReadRadifCartableByTag',
                    FailFn: (err) => {
                        this._logService.error(err);
                    }
                });
            }
        };
        this._portalService.ShowForm(ee);
    }
    handleTopic(eventTopic, _content, _ownerKey) {
        if (eventTopic === 'RefreshNotificationUnreadCount') {
            setTimeout(() => {
                this.LoadUnreadNotificationCount();
            }, 1000);
        }
    }
    addNotification(msg, title, _type, image, mo, uiOptions, otherOptions) {
        this._ngZone.run(() => {
            if (otherOptions) {
                const { MoId, TypeDefId } = otherOptions;
                let newNotification = {
                    $Caption: title,
                    Id: MoId,
                    $TypeDefId: TypeDefId,
                    Title: title,
                    Unread: true,
                    Icon: image,
                    Image: '',
                    Content: msg,
                    Tag: '',
                    Priority: 0,
                    Subject: '',
                    $SafeContent: this._domSanitizer.bypassSecurityTrustHtml(msg),
                    CreationDate: new Date(),
                    CreationDate$Caption: this._bbbTranslate.transform('DateR_Today')
                };
                const parsedMo = mo ? BarsaApi.Ext.decode(mo) : null;
                newNotification = this._prepareProperties(newNotification, parsedMo, msg);
                if (parsedMo) {
                    const molist = this._notifications$.getValue();
                    this._notifications$.next([newNotification, ...molist]);
                }
                this.showNotification(newNotification, parsedMo, uiOptions, otherOptions);
            }
        });
    }
    LoadUnreadNotificationCount() {
        BarsaApi.Bw.RunBlMethodAsync({
            Parameters: [BarsaApi.LoginFormData.PortalId],
            Method: 'GetShellbarNotificationUnreadCountByPortalId',
            SuccessFn: (e) => {
                this._notifiationCountLoaded$.next(true);
                this._notificationUnreadCount$.next(e);
            },
            FailFn: (e) => {
                this._logService.error(e);
            }
        });
    }
    get SupportNotifications() {
        return (typeof Notification !== 'undefined' &&
            this._serviceWorkerNotification.isEnabled &&
            Notification.permission === 'granted');
    }
    showNotification(notificationItem, mo, uiOptions, otherOptions) {
        if (notificationItem.Title && notificationItem.Title.startsWith('[') && notificationItem.Title.endsWith(']')) {
            return;
        }
        if (notificationItem.Title && notificationItem.Title.startsWith('{') && notificationItem.Title.endsWith('}')) {
            return;
        }
        if (mo && !mo.ShowPopup) {
            return;
        }
        if (!this.SupportNotifications) {
            this._logService.warn(`InApp Notification is not supported.`);
            uiOptions = uiOptions ?? {};
            uiOptions.NotificationItem = notificationItem;
            this._popupNotify(notificationItem, mo, uiOptions, otherOptions);
            return;
        }
        this._inAppNotify(notificationItem);
    }
    notificationLoading(loading) {
        this._notificationLoading$.next(loading);
    }
    _setNotificationLoading(molist, loading = true) {
        const molistCurr = this._notifications$.getValue();
        const moIds = molist.map((c) => c.Id);
        const molistWithLoadingProperty = molistCurr.map((c) => ({
            ...c,
            $NotificatoinLoading: moIds.indexOf(c.Id) !== -1 ? loading : c.$NotificatoinLoading
        }));
        this._notifications$.next([...molistWithLoadingProperty]);
        return moIds;
    }
    _popupNotify(notificationItem, mo, uiOptions, otherOptions) {
        this._popupService.popupNotify(notificationItem.$SafeContent, notificationItem.Title, notificationItem.Subject, notificationItem.Image, mo, uiOptions, otherOptions);
    }
    _prepareProperties(notificationItem, mo, content) {
        if (!mo) {
            return notificationItem;
        }
        return {
            ...notificationItem,
            ...mo,
            UiActions: !mo.UiActions ? [] : JSON.parse(mo.UiActions),
            CreationDate: mo.IMessage.CreationDate,
            CreationDate$Caption: mo.IMessage.CreationDate$Caption,
            CreatorUser: mo.IMessage.CreatorUser,
            CreatorUser$Caption: mo.IMessage.CreatorUser$Caption,
            Icon: `${BarsaApi.Bw.Origin()}${notificationItem.Icon}`,
            $SafeContent: this._domSanitizer.bypassSecurityTrustHtml(content)
        };
    }
    _inAppNotify(notificationItem) {
        Notification.requestPermission((result) => {
            const lang = BarsaApi.LoginFormData.Culture;
            const isRtl = BarsaApi.LoginFormData.CulturesRtl[lang];
            if (result === 'granted') {
                this._serviceWorkerNotification.showNotification({
                    notificationItem,
                    isRtl,
                    lang
                });
            }
            else {
                // TODO:permission denied
                this._logService.error('notification permission denied.');
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NotificationService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NotificationService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class ColumnService {
    get uiControlRendered() {
        return this._uiControlRendered.asObservable();
    }
    constructor() {
        this._uiControlRendered = new Subject();
    }
    controlRendered() {
        this._uiControlRendered.next();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

// src/app/services/idb.service.ts
class IdbService {
    constructor() {
        this.dbPromise = openDB('my-app-db', 2, {
            upgrade(db, oldVersion) {
                if (!db.objectStoreNames.contains('subscription')) {
                    db.createObjectStore('subscription');
                }
                if (!db.objectStoreNames.contains('settings')) {
                    db.createObjectStore('settings');
                }
                if (oldVersion < 2 && !db.objectStoreNames.contains('runtimeNavState')) {
                    db.createObjectStore('runtimeNavState');
                }
            }
        });
    }
    async get(store, key) {
        const db = await this.dbPromise;
        const v = await db.get(store, key);
        return (v === undefined ? null : v);
    }
    async set(store, key, value) {
        const db = await this.dbPromise;
        await db.put(store, value, key);
    }
    async delete(store, key) {
        const db = await this.dbPromise;
        await db.delete(store, key);
    }
    async getAllKeys(store) {
        const db = await this.dbPromise;
        const keys = await db.getAllKeys(store);
        return keys;
    }
    async clearStore(store) {
        const db = await this.dbPromise;
        await db.clear(store);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IdbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IdbService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IdbService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class PushNotificationService {
    constructor() {
        this.BANNER_DISMISS_KEY = 'push_banner_dismissed_until';
        this.swPush = inject(SwPush);
        this.http = inject(HttpClient);
        this.idb = inject(IdbService);
        this.local = inject(LocalStorageService);
        // یک سیگنال واحد
        this._push = signal({
            bannerVisible: false,
            isSubscribed: false,
            permission: checkPermission(),
            errorMessage: null
        });
        this.registerServiceWorkerMessageListener = () => {
            // avoid adding multiple listeners (idempotent)
            const onMessage = (event) => {
                const data = event.data;
                if (!data) {
                    return;
                }
                if (data.event === 'subscriptionChanged' && data.subscription) {
                    // run async handler but don't await here
                    (async () => {
                        await this.handleNewSubscription(data.subscription);
                    })().catch(console.error);
                }
            };
            // addEventListener is idempotent-ish but let's guard by setting property
            // we attach once on navigator.serviceWorker (not to window)
            navigator.serviceWorker?.addEventListener('message', onMessage);
        };
    }
    get push() {
        return this._push.asReadonly();
    }
    hideBanner() {
        // ۲. ذخیره زمان فعلی + ۲۴ ساعت (یا هر بازه مد نظر) در LocalStorage
        const tomorrow = Date.now() + 24 * 60 * 60 * 1000;
        this.local.setItem(this.BANNER_DISMISS_KEY, tomorrow.toString());
        this.update({ bannerVisible: false });
    }
    async setup() {
        // Load subscription status
        await this.initPushBanner();
        // Listen for subscription updates
        this.swPush.subscription.subscribe((sub) => {
            this.update({
                isSubscribed: !!sub,
                permission: checkPermission()
            });
            if (sub) {
                const json = sub.toJSON?.() ?? sub;
                this.handleNewSubscription(json);
            }
        });
        // Listen for SW messages
        navigator.serviceWorker?.addEventListener('message', (event) => {
            if (event.data?.event === 'subscriptionChanged') {
                this.handleNewSubscription(event.data.subscription);
            }
        });
    }
    async subscribe() {
        this.update({
            bannerVisible: false
        });
        try {
            const publicKey = await lastValueFrom(this.http.get('/api/pushnotification/publickey', { responseType: 'text' }));
            await this.idb.set('settings', 'vapid-public-key', publicKey);
            const sub = await this.swPush.requestSubscription({ serverPublicKey: publicKey });
            await lastValueFrom(this.http.post('/api/pushnotification/add', sub, this.httpOptions()));
            await this.idb.set('subscription', 'push-subscription', sub.toJSON());
            this.update({
                isSubscribed: true,
                permission: checkPermission(),
                bannerVisible: false,
                errorMessage: null
            });
            return sub;
        }
        catch (err) {
            this.update({ errorMessage: err.message ?? 'خطا در فعال‌سازی اعلان', bannerVisible: true });
            throw err;
        }
    }
    async unsubscribe() {
        try {
            const sub = await lastValueFrom(this.swPush.subscription.pipe(timeout(500), // اگر در 500ms چیزی نداد
            catchError$1(() => of(null)) // مقدار null برگردان
            ));
            if (!sub) {
                return;
            }
            const json = sub.toJSON();
            await lastValueFrom(this.http.post('/api/pushnotification/delete', json, this.httpOptions()));
            await sub.unsubscribe();
            await this.deleteSubscription();
            this.update({ isSubscribed: false, errorMessage: null });
        }
        catch (err) {
            this.update({ errorMessage: err.message ?? 'خطا در لغو اشتراک' });
        }
    }
    async handleNewSubscription(subData) {
        const saved = await this.idb.get('subscription', 'push-subscription');
        if (!saved || saved.endpoint !== subData.endpoint) {
            if (saved) {
                await lastValueFrom(this.http.post('/api/pushnotification/delete', saved, this.httpOptions()));
            }
            await lastValueFrom(this.http.post('/api/pushnotification/add', subData, this.httpOptions()));
            await this.idb.set('subscription', 'push-subscription', subData);
        }
        this.update({
            isSubscribed: true,
            permission: checkPermission(),
            errorMessage: null
        });
    }
    update(values) {
        this._push.update((prev) => ({ ...prev, ...values }));
    }
    async loadSubscription() {
        return await this.idb.get('subscription', 'push-subscription');
    }
    async loadPublicKey() {
        return await this.idb.get('settings', 'vapid-public-key');
    }
    async initPushBanner() {
        let saved = await this.loadSubscription();
        const perm = checkPermission();
        // ۳. بررسی امن بودن پروتکل (HTTPS یا Localhost)
        const isActuallyHttps = window.location.protocol === 'https:';
        // const isLocal = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
        const isSecureContext = window.isSecureContext && isActuallyHttps;
        this.update({ permission: perm });
        if (saved) {
            if (perm === 'default' || perm === 'denied') {
                await this.deleteSubscription();
                saved = null;
            }
        }
        if (saved) {
            this.update({ isSubscribed: true, bannerVisible: false });
        }
        else {
            // ۴. منطق جدید برای نمایش بنر
            const dismissUntil = Number(this.local.getItem(this.BANNER_DISMISS_KEY) || 0);
            const isWaitPeriodOver = Date.now() > dismissUntil;
            const shouldShow = isSecureContext && // حتما HTTPS باشد
                perm !== 'denied' && // قبلا بلاک نکرده باشد
                perm !== 'granted' && // قبلا اکسپت نکرده باشد (اگر saved نال بود)
                isWaitPeriodOver && // زمان انتظار تمام شده باشد
                'PushManager' in window; // مرورگر پشتیبانی کند
            this.update({
                isSubscribed: false,
                bannerVisible: shouldShow
            });
        }
        // بقیه کدها...
        this.registerServiceWorkerMessageListener();
        const publicKey = await this.loadPublicKey();
        if (publicKey) {
            const reg = await navigator.serviceWorker.ready;
            reg.active?.postMessage({ event: 'setVapidKey', publicKey });
        }
    }
    async deleteSubscription() {
        await this.idb.delete('subscription', 'push-subscription');
    }
    httpOptions() {
        const token2 = this.local.getItem(BarsaApi.LoginAction.token2StorageKey) ?? '';
        return { headers: new HttpHeaders({ 'Content-Type': 'application/json', sth: token2 }) };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushNotificationService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushNotificationService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

class ServiceWorkerCommuncationService {
    constructor() {
        this._toastService = inject(TOAST_SERVICE, { optional: true });
        this._localStorage = inject(LocalStorageService);
        this._portalService = inject(PortalService);
        this._pushNotificatioService = inject(PushNotificationService);
    }
    get token2() {
        return this._localStorage.getItem(BarsaApi.LoginAction.token2StorageKey) ?? '';
    }
    init() {
        this._subscribe();
        BarsaApi.Ul.ApplicationCtrlr.on({
            UserLoggedout: (_, doReturn) => this._handlePushUnSubscription(doReturn)
        });
        // register SW
        if (!navigator.serviceWorker) {
            return;
        }
        navigator.serviceWorker.ready.then((reg) => {
            if (reg.active) {
                this._serviceWorker = reg.active;
                navigator.serviceWorker.addEventListener('message', (event) => {
                    if (event.data?.event === 'subscriptionChanged') {
                        this._pushNotificatioService.handleNewSubscription(event.data.subscription);
                    }
                });
            }
        });
        // user logout
    }
    _subscribe() {
        this._portalService.userLoggedIn$.pipe().subscribe((isLoggedIn) => this._isLoggedIn(isLoggedIn));
        this._portalService.documentVisibilitychange$
            .pipe()
            .subscribe((visibilitychange) => this._visibilitychange(visibilitychange));
    }
    _setDefaultOptions() {
        const token2 = this.token2;
        const lang = BarsaApi.LoginFormData.Culture;
        const dir = BarsaApi.LoginFormData.IsRtl ? 'rtl' : 'ltr';
        this._postServiceWorker({ event: 'setOptions', options: { token2, lang, dir } });
    }
    _isLoggedIn(isLoggedIn) {
        this._postServiceWorker({ event: 'isLoggedInChange', options: { isLoggedIn } });
        if (isLoggedIn) {
            this._setDefaultOptions();
            setTimeout(() => {
                this._pushNotificatioService.setup();
            }, 5000);
        }
    }
    _visibilitychange(documentIsHidden) {
        this._postServiceWorker({ event: 'visibilitychange', options: { documentIsHidden } });
    }
    _postServiceWorker(message) {
        // console.log(`post message to sw ${JSON.stringify(message, null, 2)}`);
        if (!this._serviceWorker) {
            console.warn(`service worker is undefined.`);
            return;
        }
        this._serviceWorker.postMessage(message);
    }
    // لغو push (هر زمان امکان‌پذیر است)
    _handlePushUnSubscription(doReturn) {
        if (!navigator.serviceWorker) {
            doReturn();
            return;
        }
        this._pushNotificatioService.unsubscribe().finally(() => doReturn && doReturn());
    }
    toast(msg) {
        if (!this._toastService) {
            return console.log(msg);
        }
        this._toastService.open(msg, { duration: 5000 });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ServiceWorkerCommuncationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ServiceWorkerCommuncationService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ServiceWorkerCommuncationService, decorators: [{
            type: Injectable
        }] });

class SaveScrollPositionService {
    constructor() {
        this._scrollPositionSource = new BehaviorSubject({
            key: 'body',
            scrollTop: 0
        });
    }
    get scrollPosition$() {
        return this._scrollPositionSource.asObservable();
    }
    getScrollPosition(key) {
        const val = this._scrollPositionSource.getValue();
        return val[key];
    }
    setScrollPosition(key, scrollTop) {
        const value = this._scrollPositionSource.getValue();
        value[key] = scrollTop;
        this._scrollPositionSource.next(value);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SaveScrollPositionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SaveScrollPositionService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SaveScrollPositionService, decorators: [{
            type: Injectable
        }] });

class RoutingService {
    constructor() {
        this.oldActiveSystem = null;
        this.router = inject(Router);
        this.isSidebar = false;
        this._Object = {
            ShowSystemContainerPage: (navItem) => {
                if (navItem.DynamicCommand) {
                    const logParams = { CommandId: navItem.FolderId };
                    const finish = BarsaApi.Common.LogManager.StartLog('Navigator.Command', logParams);
                    const e = { Command: navItem, DynamicSetting: navItem.DynamicCommand };
                    BarsaApi.Common.CustomCodeManager.RunDynamicCommand(navItem.Id, e, finish);
                    BarsaApi.Common.LogManager.EndLog();
                }
                else {
                    const repId = navItem.ReportId ? `__${navItem.ReportId}` : '';
                    if (this.handleReport) {
                        const skip = this.handleReport(repId, navItem.Id);
                        if (skip) {
                            return;
                        }
                    }
                    if (this.isSidebar) {
                        this.router.navigate([
                            {
                                outlets: {
                                    mainside: ['report', `${navItem.Id}__${navItem.Caption}${repId}__null__false`]
                                }
                            }
                        ], { relativeTo: this._activatedRoute });
                        return;
                    }
                    this.router.navigate(['report', `${navItem.Id}__${navItem.Caption}${repId}`], {
                        relativeTo: this._activatedRoute
                    });
                }
            }
        };
        this.isFirstPage = true;
        this.masterDetails = false;
        this.isMobile = getDeviceIsMobile();
        this._activatedRoute = inject(ActivatedRoute);
        this._router = inject(Router);
        this._portalService = inject(PortalService);
        this._parentRoutingService = inject(RoutingService, { skipSelf: true, optional: true });
        this._onDestroy$ = new Subject();
        this._formDialogComponent = inject(FORM_DIALOG_COMPONENT, { optional: true });
        this._dialogService = inject(DIALOG_SERVICE, { optional: true });
        this._vcr = inject(ViewContainerRef);
        /* eslint-disable */
        this.ForceClose = () => {
            this.parentContainer.ForceCloseChild();
        };
        this.ShowFormPanelControl = (formpanelCtrlr) => {
            this.formpanelCtrlr = formpanelCtrlr;
            this._showFormPanel();
        };
        /* eslint-disable */
        this.ForceCloseChild = () => {
            this._router.navigate(['../'], { relativeTo: this._activatedRoute });
        };
        /* eslint-disable */
        this.RefreshFormPanelControl = (formpanelCtrlr) => {
            if (!this.formpanelCtrlr) {
                this.formpanelCtrlr = formpanelCtrlr;
            }
            else {
                formpanelCtrlr = this._portalService.formPanels[this.formpanelCtrlrId];
            }
            this._showFormPanel(true);
        };
        this.oldActiveSystem = BarsaApi.Bw.App.GetActiveSystem;
        this._activatedRoute.params.pipe(takeUntil$1(this._onDestroy$)).subscribe((_params) => {
            const state = this._router.getCurrentNavigation()?.extras.state;
            this.formpanelCtrlrId = state?.formPanelCtrlrId;
        });
        this.paramId$ = this._activatedRoute.paramMap.pipe(takeUntil$1(this._onDestroy$));
        this.routeEvents$ = this._router.events.pipe(takeUntil$1(this._onDestroy$), filter$1((event) => event instanceof NavigationEnd && event instanceof RouterEvent));
        BarsaApi.Bw.App.GetActiveSystem = () => this;
        this.parentContainer = BarsaApi.Bw.FormHandler;
        BarsaApi.Bw.FormHandler = this;
        this.oldNavigation = BarsaApi.Bw.Navigate;
        BarsaApi.Bw.Navigate = (navigation, isRelative, queryParams, data) => {
            const routingService = this._parentRoutingService || this;
            routingService.navigate(navigation, isRelative, queryParams, data);
        };
    }
    ngOnDestroy() {
        BarsaApi.Bw.App.GetActiveSystem = this.oldActiveSystem;
        BarsaApi.Bw.Navigate = this.oldNavigation;
        BarsaApi.Bw.FormHandler = this.parentContainer;
    }
    _showFormPanel(refreshOnly = false) {
        this._portalService.ShowFormPanelControl(this.formpanelCtrlr, this._router, this._activatedRoute, this._formDialogComponent, this.isFirstPage, this._vcr, refreshOnly);
    }
    navigate(navigation, isRelative, queryParams, state) {
        if (this.masterDetails && !this.isMobile) {
            this.navigateMasterDetails(navigation, isRelative, queryParams, state);
            return;
        }
        this._router.navigate(navigation, {
            relativeTo: isRelative ? this._activatedRoute : null,
            queryParams,
            preserveFragment: true,
            state
        });
    }
    navigateMasterDetails(navigation, isRelative, queryParams, data) {
        if (this._portalService.deviceSize !== 's') {
            navigation = [{ outlets: { details: [...navigation.filter((_c, index) => index > 0)] } }];
        }
        this._router.navigate(navigation, {
            relativeTo: isRelative ? this._activatedRoute : null,
            queryParams,
            preserveFragment: true,
            state: { ...data }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RoutingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RoutingService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RoutingService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class GroupByService {
    constructor() {
        this._groupBy = new BehaviorSubject([]);
        this.groupBy$ = this._groupBy.asObservable();
    }
    setGroupBy(groupBy) {
        this._groupBy.next(groupBy);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GroupByService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GroupByService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GroupByService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: () => [] });

class LayoutMainContentService {
    constructor() {
        this.mainContentHeightSource = new BehaviorSubject(0);
        this.mainContentHeight$ = this.mainContentHeightSource.asObservable().pipe(distinctUntilChanged());
    }
    setMainContentHeight(height) {
        this.mainContentHeightSource.next(height);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutMainContentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutMainContentService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutMainContentService, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class TabpageService {
    setItemCount(itemCount) {
        this.itemCount = itemCount;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TabpageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TabpageService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TabpageService, decorators: [{
            type: Injectable
        }] });

class InMemoryStorageService {
    constructor() {
        this._dictionary = new Map();
    }
    setItem(key, value) {
        this._dictionary.set(key, value);
    }
    getItem(key) {
        return this._dictionary.get(key);
    }
    remove(key) {
        this._dictionary.delete(key);
    }
    clear() {
        this._dictionary.clear();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: InMemoryStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: InMemoryStorageService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: InMemoryStorageService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

class ScrollLayoutContextHolder {
    constructor() {
        this._mode = signal('root');
        this.mode = this._mode.asReadonly();
    }
    setMode(mode) {
        this._mode.set(mode);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScrollLayoutContextHolder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScrollLayoutContextHolder }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScrollLayoutContextHolder, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class ShellbarHeightService {
    constructor() {
        this._dict = new BehaviorSubject(['']);
        this.shellbarHeight$ = this._dict
            .asObservable()
            .pipe(map$1((x) => !x.length ? '' : 'calc(' + x.reduce((prev, curr) => (prev ? `${prev} + ${curr}` : `${curr}`)) + ')'));
    }
    add(variableValue) {
        const x = this._dict.getValue();
        if (!x.includes(variableValue)) {
            x.push(variableValue);
        }
        this._dict.next([...x]);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ShellbarHeightService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ShellbarHeightService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ShellbarHeightService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class PushCheckService {
    async checkPushReady() {
        if (!this.baseSupport()) {
            return 'مرورگر شما Push API را پشتیبانی نمی‌کند';
        }
        const iosCheck = this.iosSupport();
        if (iosCheck !== true) {
            return iosCheck;
        }
        if (Notification.permission === 'denied') {
            return 'شما قبلاً اجازه نوتیفیکیشن را رد کرده‌اید. از تنظیمات مرورگر آن را فعال کنید';
        }
        const regs = await navigator.serviceWorker.getRegistrations();
        if (!regs.length) {
            return 'Service Worker ثبت نشده است';
        }
        return true;
    }
    getIosVersion() {
        const ua = navigator.userAgent;
        if (/iP(hone|od|ad)/.test(ua)) {
            const v = ua.match(/OS (\d+)_/);
            return v ? parseInt(v[1], 10) : null;
        }
        return null;
    }
    isIosStandalone() {
        return 'standalone' in navigator && navigator.standalone === true;
    }
    isSafari() {
        const ua = navigator.userAgent.toLowerCase();
        return ua.includes('safari') && !ua.includes('chrome');
    }
    baseSupport() {
        return 'Notification' in window && 'serviceWorker' in navigator && 'PushManager' in window;
    }
    iosSupport() {
        const v = this.getIosVersion();
        if (v && v < 16) {
            return 'نسخه iOS کمتر از 16 است (Push پشتیبانی نمی‌شود)';
        }
        if (v && v < 16.4) {
            return 'iOS باید حداقل نسخه 16.4 باشد تا Push فعال شود';
        }
        if (v && !this.isSafari()) {
            return 'Push فقط در Safari iOS پشتیبانی می‌شود';
        }
        if (v && !this.isIosStandalone()) {
            return 'برای فعال شدن Push، برنامه را با Add to Home Screen نصب کنید';
        }
        return true;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

/** Discriminator for migrations and mixed payload kinds. */
const RUNTIME_NAV_STATE_SCHEMA_V1 = 'report-nav-runtime/v1';
/**
 * Stable cache key: report-scoped MO identity.
 * Future: prefix with navigationScopeId for split/compare/popup (architecture note only in v1).
 */
function buildRuntimeNavStateCacheKey(reportIdSeg, moId, typeDefId) {
    return `runtime:${reportIdSeg}:${moId}:${typeDefId}`;
}

const RUNTIME_NAV_STORE = 'runtimeNavState';
const SESSION_STORAGE_KEY = 'runtime-session-id';
const MAX_MEMORY_ENTRIES = 100;
function cloneForPersist(value) {
    try {
        return structuredClone(value);
    }
    catch {
        return JSON.parse(JSON.stringify(value));
    }
}
class RuntimeNavStateCacheService {
    constructor() {
        this._idb = inject(IdbService);
        this._memory = new Map();
        this._sessionId = this._ensureSessionId();
        void this._purgeStaleFromIdb();
        if (isDevMode() && typeof window !== 'undefined') {
            window.__runtimeNavCache = this;
        }
    }
    /** @internal tests / diagnostics */
    get currentSessionId() {
        return this._sessionId;
    }
    save(key, envelope) {
        const snapshot = cloneForPersist({
            ...envelope,
            sessionId: this._sessionId,
            createdAt: envelope.createdAt ?? Date.now()
        });
        return (async () => {
            await this._idb.set(RUNTIME_NAV_STORE, key, snapshot);
            this._memory.set(key, snapshot);
            this._evictMemoryIfNeeded();
        })();
    }
    get(key) {
        const mem = this._memory.get(key);
        if (mem !== undefined) {
            return Promise.resolve(mem);
        }
        return (async () => {
            const row = await this._idb.get(RUNTIME_NAV_STORE, key);
            if (row == null) {
                return null;
            }
            if (row.sessionId !== this._sessionId) {
                return null;
            }
            this._memory.set(key, row);
            this._evictMemoryIfNeeded();
            return row;
        })();
    }
    remove(key) {
        return (async () => {
            this._memory.delete(key);
            await this._idb.delete(RUNTIME_NAV_STORE, key);
        })();
    }
    clear() {
        return (async () => {
            this._memory.clear();
            await this._idb.clearStore(RUNTIME_NAV_STORE);
        })();
    }
    /** Optional contract: snapshot of keys ? serialized envelopes (for debugging). */
    getAllEntries() {
        return (async () => {
            const out = {};
            for (const [k, v] of this._memory.entries()) {
                out[k] = cloneForPersist(v);
            }
            const keys = await this._idb.getAllKeys(RUNTIME_NAV_STORE);
            for (const key of keys) {
                if (out[key] !== undefined) {
                    continue;
                }
                const row = await this._idb.get(RUNTIME_NAV_STORE, key);
                if (row?.sessionId === this._sessionId) {
                    out[key] = cloneForPersist(row);
                }
            }
            return out;
        })();
    }
    _ensureSessionId() {
        if (typeof sessionStorage === 'undefined') {
            return `ssr-${crypto.randomUUID()}`;
        }
        let id = sessionStorage.getItem(SESSION_STORAGE_KEY);
        if (!id) {
            id = crypto.randomUUID();
            sessionStorage.setItem(SESSION_STORAGE_KEY, id);
        }
        return id;
    }
    _evictMemoryIfNeeded() {
        while (this._memory.size > MAX_MEMORY_ENTRIES) {
            const first = this._memory.keys().next().value;
            if (first === undefined) {
                break;
            }
            this._memory.delete(first);
        }
    }
    async _purgeStaleFromIdb() {
        try {
            const keys = await this._idb.getAllKeys(RUNTIME_NAV_STORE);
            for (const key of keys) {
                const row = await this._idb.get(RUNTIME_NAV_STORE, key);
                if (row == null || row.sessionId !== this._sessionId) {
                    await this._idb.delete(RUNTIME_NAV_STORE, key);
                }
            }
        }
        catch {
            /* ignore IDB errors during purge */
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RuntimeNavStateCacheService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RuntimeNavStateCacheService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RuntimeNavStateCacheService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class CardViewService {
    constructor() {
        this._maxHeaderTitleHeight$ = new BehaviorSubject(0);
        this._ulvMainService = inject(UlvMainService);
    }
    get maxHeaderTitleHeight$() {
        return this._maxHeaderTitleHeight$.asObservable();
    }
    setHeaderHeight(height) {
        const currHeight = this._maxHeaderTitleHeight$.getValue();
        if (currHeight < height) {
            this._maxHeaderTitleHeight$.next(height);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardViewService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardViewService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardViewService, decorators: [{
            type: Injectable
        }] });

class BaseSettingsService {
    constructor() {
        this.idb = inject(IdbService);
    }
    getSetting(key) {
        // تبدیل Promise به Observable
        return from(this.idb.get('settings', key));
    }
    saveSetting(key, value) {
        return from(this.idb.set('settings', key, value));
    }
    removeSetting(key) {
        return from(this.idb.delete('settings', key));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseSettingsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseSettingsService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseSettingsService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }] });

class SimpleTemplateEngine {
    constructor() {
        this.cache = new Map();
    }
    render(template, valueResolver) {
        if (!template) {
            return '';
        }
        let compiled = this.cache.get(template);
        if (!compiled) {
            compiled = this.compile(template);
            this.cache.set(template, compiled);
        }
        return compiled(valueResolver);
    }
    isSafeKey(key) {
        return /^[a-zA-Z0-9_.]+$/.test(key);
    }
    compile(template) {
        const tokens = [];
        const regex = /\[(.*?)\]/g;
        let lastIndex = 0;
        let match;
        while ((match = regex.exec(template))) {
            const index = match.index;
            if (index > lastIndex) {
                tokens.push(template.slice(lastIndex, index));
            }
            const key = match[1].trim();
            tokens.push((resolver) => {
                try {
                    if (!this.isSafeKey(key)) {
                        return '';
                    }
                    const value = resolver(key);
                    if (value == null) {
                        return '';
                    }
                    return String(value);
                }
                catch {
                    return '';
                }
            });
            lastIndex = regex.lastIndex;
        }
        if (lastIndex < template.length) {
            tokens.push(template.slice(lastIndex));
        }
        return (resolver) => {
            let result = '';
            for (const token of tokens) {
                result += typeof token === 'string' ? token : token(resolver);
            }
            return result;
        };
    }
}
const TEMPLATE_ENGINE = new InjectionToken('TEMPLATE_ENGINE', {
    providedIn: 'root',
    factory: () => new SimpleTemplateEngine()
});

class FieldBaseComponent extends BaseComponent {
    get customFieldInfo() {
        return this.context.Setting.CustomFieldInfo;
    }
    constructor() {
        super();
        this.valueChange = new EventEmitter();
        this.formmatedValue = new EventEmitter();
        this.isMobile = getDeviceIsMobile();
        this.isTablet = getDeviceIsTablet();
        this._rlt = true;
        this.mobileConfig = {
            title: 'انتخاب',
            approveButtonText: 'تایید',
            cancelButtonText: 'انصراف',
            hasCloseButton: true,
            dialogConfig: {
                ariaLabel: 'انتخاب'
            }
        };
        this.errorMessage = signal('');
        this.errorCode = signal(-1);
        this.injector = inject(Injector);
        // #endregion
        this._portalService = inject(PortalService);
        this._bbbPipe = inject(BbbTranslatePipe);
        this._picFieldSrc = inject(PictureFieldSourcePipe);
        this._numeralPipe = inject(NumeralPipe);
        this._cdr = inject(ChangeDetectorRef);
        this._renderer2 = inject(Renderer2);
        this._activatedRoute = inject(ActivatedRoute);
        this._domSanitizer = inject(DomSanitizer);
        this._uploadService = inject(UploadService, { self: true, optional: true });
        this._dateService = inject(DateService, { self: true, optional: true });
        this._audioRecorder = inject(AudioRecordingService, { self: true, optional: true });
        this._videoRecoder = inject(VideoRecordingService, { self: true, optional: true });
        this._columnService = inject(ColumnService, { optional: true });
        this._refreshSource = new Subject();
        this._valueChangedSource = new Subject();
        this._disableChangedSource = new BehaviorSubject(false);
        this._readonlyChangedSource = new BehaviorSubject(false);
        this._portalService.rtl$.pipe(takeUntil(this._onDestroy$)).subscribe((c) => (this._rlt = c));
        this.refresh$ = this._refreshSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.value$ = this._valueChangedSource.asObservable().pipe(takeUntil(this._onDestroy$));
        this.deviceSize$ = this._portalService.deviceSize$;
        this.disable$ = this._disableChangedSource
            .asObservable()
            .pipe(takeUntil(this._onDestroy$), distinctUntilChanged());
        this.readonly$ = this._readonlyChangedSource
            .asObservable()
            .pipe(takeUntil(this._onDestroy$), distinctUntilChanged());
        this.disableOrReadonly$ = combineLatest([this.readonly$, this.disable$]).pipe(map(([disable, readonly]) => disable || readonly), distinctUntilChanged());
    }
    ngOnInit() {
        super.ngOnInit();
        this.controller?.init();
        if (this.context) {
            const elDom = this._el.nativeElement;
            this.context._el = elDom;
            !this.context.getEl && (this.context.getEl = () => ({ dom: elDom }));
            this.context.dom = this.el.nativeElement;
            this.context.id = this.id;
            this.Setting = this.context ? this.context.Setting : null;
            const readonly = this.context?.readOnly;
            this._setReadonly(readonly, false);
            this._setDisable(this.context.disable, false);
            this.JsonExtraProp = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.JsonExtraProp', null);
        }
        this._addListener();
        this._setMobileConfig();
    }
    ngOnChanges(changes) {
        const { cellEdit } = changes;
        if (cellEdit && !cellEdit.firstChange && cellEdit.currentValue) {
            this._focusToFirstFocusableElement();
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this._removeListener();
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        if (this.context) {
            this.context.rendered = true;
        }
        this._columnService?.controlRendered();
        if (this.focusControl) {
            this._focusToFirstFocusableElement();
        }
    }
    showError(message, code) {
        this.errorMessage.set(message);
        this.errorCode.set(code);
    }
    fireContextEvent(event, value, value1, value2) {
        this.context.fireEvent(event, value, value1, value2);
    }
    _focusToFirstFocusableElement() {
        const elDom = this._el.nativeElement;
        const focusableNodeList = elDom.querySelectorAll(getFocusableTagNames());
        let focused = false;
        focusableNodeList.forEach((el) => {
            const tagName = el.tagName.toLocaleLowerCase();
            if (!focused &&
                el.offsetWidth > 0 &&
                el.offsetHeight > 0 &&
                el.getAttribute('disabled') !== 'true' &&
                el.getAttribute('ng-reflect-disabled') !== 'true' &&
                !tagName.startsWith('fdp')) {
                el.focus();
                focused = true;
            }
        });
    }
    _setMobileConfig() {
        const mobileConfig = this.mobileConfig;
        mobileConfig.title = this.Setting?.ControlFieldCaptionTranslated;
        mobileConfig.dialogConfig && (mobileConfig.dialogConfig.ariaLabel = mobileConfig.title);
        mobileConfig.approveButtonText = this._bbbPipe.transform('Ok');
        mobileConfig.cancelButtonText = this._bbbPipe.transform('Cancel');
    }
    _addListener() {
        if (this.context && this.context.on) {
            this.context.on({
                ControlValueChanged: this._setValue.bind(this),
                ControlDisableChanged: this._setDisable.bind(this),
                ControlReadonlyChanged: this._setReadonly.bind(this),
                ControlRefresh: this._setRefresh.bind(this),
                ConfigChanged: this._configChaned.bind(this)
            });
        }
    }
    _removeListener() {
        if (this.context && this.context.un) {
            this.context.un('ControlValueChanged', this._setValue);
            this.context.un('ControlDisableChanged', this._setDisable);
            this.context.un('ControlReadonlyChanged', this._setReadonly);
            this.context.un('ControlRefresh', this._setRefresh);
            this.context.un('ConfigChanged', this._configChaned);
        }
    }
    _configChaned(_) {
        // implemented by child components
        this._cdr.detectChanges();
    }
    _setValue(value) {
        this.value = value;
        this._valueChangedSource.next(value);
        this._cdr.detectChanges();
    }
    _setRefresh(value) {
        this._refreshSource.next(value);
        this._cdr.detectChanges();
    }
    _setDisable(value, changeDetect = true) {
        this._disableChangedSource.next(value);
        if (changeDetect) {
            this._cdr.detectChanges();
        }
    }
    _setReadonly(value, changeDetect = true) {
        this._readonlyChangedSource.next(value);
        if (changeDetect) {
            this._cdr.detectChanges();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FieldBaseComponent, isStandalone: false, selector: "bnrc-field-base", inputs: { context: "context", focusControl: "focusControl", layoutInfo: "layoutInfo", value: "value", width: "width", height: "height", formHeight: "formHeight", inlineEdit: "inlineEdit", cellEdit: "cellEdit", formContainer: "formContainer", id: "id", parametes: "parametes", settings: "settings" }, outputs: { valueChange: "valueChange", formmatedValue: "formmatedValue" }, host: { properties: { "class.isMobile": "this.isMobile", "class.isTablet": "this.isTablet", "class.rtl": "this._rlt" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-field-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { context: [{
                type: Input
            }], focusControl: [{
                type: Input
            }], layoutInfo: [{
                type: Input
            }], value: [{
                type: Input
            }], width: [{
                type: Input
            }], height: [{
                type: Input
            }], formHeight: [{
                type: Input
            }], inlineEdit: [{
                type: Input
            }], cellEdit: [{
                type: Input
            }], formContainer: [{
                type: Input
            }], id: [{
                type: Input
            }], parametes: [{
                type: Input
            }], settings: [{
                type: Input
            }], valueChange: [{
                type: Output
            }], formmatedValue: [{
                type: Output
            }], isMobile: [{
                type: HostBinding,
                args: ['class.isMobile']
            }], isTablet: [{
                type: HostBinding,
                args: ['class.isTablet']
            }], _rlt: [{
                type: HostBinding,
                args: ['class.rtl']
            }] } });

class FieldViewBase extends FieldBaseComponent {
    constructor() {
        super(...arguments);
        this.errorMessage = signal('');
        this.errorCode = signal(-1);
        this.injector = inject(Injector);
    }
    /**
     *
     */
    ngOnInit() {
        if (!this.parameters) {
            this.parameters = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.CustomUi.Parameters');
            if (!this.parameters) {
                this.parameters = this.settings;
            }
        }
        this.controller.init(this.parameters);
    }
    showError(message, code) {
        this.errorMessage.set(message);
        this.errorCode.set(code);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldViewBase, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FieldViewBase, isStandalone: false, selector: "bnrc-ext-field-base", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldViewBase, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-ext-field-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }] });

class FormBaseComponent extends BaseComponent {
    constructor() {
        super();
        this.id = `form_${getUniqueId(4)}`;
        this.fullscreen = false;
        this._typeDefName = '';
        this._viewName = '';
        this.formClose = new EventEmitter();
        this._breadcrumbService = inject(BreadcrumbService);
        this._portalService = inject(PortalService);
        this._router = inject(Router);
        this._el = inject(ElementRef);
        this._controlUiPipe = inject(ControlUiPipe);
        this._formPanelService = inject(FormPanelService, { self: true });
        this._activatedRoute = inject(ActivatedRoute);
        this._cdr = inject(ChangeDetectorRef);
        this._selectedTabPageName$ = new BehaviorSubject('');
        this.selectedTabPageName$ = this._selectedTabPageName$.asObservable();
        this._formPanelService.isSearchPanel$.subscribe((isSearchPanel) => {
            this.isSearchPanel = isSearchPanel;
        });
        this.breadCrumbs$ = this._breadcrumbService.breadcrumbs$;
        this.infobars$ = this._formPanelService.infobars$;
        this.canSend$ = this._formPanelService.canSend$;
        this.hideBreadCrumb$ = this._formPanelService.hideBreadCrumb$;
        this.hideClose$ = this._formPanelService.hideClose$;
        this.hideTitle$ = this._formPanelService.hideTitle$;
        this.hidePin$ = this._formPanelService.hidePin$;
        this.toolbarVisible$ = this._formPanelService.toolbarVisible$;
        this.title$ = this._formPanelService.title$.pipe(map((title) => (!title ? '' : getDeviceIsMobile() ? title.split(':')[0] : title)));
        this.toolbarItems$ = this._formPanelService.toolbarItems$;
        this.workflowButtons$ = this._formPanelService.workflowButtons$;
        this.headerLayout$ = this._formPanelService.headerLayout$;
        this.layout94$ = this._formPanelService.layout$;
        this.maxContentWidth$ = this._formPanelService.maxContentWidth$;
        this.formWidth$ = this._formPanelService.formWidth$;
        this.headerSubtitle$ = this._formPanelService.headerSubtitle$;
        this.avatar$ = this._formPanelService.avatar$;
        this.circleAvatar$ = this._formPanelService.circleAvatar$;
        this.workflowPanelUi$ = this._formPanelService.workflowPanelUi$;
        this.view$ = this._formPanelService.view$;
        this.mo$ = this._formPanelService.mo$;
        this.fieldDict$ = this._formPanelService.fieldDict$;
        this.isSimple$ = this._formPanelService.isSimpleForm$;
        this.mask$ = this._formPanelService.mask$;
        this.headerDescription$ = this._formPanelService.headerDescription$;
        this.headerRemoveContentPadding$ = this._formPanelService.headerRemoveContentPadding$;
        this.standalone$ = this._portalService.standalone$;
        this.landscape$ = this._portalService.landscape$;
        this.deviceSize$ = this._portalService.deviceSize$;
        this.dirValue$ = this._portalService.dirValue$;
        this.rtl$ = this._portalService.rtl$;
        this._formPanelService.context$.pipe(takeUntil(this._onDestroy$)).subscribe();
        this._formPanelService.view$.pipe(takeUntil(this._onDestroy$)).subscribe();
        this._portalService.standalone$.pipe(takeUntil(this._onDestroy$)).subscribe((c) => (this._standalone = c));
        this._formPanelService.mo$.subscribe((c) => (this._typeDefName = c?.$TypeDefName ?? ''));
        this._formPanelService.view$.subscribe((c) => (this._viewName = c?.TypeViewName ?? ''));
    }
    get forceClose$() {
        return this._formPanelService.forceClose$;
    }
    ngOnInit() {
        super.ngOnInit();
        this._formPanelService.context = this.context;
        this.isMobile = getDeviceIsMobile();
        this.listFieldUi = this.context._dictFieldUi;
        this.isModal = this.context.Setting?.IsModal;
        this.isSubForm = this.context.IsSubForm;
        this.isFormReport = this.context.IsFormReport;
        this._setParamters();
        this.modernTabs$ = this.layout94$.pipe(filter((c) => c), map((layout94) => (this.layout94 = layout94)), merge$1(this._formPanelService.groupLayout$), map((_) => {
            if (this.layout94.items[0].xtype !== 'Ly.LayoutTabPanel') {
                return [];
            }
            const x = this.layout94.items[0];
            this.modernTabContainerComponent = x.CustomUi;
            this._selectedTabPageName$.next(x.SelectedTabPageName);
            const tabs = x.items;
            return tabs.filter((c) => c.Visible !== false);
        }));
        setTimeout(() => {
            this.obtainHeight();
        }, 0);
        this._portalService.windowResize$.subscribe((_) => {
            this.obtainHeight();
        });
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        if (this._formIntersection) {
            this._formIntersection.unsubscribe();
        }
        this._formPanelService.destroy();
    }
    onDismissInfobar(id) {
        this._formPanelService.hideInfoBar(id);
    }
    onClose() {
        this.context.fireEvent('RequestForClose', this.context);
    }
    onFullscreen() {
        this.fullscreen = !this.fullscreen;
    }
    onToolbarClick(btn) {
        this._formPanelService.toolbarClick$.next(btn);
    }
    onWorkflowChoiceClick(wfChoice) {
        this._formPanelService.wfChoice(wfChoice);
    }
    fieldChange(fieldName, value) {
        const fieldUi = this.context._listFieldUi.find((c) => c.Setting.ControlName === fieldName);
        fieldUi.value = value;
        fieldUi.fireEvent('change', fieldUi);
    }
    searchClick() {
        const fieldUi = this.context._listFieldUi.find((c) => c.originalXtype === 'Ui.SearchCommandInfoUi');
        fieldUi.fireEvent(BarsaApi.Ul.FormPanelCtrlr.EventEnum.SearchClick, fieldUi);
    }
    obtainHeight() {
        const parentHeight = getParentHeight(this._el.nativeElement);
        this._formPanelService.setFormHeight(parentHeight);
    }
    _setParamters() {
        this.parameters = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.View.CustomUi.Parameters', null);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FormBaseComponent, isStandalone: false, selector: "bnrc-form-base", inputs: { context: "context" }, outputs: { formClose: "formClose" }, host: { properties: { "attr.id": "this.id", "class.fullscreen": "this.fullscreen", "attr.typeDefName": "this._typeDefName", "attr.viewName": "this._viewName" } }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-form-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { id: [{
                type: HostBinding,
                args: ['attr.id']
            }], fullscreen: [{
                type: HostBinding,
                args: ['class.fullscreen']
            }], _typeDefName: [{
                type: HostBinding,
                args: ['attr.typeDefName']
            }], _viewName: [{
                type: HostBinding,
                args: ['attr.viewName']
            }], context: [{
                type: Input
            }], formClose: [{
                type: Output
            }] } });

class FormToolbarBaseComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.visible = true;
        this.width = null;
        this.toolClick = new EventEmitter();
        this._cdr = inject(ChangeDetectorRef);
    }
    ngOnInit() {
        super.ngOnInit();
        this._rtl = this.rtl;
    }
    onToolClick(btn) {
        this.toolClick.emit(btn);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormToolbarBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FormToolbarBaseComponent, isStandalone: false, selector: "bnrc-form-toolbar-base", inputs: { buttons: "buttons", visible: "visible", size: "size", device: "device", deviceSize: "deviceSize", rtl: "rtl", landscape: "landscape", standalone: "standalone", shouldOverflow: "shouldOverflow", toolbarVisible: "toolbarVisible", isFirefox: "isFirefox", dirValue: "dirValue", width: "width" }, outputs: { toolClick: "toolClick" }, host: { properties: { "attr.rtl": "this._rtl" } }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormToolbarBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-form-toolbar-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { buttons: [{
                type: Input
            }], visible: [{
                type: Input
            }], size: [{
                type: Input
            }], device: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], rtl: [{
                type: Input
            }], landscape: [{
                type: Input
            }], standalone: [{
                type: Input
            }], shouldOverflow: [{
                type: Input
            }], toolbarVisible: [{
                type: Input
            }], isFirefox: [{
                type: Input
            }], dirValue: [{
                type: Input
            }], width: [{
                type: Input
            }], toolClick: [{
                type: Output
            }], _rtl: [{
                type: HostBinding,
                args: ['attr.rtl']
            }] } });

class SystemBaseComponent extends BaseComponent {
    constructor() {
        super();
        this.showFormPanel = () => { };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SystemBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: SystemBaseComponent, isStandalone: false, selector: "bnrc-system-base", inputs: { context: "context", showFormPanel: "showFormPanel" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SystemBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-system-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { context: [{
                type: Input
            }], showFormPanel: [{
                type: Input
            }] } });

class ReportBaseComponent extends BaseComponent {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        super();
        this.pageChange = new EventEmitter();
        this.pageSizeChange = new EventEmitter();
        this.defaultGridSetting = {
            ColSettingList: [],
            AutoSizeColumns: false,
            SortSettingList: [],
            Hidden: true
        };
        this.sortSettings = null;
        this._portalService = inject(PortalService);
        this._ulvMainService = inject(UlvMainService);
        this._visibleColumnsSource = new BehaviorSubject([]);
        this.searchTermSource = new BehaviorSubject('');
        this.groupbySource = new BehaviorSubject([]);
        this._allCheckedSource = new BehaviorSubject(false);
        this.visibleColumns$ = this._visibleColumnsSource.asObservable();
        this.searchTerm$ = this.searchTermSource.asObservable();
        this.gridSetting$ = this._ulvMainService.gridSetting$;
        this.contentHeight$ = this._ulvMainService.contentHeight$;
        this.groupby$ = this.groupbySource.asObservable();
        this.allChecked$ = this._allCheckedSource.asObservable();
        this.fields = {};
        this.toolbarButtons$ = this._ulvMainService.toolbarButtons$;
        this.ulvHeightSizeType$ = this._ulvMainService.ulvHeightSizeType$;
    }
    get moDataList() {
        return this._ulvMainService.moDataListSource.getValue();
    }
    ngOnInit() {
        super.ngOnInit();
        this.rendered = true;
        this.context.rendered = true;
        this.inDialog$ = this._ulvMainService.inDialog$;
        this.cssBackground$ = this._ulvMainService.cssBackground$;
        this.isMultiSelect$ = this._ulvMainService.isMultiSelect$;
        this.fullscreen$ = this._ulvMainService.fullscreen$;
        this.hideSearchpanel$ = this._ulvMainService.hideSearchpanel$;
        this.deviceSize$ = this._portalService.deviceSize$;
        this.hideToolbar$ = this._ulvMainService.hideToolbar$;
        this.newInlineEditMo$ = this._ulvMainService.newInlineEditMo$;
        this.conditionalFormats$ = this._ulvMainService.conditionalFormats$;
        this.cartableTemplates$ = this._ulvMainService.cartableTemplates$;
        this.cartableChildsMo$ = this._ulvMainService.cartableChildsMo$;
        this.title$ = this._ulvMainService.title$.pipe(pluck('text'));
        this.menuItems$ = this._ulvMainService.menuItems$;
        this.pagingSetting$ = this._ulvMainService.pagingSetting$;
        this.toolbarEnable$ = this._ulvMainService.enable$;
        this.gridFreeColumnSizing$ = this._ulvMainService.gridFreeColumnSizing$;
        this.mask$ = this._ulvMainService.viwerMask$.pipe(debounceTime(200));
        this.selectedMo$ = this._ulvMainService.moDataList$.pipe(map((items) => items.find((c) => c.$IsChecked)));
        this.moDataList$ = this._ulvMainService.moDataList$.pipe(tap((items) => this._setAllChecked(items)));
        this.selectedCount$ = this._ulvMainService.selectedCount$;
        this._ulvMainService.setAllowGridColumnSort(this.context.ViewSetting?.AllowGridColumnSort);
        this._ulvMainService.setViewSettings(this.context.ViewSetting);
        this._ulvMainService.setAccess(this.context.Setting.Extra?.DefaultCommandsAccess);
        this._ulvMainService.gridSettingChangedByUser$.pipe(takeUntil(this._onDestroy$)).subscribe((c) => {
            const { setting, isSort, raiseEvent } = c;
            this.updateGridSetting(setting, isSort, raiseEvent);
        });
        this.context.on({
            scope: this,
            MoDataListChanged: this._moDataListChanged,
            GridSettingChanged: this._gridSettingChanged,
            PrepareMoForNewForm: this._prepareMoForNewForm
        });
        // in gheire faal bood chon moshkel eijad mikard
        // va dar ulv event baiad raise shavad
        // ke data amade shode va ulvmainservice an ra begirad.gozaresh mortabet
        this._ulvMainService.reSetMoDataList(this.context.moDataList);
        let gridSetting = this.defaultGridSetting;
        if (this.context.GetGridSetting) {
            gridSetting = this.context.GetGridSetting() || this.defaultGridSetting;
        }
        this._setVisibleColumns();
        gridSetting.SortSettingList ||= [];
        this.allColumns = this.context.allColumns || [];
        this.updateGridSetting(gridSetting, false, false);
        this.parameters = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.ClassNames.CustomUi.Parameters', null);
        this.id = getUniqueId(4);
        this.itemSelector = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.ClassNames.CustomUiRow.Selector');
        this.parameters = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.ClassNames.CustomUi.Parameters');
        const fieldSettings = BarsaApi.Common.Util.TryGetValue(this.parameters, 'FieldSettings.MoDataList', []);
        fieldSettings.forEach((c) => {
            this.fields[c.ComponentParameter.$Caption] = c.$Caption;
        });
        this._ulvMainService.context.RefreshAllCmdUi();
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        this.deviceSize$
            .pipe(takeUntil(this._onDestroy$), tap((deviceSize) => this._deviceSizeChanged(deviceSize)))
            .subscribe();
        merge(this._portalService.windowResize$, timer(1000))
            .pipe(takeUntil(this._onDestroy$))
            .subscribe(() => this._windowResized());
        this.context?.fireEvent('afterrender', this);
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this.context.un('MoDataListChanged', this._moDataListChanged);
        this.context.un('GridSettingChanged', this._gridSettingChanged);
    }
    onResetGridSettings() {
        const allColumns = this.allColumns.map((c) => ({
            ...c,
            Hidden: false,
            Width: 0,
            $Width: undefined,
            $Width2: undefined
        }));
        const gridSettings = getResetGridSettings(allColumns, this.context);
        this.updateGridSetting(gridSettings, false, true);
    }
    _columnSummary(e) {
        this.context.fireEvent('columnSummary', this.context, e.moArr, e.column, e.groupLevel, e.groupName, e.summaryFn);
    }
    _gridSettingChanged(setting) {
        this._ulvMainService.setGridSetting(setting);
    }
    _prepareMoForNewForm(_context, mo) {
        mo && this._ulvMainService.prepareMoForNewForm(mo);
    }
    _moDataListChanged(moDataList) {
        this._ulvMainService.reSetMoDataList(moDataList);
    }
    _setAllChecked(items) {
        this._allCheckedSource.next(items.length > 0 && !items.some((c) => !c.$IsChecked));
    }
    _handleColumnsResized(e) {
        const gridSetting = this._ulvMainService.gridSetting;
        const { columns, resized } = e;
        const colList = gridSetting.ColSettingList;
        resized.forEach((column1) => {
            const resizedColumn = columns.find((c) => c.Name === column1.name);
            if (!colList) {
                return;
            }
            const column = colList.find((c) => c.Name === resizedColumn?.Name);
            if (column) {
                column.Width = column1.width;
            }
            else if (resizedColumn) {
                colList.push({ IsHidden: resizedColumn.Hidden, Name: resizedColumn.Name, Width: column1.width });
            }
        });
        this._raiseEventUserSettingChanged(gridSetting);
    }
    _setVisibleColumns() {
        const columns = GetAllColumnsSorted(this.context);
        this._visibleColumnsSource.next(columns.filter((c) => !c.Hidden));
    }
    applyGroupby() {
        const sortList = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.View.GridSetting.SortSettingList', []);
        this.groupbySource.next(sortList.filter((c) => c.IsGrouped));
    }
    _raiseRowClick(index, mo) {
        this.context?.fireEvent('rowdblclick', this.context, index, mo);
    }
    _deviceSizeChanged(_) { }
    _windowResized() { }
    _openMo(mo, i) {
        this._raiseRowClick(i, mo);
    }
    updateGridSetting(setting, isSort = false, raiseEvent = true) {
        if (!setting) {
            return;
        }
        this.context.Setting.View.GridSetting = setting;
        this._ulvMainService.setGridSetting(setting);
        this.applyGroupby();
        if (isSort) {
            setting.Event = 'SortChange';
        }
        else {
            setting.Event = '';
        }
        this._setVisibleColumns();
        this._deviceSizeChanged(this._portalService.deviceSize);
        if (raiseEvent) {
            this._raiseEventUserSettingChanged(setting);
        }
    }
    updateSortSettings(sortSettings, raiseEvent = true) {
        const gridSettings = this.context.Setting.View.GridSetting;
        gridSettings.SortSettingList = sortSettings;
        this._ulvMainService.setGridSetting(gridSettings);
        this.applyGroupby();
        gridSettings.Event = 'SortChange';
        if (raiseEvent) {
            this._raiseEventUserSettingChanged(gridSettings);
        }
    }
    _raiseEventUserSettingChanged(gridSetting) {
        this.context.fireEvent('UserSettingChange', this.context, gridSetting);
    }
    _ulvCommandClicked(mo, index) {
        this._removeCheckedAll();
        this._select(mo, index);
    }
    _checkedAll() {
        const moDataList = this.moDataList;
        moDataList.forEach((mo) => (mo.$IsChecked = true));
        this._ulvMainService.reSetMoDataList();
        this.context.fireEvent('rowSelectAll', this.context);
    }
    _removeCheckedAll() {
        this._deselctAll();
        // this.context.fireEvent('rowDeselectAll', this.context);
    }
    _deselctAll() {
        const moDataList = this.moDataList;
        moDataList.forEach((mo) => (mo.$IsChecked = false));
        this._ulvMainService.reSetMoDataList();
        this.context.fireEvent('rowDeselectAll', this.context);
    }
    _deselect(mo, index) {
        mo.$IsChecked = false;
        this._ulvMainService.reSetMoDataList();
        this.context.fireEvent('rowdeselect', this.context, index, mo);
        return mo;
    }
    _select(mo, index) {
        //    this._deselctAll();
        mo.$IsChecked = true;
        this._ulvMainService.reSetMoDataList();
        this.context.fireEvent('rowselect', this.context, index, mo);
        return mo;
    }
    _doCheckedAll(checked) {
        if (checked) {
            this._checkedAll();
        }
        else {
            this._removeCheckedAll();
        }
    }
    _getSelected() {
        const selectedMo = this.moDataList.find((mo) => mo.$IsChecked);
        if (!selectedMo) {
            return null;
        }
        selectedMo.json = selectedMo;
        return selectedMo;
    }
    refreshContextMoDataList(moDataList) {
        this.context.fireEvent('RefreshContextMoDataList', moDataList);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ReportBaseComponent, isStandalone: false, selector: "bnrc-report-base", inputs: { context: "context", currentPage: "currentPage" }, outputs: { pageChange: "pageChange", pageSizeChange: "pageSizeChange" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-report-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { context: [{
                type: Input
            }], currentPage: [{
                type: Input
            }], pageChange: [{
                type: Output
            }], pageSizeChange: [{
                type: Output
            }] } });

class ReportItemBaseComponent extends BaseComponent {
    constructor() {
        super();
        this.itemClick = new EventEmitter();
        this.index = -1;
        this.fields = {};
    }
    onClick() {
        this.itemClick.emit({ index: this.index, mo: this.mo });
    }
    ngOnInit() {
        super.ngOnInit();
        this.classNames2 = this.classNames;
        this.parameters = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.ClassNames.CustomUiRow.Parameters');
        const fieldSettings = BarsaApi.Common.Util.TryGetValue(this.parameters, 'FieldSettings.MoDataList', []);
        fieldSettings.forEach((c) => {
            this.fields[c.ComponentParameter.$Caption] = c.$Caption;
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportItemBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ReportItemBaseComponent, isStandalone: false, selector: "bnrc-report-item-base", inputs: { classNames: "classNames", context: "context", mo: "mo", allColumns: "allColumns", index: "index" }, outputs: { itemClick: "itemClick" }, host: { listeners: { "click": "onClick($event.target)" }, properties: { "class": "this.classNames2" } }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportItemBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-report-item-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { itemClick: [{
                type: Output
            }], classNames2: [{
                type: HostBinding,
                args: ['class']
            }], classNames: [{
                type: Input
            }], context: [{
                type: Input
            }], mo: [{
                type: Input
            }], allColumns: [{
                type: Input
            }], index: [{
                type: Input
            }], onClick: [{
                type: HostListener,
                args: ['click', ['$event.target']]
            }] } });

class ApplicationBaseComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.systemList = [];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ApplicationBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ApplicationBaseComponent, isStandalone: false, selector: "bnrc-application-base", inputs: { context: "context", selectedSystemId: "selectedSystemId" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ApplicationBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-application-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { context: [{
                type: Input
            }], selectedSystemId: [{
                type: Input
            }] } });

class LayoutItemBaseComponent extends BaseComponent {
    constructor() {
        super();
        this.formPanelService = inject(FormPanelService);
        this._cdr = inject(ChangeDetectorRef);
        this.formPanelService.isSearchPanel$.subscribe((isSearchPanel) => {
            this.isSearchPanel = isSearchPanel;
        });
        this.formPanelService.isSearcPanelInSideContent$.subscribe((isSearcPanelInSideContent) => {
            this.isSearcPanelInSideContent = isSearcPanelInSideContent;
        });
        this.formPanelService.searchPanelIsObject$.subscribe((searchPanelIsObject) => {
            this.searchPanelIsObject = searchPanelIsObject;
        });
    }
    ngOnInit() {
        super.ngOnInit();
        this.id = this.config.id;
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { maxLabelWidth } = changes;
        if (maxLabelWidth && !maxLabelWidth.firstChange) {
            this.maxLabelWidth = maxLabelWidth.currentValue;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutItemBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: LayoutItemBaseComponent, isStandalone: false, selector: "bnrc-layout-item-base", inputs: { config: "config", isPanel: "isPanel", maxLabelWidth: "maxLabelWidth", rtl: "rtl" }, host: { properties: { "attr.id": "this.id" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutItemBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-layout-item-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { id: [{
                type: HostBinding,
                args: ['attr.id']
            }], config: [{
                type: Input
            }], isPanel: [{
                type: Input
            }], maxLabelWidth: [{
                type: Input
            }], rtl: [{
                type: Input
            }] } });

class LayoutPanelBaseComponent extends LayoutItemBaseComponent {
    constructor() {
        super();
        this.layoutControlCount = 0;
        this.visible = true;
        this._renderer2 = inject(Renderer2);
        this._portalService = inject(PortalService);
        this._layoutService = inject(LayoutService, { self: true });
        const layoutService = this._layoutService;
        this.id = getUniqueId(4);
        layoutService.id = 'panel' + this.id;
        this.formPanelService.isSearchPanel$.subscribe((isSearchPanel) => {
            this.isSearchPanel = isSearchPanel;
        });
        this.formPanelService.groupLayout$
            .pipe(takeUntil$1(this._onDestroy$), filter$1((c) => c.ControlId === this.config.ControlId))
            .subscribe((_groupItem) => {
            this._setBRule();
        });
    }
    ngOnInit() {
        super.ngOnInit();
        this._setBRule();
        this.formPanelService.formContainerDom = this.parentDom;
        this.maxLabelWidth$ = this._layoutService.maxWidth$;
        this._calcWidth(this.config);
    }
    _setBRule() {
        this.visible = this.config.Visible === false ? false : true;
        this.readonly = this.config.Readonly === false ? false : true;
        this.enable = this.config.Enable === false ? false : true;
        if (this.enable) {
            this._renderer2.removeClass(this._el.nativeElement, 'control-disabled');
        }
        else {
            this._renderer2.addClass(this._el.nativeElement, 'control-disabled');
        }
    }
    _calcWidth(config) {
        config.items.forEach((item) => {
            switch (item.xtype) {
                case 'Ly.LayoutJoin':
                    this._calcWidth(item);
                    break;
                case 'Ly.LayoutControl':
                    this.layoutControlCount++;
                    this._setLabelWidth(item);
                    break;
            }
        });
    }
    _setLabelWidth(item) {
        const controlWidth = getLabelWidth(item);
        if (controlWidth) {
            this._layoutService.setMaxWidth(controlWidth);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutPanelBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: LayoutPanelBaseComponent, isStandalone: false, selector: "bnrc-layout-panel-base", inputs: { parentDom: "parentDom", isPanel: "isPanel", config: "config" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutPanelBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-layout-panel-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { parentDom: [{
                type: Input
            }], isPanel: [{
                type: Input
            }], config: [{
                type: Input
            }] } });

class ContainerComponent extends BaseComponent {
    constructor() {
        super();
        this.isMobile = getDeviceIsMobile();
        this.id = getUniqueId(6);
        this._activatedRoute = inject(ActivatedRoute);
        this._portalService = inject(PortalService);
        this._vcr = inject(ViewContainerRef);
        this._barsaDialogService = inject(BarsaDialogService);
        this._injector = inject(Injector);
        this._router = inject(Router);
        this._cdr = inject(ChangeDetectorRef);
        this._renderer2 = inject(Renderer2);
        this._dialogService = inject(DIALOG_SERVICE, { optional: true });
        this._parentContainerService = inject(ContainerService, { self: false, optional: true });
        this._containerService = inject(ContainerService, { self: true, optional: true });
        this._formDialogComponent = inject(FORM_DIALOG_COMPONENT, { optional: true });
        this.oldContainerContainer = this._barsaDialogService.containerComponent;
        this._barsaDialogService.containerComponent = this;
        this._portalService.deviceSize$.pipe(takeUntil$1(this._onDestroy$)).subscribe((c) => (this.deviceSize = c));
    }
    get injector() {
        return this._injector;
    }
    get cdr() {
        return this._cdr;
    }
    get vcr() {
        return this.containerRef;
    }
    ngOnInit() {
        super.ngOnInit();
        this._containerService?.setViewContainerRef(this.containerRef);
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this._barsaDialogService.containerComponent = this.oldContainerContainer;
    }
    detach() {
        this._viewRef = this.containerRef.detach();
        this._cdr.detectChanges();
    }
    reAttach() {
        if (this._viewRef) {
            this.containerRef.insert(this._viewRef);
            this._cdr.detectChanges();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ContainerComponent, isStandalone: false, selector: "bnrc-container", viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["containerRef"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "containerBottomRef", first: true, predicate: ["containerBottomRef"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ContainerComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-container',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { containerRef: [{
                type: ViewChild,
                args: ['containerRef', { static: true, read: ViewContainerRef }]
            }], containerBottomRef: [{
                type: ViewChild,
                args: ['containerBottomRef', { static: true, read: ViewContainerRef }]
            }] } });

class PageBaseComponent extends ContainerComponent {
    constructor() {
        super(...arguments);
        this.hasRoute = true;
        this.fullscreen = true;
        this.componentsAddedToPage = false;
        this._parentRoutingService = inject(RoutingService, { skipSelf: true, optional: true });
        this._routingService = inject(RoutingService, { self: true, optional: true });
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        this._containerService?.state === 'attach' && this.addModulesToDom();
        this._containerService?.addModules.pipe(takeUntil(this._onDestroy$)).subscribe(() => this.addModulesToDom());
    }
    addModulesToDom() {
        this.getData$()
            .pipe(filter((c) => c != null))
            .subscribe((pageData) => {
            this.renderPlaceHolders(pageData);
        });
    }
    getData$() {
        if (this.isRoot) {
            return this._portalService.portalData$;
        }
        return this._activatedRoute.data.pipe(map((data) => data.pageData), takeUntil(this._onDestroy$));
    }
    renderPlaceHolders(pageData) {
        this.pageData = pageData;
        const modules = this.getModules(pageData);
        this.addModulesToPage(modules);
    }
    preparePlaceholder(placeHolderElement, placeHolderName, pageData) {
        // remove old attached component . when we use rxjs for update data
        const hasChild = placeHolderElement.hasChildNodes();
        if (hasChild) {
            placeHolderElement.removeChild(placeHolderElement.childNodes[0]);
        }
        const placeHolders = this.getPlaceHolders(pageData);
        const placeHolder = placeHolders.find((c) => c.Name === placeHolderName);
        if (placeHolder != null) {
            const modules = this.getModules(pageData);
            const module = modules.find((c) => c.PlaceHolder.Id === placeHolder.Id);
            if (module) {
                const controlUi = this.getModuleControlUi(module.Component);
                placeHolderElement.appendChild(controlUi);
            }
        }
        else {
            console.error('placeholder not found ' + placeHolderName);
        }
    }
    getModuleControlUi(component) {
        const controlUi = document.createElement(component.Selector);
        controlUi.settings = component.Settings;
        controlUi.activatedRoute = this._activatedRoute;
        return controlUi;
    }
    addModulesToPage(modules) {
        if (this.componentsAddedToPage) {
            return;
        }
        modules = modules.sort((a, b) => (Number(a.OrderNumber) > Number(b.OrderNumber) ? 1 : -1));
        from(modules)
            .pipe(takeUntil(this._onDestroy$), concatMap((module) => this.getComponentFactory(module.Component).pipe(tap((controlUi) => {
            controlUi.instance.settings = module.Component.Settings;
            controlUi.instance.activatedRoute = this._activatedRoute;
            let containerRef = this.containerRef;
            if (module.PlaceholderName && this[module.PlaceholderName]) {
                containerRef = this[module.PlaceholderName];
            } // توسط ماژول مشخص شده کامپوننت در کدام کانتینر پیج قرار گیرد
            if (containerRef) {
                containerRef.insert(controlUi.hostView);
            }
            else {
                this._vcr.insert(controlUi.hostView);
            }
        }))))
            .subscribe(() => {
            this.componentsAddedToPage = true;
            this._cdr.detectChanges();
        });
    }
    getComponentFactory(uiComponent) {
        return this._portalService.getComponent(uiComponent.Module, uiComponent.ModuleFileName, uiComponent.Name, uiComponent.Selector, this._injector);
    }
    getPlaceHolders(pageData) {
        const placeholders = BarsaApi.Common.Util.TryGetValue(pageData, 'Component.Settings.PlaceHolders.MoDataList', []);
        return placeholders;
    }
    getModules(pageData) {
        const x = BarsaApi.Common.Util.TryGetValue(pageData, 'ModuleList.MoDataList', []);
        const x2 = BarsaApi.Common.Util.TryGetValue(pageData, 'ModuleList2.MoDataList', []);
        return x2.length ? x2 : x;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PageBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: PageBaseComponent, isStandalone: false, selector: "bnrc-page-base", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PageBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-page-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }] });

class NumberBaseComponent extends FieldBaseComponent {
    get decimalPrecision() {
        const decimalPrecision = Number(this.Setting.DecimalPrecision);
        if (isNaN(decimalPrecision)) {
            return 0;
        }
        return decimalPrecision;
    }
    ngOnInit() {
        super.ngOnInit();
        this._updateBySetting();
    }
    ngOnDestroy() {
        this._clearInterval();
        super.ngOnDestroy();
    }
    onKeyDown(e) {
        const isCharacter = this._isCharacter(e);
        if (!isCharacter) {
            return;
        }
        const isValid = new RegExp('^[0-9,.,-]*$').test(e.currentTarget.value + e.key);
        if (!isValid || e.key === '.') {
            if (e.key === '.' && this.inputElement && this.decimalPrecision > 0) {
                const indexOfDot = this.inputElement.value.indexOf('.');
                if (indexOfDot > -1) {
                    this._setCursorPosition(indexOfDot + 1);
                    e.preventDefault();
                    e.stopPropagation();
                    return;
                }
            }
            else {
                e.preventDefault();
                e.stopPropagation();
                return;
            }
        }
        else if (isValid && this.inputElement) {
            // در صورتی که عدد قبل از منفی قرار گیرد
            const cursorPosition = this.inputElement.value.indexOf('-');
            if (cursorPosition > -1 && this.inputElement.selectionStart === 0 && this.inputElement.selectionEnd === 0) {
                e.preventDefault();
                e.stopPropagation();
            }
        }
        if (e.key === '-' && this.inputElement) {
            const cursorPosition = this.inputElement.value.indexOf('-');
            if (cursorPosition < 0 && this.inputElement.selectionStart === 0) {
                return;
            }
            this._setCursorPosition(cursorPosition + 1);
            e.preventDefault();
            e.stopPropagation();
        }
    }
    onValueChange(e) {
        const text = e.currentTarget?.value || '';
        this.reFormatValue(text, e);
    }
    _updateBySetting() {
        if (this.inputElement) {
            const formated = this._getFormated(this.value?.toString()).toString();
            this.inputElement.value = formated;
        }
        this.hasMask =
            BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.ShowThousandSeperator', false) ||
                BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.DecimalPrecision', 0) > 0;
    }
    _configChaned(_) {
        // implemented by child components
        this._updateBySetting();
        this._cdr.detectChanges();
    }
    _setValue(value) {
        super._setValue(value);
        this.reFormatValue(this.value, { target: this.inputElement });
    }
    _clearInterval() {
        if (this.tickRef) {
            clearInterval(this.tickRef);
            this.tickRef = null;
        }
    }
    _isCharacter(evt) {
        if (typeof evt.which === 'undefined') {
            return true;
        }
        else if (typeof evt.which === 'number' && evt.which > 0) {
            return !evt.ctrlKey && !evt.metaKey && !evt.altKey && evt.which !== 8 && evt.key.length === 1;
        }
        return false;
    }
    _getFormated(val) {
        if (typeof val === 'undefined') {
            return '';
        }
        let decimalPersicion = 0;
        const indexOfDot = val.indexOf('.');
        if (indexOfDot > 0 && this.decimalPrecision) {
            decimalPersicion = val.length - indexOfDot - 1;
            decimalPersicion = decimalPersicion > this.decimalPrecision ? this.decimalPrecision : decimalPersicion;
        }
        let newVal = this._numeralPipe.transform(val, decimalPersicion, this.Setting.ShowThousandSeperator).toString();
        if (this.decimalPrecision && decimalPersicion === 0 && val.endsWith('.') && !newVal.endsWith('.')) {
            newVal += '.';
        }
        return newVal;
    }
    _setCursorPosition(cursorPosition) {
        if (this.inputElement) {
            if (cursorPosition > this.inputElement.value.length && this.decimalPrecision) {
                cursorPosition = this.inputElement.value.length;
            }
            this.inputElement.setSelectionRange(cursorPosition, cursorPosition);
        }
    }
    _getMinusValue(isMinus, newVal) {
        let val2 = typeof newVal == 'undefined' ? '' : newVal;
        val2 = isMinus ? `-${val2}` : val2;
        return val2;
    }
    _syncInputElementValue(value, e) {
        const elValue = this._numeralPipe.getValue(e.target.value);
        if (value === +elValue) {
            return;
        }
        const formated = this._getFormated(value.toString());
        e.target.value = formated;
    }
    _setTargetToFormatedValue(target, formated, isMinus) {
        if (!target) {
            return 0;
        }
        const oldVal = target.value;
        if (target.value !== formated) {
            target.value = this._getMinusValue(isMinus, formated);
        }
        return formated.length > oldVal.length ? formated.length - oldVal.length : oldVal.length - target.value.length;
    }
    reFormatValue(text, e) {
        let newVal;
        if (typeof text === 'number') {
            if (text === this.value) {
                this._syncInputElementValue(this.value, e);
                return;
            }
            text = text.toString();
        }
        if (typeof text === 'undefined' && typeof this.value === 'undefined') {
            return;
        }
        const isMinus = text?.startsWith('-');
        text = isMinus ? text?.substring(1, text.length) : text;
        if (text) {
            let indexofDot = text.indexOf('.');
            const selectionStart = this.inputElement?.selectionStart;
            const decimalPersicion = this.decimalPrecision;
            if (decimalPersicion && indexofDot > 0) {
                const t = text.length - (indexofDot + 1);
                if (t > decimalPersicion) {
                    const diff = t - decimalPersicion;
                    if (selectionStart && selectionStart < text.length) {
                        // text = text.substring(0, text.length - diff);
                        text =
                            text.substring(0, selectionStart) +
                                text.substring(selectionStart + 1, selectionStart + 1 + text.length - diff);
                    }
                    else {
                        text = text.substring(0, text.length - 1);
                    }
                }
            }
            let formated = this._getFormated(text).toString();
            newVal = this._numeralPipe.getValue(formated);
            if (decimalPersicion === 0) {
                indexofDot = text.length;
            }
            if (this.hasMask) {
                let cursorPosition = this.inputElement?.selectionStart;
                if (indexofDot < 0 && decimalPersicion > 0) {
                    formated = this._getFormated(text);
                    newVal = this._numeralPipe.getValue(formated);
                }
                if (this.inputElement && this.inputElement.value.length > formated.length) {
                    this.inputElement.value = this.inputElement.value.substring(0, formated.length);
                }
                const diff1 = this._setTargetToFormatedValue(this.inputElement, formated, isMinus);
                const diff2 = this._setTargetToFormatedValue(e.traget, formated, isMinus);
                cursorPosition && (cursorPosition += diff1);
                cursorPosition && (cursorPosition += diff2);
                this._setCursorPosition(cursorPosition);
            }
            else {
                if (this.inputElement) {
                    this.inputElement.value = this._getMinusValue(isMinus, newVal);
                }
            }
        }
        else if (this.inputElement) {
            this.inputElement.value = this._getMinusValue(isMinus, '');
        }
        if (newVal && +newVal === this.value) {
            return;
        }
        this.value = this._getMinusValue(isMinus, newVal);
        this.formmatedValue.emit(this.inputElement?.value);
        this.valueChange.emit(this.value);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NumberBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: NumberBaseComponent, isStandalone: false, selector: "bnrc-number-base", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NumberBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-number-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }] });

class FilesValidationHelper {
    get maxFileCount() {
        return this._maxFileCount;
    }
    set maxFileCount(val) {
        this._maxFileCount = val;
    }
    get maxFileSize() {
        return this._maxFileSize;
    }
    set maxFileSize(val) {
        this._maxFileSize = val * 1024;
    }
    get maxTotalFileSize() {
        return this._maxTotalFileSize;
    }
    set maxTotalFileSize(val) {
        this._maxTotalFileSize = val * 1024;
    }
    constructor(maxFileCount, maxFileSize, maxTotalFileSize) {
        this.maxFileCount = Number(maxFileCount);
        this.maxFileSize = Number(maxFileSize);
        this.maxTotalFileSize = Number(maxTotalFileSize);
    }
    validateFiles(filesCount, files) {
        return this._validateSize(filesCount, files);
    }
    _validateSize(filesCount, files) {
        const totalFileSize = files.reduce((accumulator, currFile) => accumulator + currFile.size, 0);
        const uplaodTotalSizeTooBigText = BarsaApi.BBB['Uplaod_TotalSizeTooBig'];
        const uplaodFileTooBigText = BarsaApi.BBB['Uplaod_FileTooBig'];
        const maxFilesExceeded = BarsaApi.BBB['Uplaod_MaxFilesExceeded'];
        let errorMsg = '';
        if (filesCount + files.length > this.maxFileCount + 1 && this.maxFileCount > 0) {
            errorMsg = `<span dir=ltr>${maxFilesExceeded} </span>` + `(${this.maxFileCount})`;
        }
        const fileReachSize = [];
        files.forEach((file) => {
            if (file.size > this.maxFileSize) {
                fileReachSize.push(file);
            }
        });
        if (files.length > 1 && this.maxTotalFileSize > 0 && totalFileSize > this.maxTotalFileSize) {
            errorMsg = uplaodTotalSizeTooBigText
                ?.replace('{{{filesize}}}', this._getMbSize(totalFileSize))
                .replace('{{maxFilesize}}', this._getMbSize(this.maxTotalFileSize));
        }
        else if (fileReachSize.length) {
            errorMsg += uplaodFileTooBigText
                ?.replace('{{{filesize}}}', this._getMbSize(fileReachSize[0].size))
                .replace('{{maxFilesize}}', this._getMbSize(this.maxFileSize));
            errorMsg +=
                `<br/>` +
                    fileReachSize
                        .map((c, index) => `<div class="file-validation" ><strong>${index + 1}-</strong><strong>${c.name}</strong></div>`)
                        .join('<br/>');
        }
        if (errorMsg) {
            BarsaApi.Ul.MsgBox.Error_ShowHtml(errorMsg, () => { });
            return false;
        }
        return true;
    }
    _getKbSize(size) {
        return formatBytes(size, 2, 'KB');
    }
    _getMbSize(size) {
        return formatBytes(size, 2, 'MB');
    }
}

class ReportViewBaseComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this._reportView = true;
        this._visibility = 'hidden';
        this.rowActivable = true;
        this.columnSummary = new EventEmitter();
        this.escapeKey = new EventEmitter();
        this.resetWorkflowState = new EventEmitter();
        this.deselectAll = new EventEmitter();
        this.editFormPanelCancel = new EventEmitter();
        this.editFormPanelSave = new EventEmitter();
        this.selectNextInlineRecord = new EventEmitter();
        this.editFormPanelValueChange = new EventEmitter();
        this.ulvCommandClick = new EventEmitter();
        this.sortAscending = new EventEmitter();
        this.workflowShareButtons = new EventEmitter();
        this.sortDescending = new EventEmitter();
        this.filter = new EventEmitter();
        this.executeToolbarButton = new EventEmitter();
        this.resetGridSettings = new EventEmitter();
        this.sortSettingsChange = new EventEmitter();
        this.rowCheck = new EventEmitter();
        this.rowClick = new EventEmitter();
        this.cartableFormClosed = new EventEmitter();
        this.createNewMo = new EventEmitter();
        this.updateMo = new EventEmitter();
        this.expandClick = new EventEmitter();
        this.trackBySelectedFn = new EventEmitter();
        this.allCheckbox = new EventEmitter();
        this.mandatory = new EventEmitter();
        this.columnResized = new EventEmitter();
        this.hasDetailsInRow = new EventEmitter();
        this.canView = false;
        this.contextMenuWidth = 0;
        this.detailsColumns = [];
        this._titleCase = inject(TitleCasePipe);
        this._bbbTranslate = inject(BbbTranslatePipe);
        this._el = inject(ElementRef);
        this._cdr = inject(ChangeDetectorRef);
        this._renderer2 = inject(Renderer2);
        this._findColumnByDbName = inject(FindColumnByDbNamePipe);
        this._columnCustomPipe = inject(ColumnCustomComponentPipe);
        this._ulvMainService = inject(UlvMainService);
        this._portalService = inject(PortalService);
        this._uploadService = inject(UploadService, { optional: true });
        this._groupByService = inject(GroupByService, { skipSelf: true, optional: true });
        this._containerWidth = 0;
        this._firstVisible = false;
        this._onVisible$ = new Subject();
        this.$resize = new Subject();
    }
    set containerWidth(val) {
        this._containerWidth = val;
        this._containerWidthChanged(val);
    }
    get showViewButton() {
        return this.canView && !this.inlineEditMode && !this.hideOpenIcon;
    }
    ngOnInit() {
        super.ngOnInit();
        if (this.access.View && !this.showOkCancelButtons) {
            this.canView = true;
        }
        this.elWidth = this._el.nativeElement.clientWidth;
        this.fitWidth = this.viewSetting?.FitWidth === true ? true : false;
        if (this.columns) {
            const fieldDict = {};
            this.columns.forEach((c) => (fieldDict[c.Caption] = c.Name));
            this.fieldDict = fieldDict;
        }
        const detailsSetting = this.viewSetting?.DetailsSetting;
        if (detailsSetting) {
            this.detailsComponent = detailsSetting.Component;
            detailsSetting.Columns.split(',').forEach((columnName) => {
                const column = this._findColumnByDbName.transform(this.allColumns, columnName, this.secondaryColumns);
                if (column) {
                    this.detailsColumns.push(column);
                }
            });
        }
        this._setRowIndicator(this.columns);
        this._handleResize();
        this.$resize
            .asObservable()
            .pipe(takeUntil$1(this._onDestroy$), take(1), debounceTime$1(50))
            .subscribe(() => this.onVisible());
        this.$resize
            .asObservable()
            .pipe(takeUntil$1(this._onDestroy$), skip(1), debounceTime$1(50))
            .subscribe(() => this.onResize());
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this._ro?.disconnect();
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        let detectChanges = false;
        Object.keys(changes).forEach((key) => {
            if (!changes[key].firstChange) {
                this[key] = changes[key].currentValue;
                detectChanges = true;
            }
        });
        if (detectChanges) {
            this.detectChanges();
        }
    }
    onDeselectAll() {
        this.deselectAll.emit();
    }
    onRowCheck(e) {
        // this._singleClicked = true;
        // setTimeout(() => {
        //   if (this._singleClicked) {
        //     this.rowCheck.emit({ mo, index });
        //   }
        // }, 30);
        // this.rowCheck.emit({ mo, index, cause });
        const { mo, index, onlyCheck } = e;
        this.rowCheck.emit({ mo, index, onlyCheck });
    }
    onWorkflowShareButtons(e) {
        this.workflowShareButtons.emit(e);
    }
    onOlgoEvents(e) {
        this[e.title].emit(e.data);
    }
    onRowClick({ mo, index }) {
        this._singleClicked = false;
        this.rowClick.emit({ mo, index });
    }
    onCartableFormClosed({ mo, index }) {
        this.cartableFormClosed.emit({ mo, index });
    }
    onExpandClick(mo) {
        this.expandClick.emit(mo);
    }
    onAllCheckbox(checked) {
        this.allCheckbox.emit(checked);
    }
    onClearCheckbox() {
        this.allCheckbox.emit(false);
    }
    onSelectNextInlineRecord(mo) {
        this.selectNextInlineRecord.emit(mo);
    }
    onEditFormPanelSave(mo) {
        this.editFormPanelSave.emit(mo);
    }
    onEditFormPanelCancel(mo) {
        this.editFormPanelCancel.emit(mo);
    }
    onEscapeKey(mo) {
        this.escapeKey.emit(mo);
    }
    onEditFormPanelValueChange(e) {
        this.editFormPanelValueChange.emit(e);
    }
    onUlvCommand({ mo, index }) {
        this.ulvCommandClick.emit({ mo, index });
    }
    onSortAscending(column) {
        this.sortAscending.emit(column);
    }
    onSortDescending(column) {
        this.sortDescending.emit(column);
    }
    onFilter(column) {
        this.filter.emit(column);
    }
    onAction(commandBody) {
        const command = new Function(commandBody);
        command();
    }
    onDynamicComponentEvents(e, mo, index) {
        switch (e.title) {
            case 'rowCheck':
                this.onRowCheck({ mo, index });
                break;
            case 'rowClick':
                this.onRowClick({ mo, index });
                break;
            case 'ulvCommand':
                this.onUlvCommand({ mo, index });
                break;
        }
    }
    detectChanges() {
        this._cdr.detectChanges();
    }
    _trackBySelectedFn(index, record) {
        this.trackBySelectedFn?.emit({ index, record });
    }
    _trackByColumn(index, column) {
        return `${column.Name}${index}`;
    }
    _trackByRow(index, row) {
        return `${row.$Group ? row.$Group : row.Id}${index}`;
    }
    onVisible() {
        this._visibility = 'visible';
        this._renderer2.setStyle(this._el.nativeElement, 'visibility', 'visible');
        this._onVisible$.next();
    }
    onResize() { }
    _handleResize() {
        fromEvent(window, 'resize')
            .pipe(takeUntil$1(this._onDestroy$))
            .subscribe(() => {
            this.$resize.next();
        });
        // اگر container تغییر اندازه پیدا کرد (مثلاً parent تغییر کنه)
        try {
            this._ro = new ResizeObserver(() => {
                requestAnimationFrame(() => {
                    this.$resize.next();
                });
            });
            if (this._el?.nativeElement) {
                this._ro.observe(this._el.nativeElement);
            }
        }
        catch {
            // مرورگرهای خیلی قدیمی ممکنه ResizeObserver نداشته باشند
            // در آنصورت rely به window resize می‌کنیم
            // no-op
        }
    }
    onActionListClick(mo, index, itemId) {
        if (itemId === 'Show') {
            this.onRowClick({ mo, index });
            return;
        }
        this.onRowCheck({ mo, index });
        const btn = this.toolbarButtons.find((tb) => tb?.itemId === itemId);
        if (btn) {
            btn.handler(btn);
        }
    }
    _containerWidthChanged(_) { }
    _setRowIndicator(columns) {
        if (!columns?.length) {
            return;
        }
        this.rowIndicator = Number(columns[0].MetaFieldTypeId) === 41;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportViewBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ReportViewBaseComponent, isStandalone: false, selector: "bnrc-report-view-base", inputs: { contextView: "contextView", viewSetting: "viewSetting", allColumns: "allColumns", isCheckList: "isCheckList", simpleInlineEdit: "simpleInlineEdit", inlineEditWithoutSelection: "inlineEditWithoutSelection", hideToolbar: "hideToolbar", hideTitle: "hideTitle", toolbarButtons: "toolbarButtons", allChecked: "allChecked", moDataList: "moDataList", UlvMainCtrlr: "UlvMainCtrlr", access: "access", groupby: "groupby", selectedCount: "selectedCount", conditionalFormats: "conditionalFormats", parentHeight: "parentHeight", deviceName: "deviceName", deviceSize: "deviceSize", contextMenuItems: "contextMenuItems", columns: "columns", allowInlineEdit: "allowInlineEdit", secondaryColumns: "secondaryColumns", popin: "popin", customFieldInfo: "customFieldInfo", hasSummary: "hasSummary", layoutInfo: "layoutInfo", hasSelected: "hasSelected", hideIcon: "hideIcon", columnsCount: "columnsCount", hideOpenIcon: "hideOpenIcon", openOnClick: "openOnClick", typeDefId: "typeDefId", reportId: "reportId", listEditViewId: "listEditViewId", typeViewId: "typeViewId", extraRelation: "extraRelation", relationList: "relationList", disableResponsive: "disableResponsive", rowItem: "rowItem", mobileOrTablet: "mobileOrTablet", inDialog: "inDialog", isMultiSelect: "isMultiSelect", fullscreen: "fullscreen", hideSearchpanel: "hideSearchpanel", newInlineEditMo: "newInlineEditMo", selectedMo: "selectedMo", inlineEditMode: "inlineEditMode", onlyInlineEdit: "onlyInlineEdit", rowHoverable: "rowHoverable", groupSummary: "groupSummary", tlbButtons: "tlbButtons", formSetting: "formSetting", disableOverflowContextMenu: "disableOverflowContextMenu", rowActivable: "rowActivable", isReportPage: "isReportPage", ulvHeightSizeType: "ulvHeightSizeType", contentHeight: "contentHeight", effectiveReportLayout: "effectiveReportLayout", contentDensity: "contentDensity", rtl: "rtl", showOkCancelButtons: "showOkCancelButtons", title: "title", hasInlineDeleteButton: "hasInlineDeleteButton", hasInlineEditButton: "hasInlineEditButton", contextSetting: "contextSetting", gridFreeColumnSizing: "gridFreeColumnSizing", navigationArrow: "navigationArrow", cartableTemplates: "cartableTemplates", cartableChildsMo: "cartableChildsMo", pagingSetting: "pagingSetting", containerWidth: "containerWidth" }, outputs: { columnSummary: "columnSummary", escapeKey: "escapeKey", resetWorkflowState: "resetWorkflowState", deselectAll: "deselectAll", editFormPanelCancel: "editFormPanelCancel", editFormPanelSave: "editFormPanelSave", selectNextInlineRecord: "selectNextInlineRecord", editFormPanelValueChange: "editFormPanelValueChange", ulvCommandClick: "ulvCommandClick", sortAscending: "sortAscending", workflowShareButtons: "workflowShareButtons", sortDescending: "sortDescending", filter: "filter", executeToolbarButton: "executeToolbarButton", resetGridSettings: "resetGridSettings", sortSettingsChange: "sortSettingsChange", rowCheck: "rowCheck", rowClick: "rowClick", cartableFormClosed: "cartableFormClosed", createNewMo: "createNewMo", updateMo: "updateMo", expandClick: "expandClick", trackBySelectedFn: "trackBySelectedFn", allCheckbox: "allCheckbox", mandatory: "mandatory", columnResized: "columnResized", hasDetailsInRow: "hasDetailsInRow" }, host: { properties: { "class.report-view": "this._reportView", "style.visibility": "this._visibility" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportViewBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-report-view-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { _reportView: [{
                type: HostBinding,
                args: ['class.report-view']
            }], _visibility: [{
                type: HostBinding,
                args: ['style.visibility']
            }], contextView: [{
                type: Input
            }], viewSetting: [{
                type: Input
            }], allColumns: [{
                type: Input
            }], isCheckList: [{
                type: Input
            }], simpleInlineEdit: [{
                type: Input
            }], inlineEditWithoutSelection: [{
                type: Input
            }], hideToolbar: [{
                type: Input
            }], hideTitle: [{
                type: Input
            }], toolbarButtons: [{
                type: Input
            }], allChecked: [{
                type: Input
            }], moDataList: [{
                type: Input
            }], UlvMainCtrlr: [{
                type: Input
            }], access: [{
                type: Input
            }], groupby: [{
                type: Input
            }], selectedCount: [{
                type: Input
            }], conditionalFormats: [{
                type: Input
            }], parentHeight: [{
                type: Input
            }], deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], contextMenuItems: [{
                type: Input
            }], columns: [{
                type: Input
            }], allowInlineEdit: [{
                type: Input
            }], secondaryColumns: [{
                type: Input
            }], popin: [{
                type: Input
            }], customFieldInfo: [{
                type: Input
            }], hasSummary: [{
                type: Input
            }], layoutInfo: [{
                type: Input
            }], hasSelected: [{
                type: Input
            }], hideIcon: [{
                type: Input
            }], columnsCount: [{
                type: Input
            }], hideOpenIcon: [{
                type: Input
            }], openOnClick: [{
                type: Input
            }], typeDefId: [{
                type: Input
            }], reportId: [{
                type: Input
            }], listEditViewId: [{
                type: Input
            }], typeViewId: [{
                type: Input
            }], extraRelation: [{
                type: Input
            }], relationList: [{
                type: Input
            }], disableResponsive: [{
                type: Input
            }], rowItem: [{
                type: Input
            }], mobileOrTablet: [{
                type: Input
            }], inDialog: [{
                type: Input
            }], isMultiSelect: [{
                type: Input
            }], fullscreen: [{
                type: Input
            }], hideSearchpanel: [{
                type: Input
            }], newInlineEditMo: [{
                type: Input
            }], selectedMo: [{
                type: Input
            }], inlineEditMode: [{
                type: Input
            }], onlyInlineEdit: [{
                type: Input
            }], rowHoverable: [{
                type: Input
            }], groupSummary: [{
                type: Input
            }], tlbButtons: [{
                type: Input
            }], formSetting: [{
                type: Input
            }], disableOverflowContextMenu: [{
                type: Input
            }], rowActivable: [{
                type: Input
            }], isReportPage: [{
                type: Input
            }], ulvHeightSizeType: [{
                type: Input
            }], contentHeight: [{
                type: Input
            }], effectiveReportLayout: [{
                type: Input
            }], contentDensity: [{
                type: Input
            }], rtl: [{
                type: Input
            }], showOkCancelButtons: [{
                type: Input
            }], title: [{
                type: Input
            }], hasInlineDeleteButton: [{
                type: Input
            }], hasInlineEditButton: [{
                type: Input
            }], contextSetting: [{
                type: Input
            }], gridFreeColumnSizing: [{
                type: Input
            }], navigationArrow: [{
                type: Input
            }], cartableTemplates: [{
                type: Input
            }], cartableChildsMo: [{
                type: Input
            }], pagingSetting: [{
                type: Input
            }], columnSummary: [{
                type: Output
            }], escapeKey: [{
                type: Output
            }], resetWorkflowState: [{
                type: Output
            }], deselectAll: [{
                type: Output
            }], editFormPanelCancel: [{
                type: Output
            }], editFormPanelSave: [{
                type: Output
            }], selectNextInlineRecord: [{
                type: Output
            }], editFormPanelValueChange: [{
                type: Output
            }], ulvCommandClick: [{
                type: Output
            }], sortAscending: [{
                type: Output
            }], workflowShareButtons: [{
                type: Output
            }], sortDescending: [{
                type: Output
            }], filter: [{
                type: Output
            }], executeToolbarButton: [{
                type: Output
            }], resetGridSettings: [{
                type: Output
            }], sortSettingsChange: [{
                type: Output
            }], rowCheck: [{
                type: Output
            }], rowClick: [{
                type: Output
            }], cartableFormClosed: [{
                type: Output
            }], createNewMo: [{
                type: Output
            }], updateMo: [{
                type: Output
            }], expandClick: [{
                type: Output
            }], trackBySelectedFn: [{
                type: Output
            }], allCheckbox: [{
                type: Output
            }], mandatory: [{
                type: Output
            }], columnResized: [{
                type: Output
            }], hasDetailsInRow: [{
                type: Output
            }], containerWidth: [{
                type: Input
            }] } });

class FormPropsBaseComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.events = new EventEmitter();
        this._controlUiPipe = inject(ControlUiPipe);
        this._formPanelService = inject(FormPanelService);
        this._sanitizer = inject(DomSanitizer);
        this._cdr = inject(ChangeDetectorRef);
        this._renderer2 = inject(Renderer2);
        this._vcr = inject(ViewContainerRef);
        this._factoryResolver = inject(ComponentFactoryResolver);
    }
    ngOnInit() {
        // this.mo = this._formPanelService.mo;
        super.ngOnInit();
    }
    onEvents(title, data) {
        this.events.emit({ title, data });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormPropsBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FormPropsBaseComponent, isStandalone: false, selector: "bnrc-form-props-base", inputs: { breadCrumbs: "breadCrumbs", toolbarVisible: "toolbarVisible", toolbarItems: "toolbarItems", layoutActions: "layoutActions", layoutActionsTemplateRef: "layoutActionsTemplateRef", layout94: "layout94", settings: "settings", workflowPanelUi: "workflowPanelUi", title: "title", subtitle: "subtitle", description: "description", facetList: "facetList", removeHeaderBorder: "removeHeaderBorder", removeContentPadding: "removeContentPadding", isMobile: "isMobile", avatar: "avatar", rtl: "rtl", mask: "mask", canSend: "canSend", landscape: "landscape", standalone: "standalone", footerDesign: "footerDesign", workflowButtons: "workflowButtons", workflowButtonsComboMode: "workflowButtonsComboMode", fieldDict: "fieldDict", contentDensity: "contentDensity", deviceSize: "deviceSize", dirValue: "dirValue", modernTabs: "modernTabs", mo: "mo" }, outputs: { events: "events" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormPropsBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-form-props-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { breadCrumbs: [{
                type: Input
            }], toolbarVisible: [{
                type: Input
            }], toolbarItems: [{
                type: Input
            }], layoutActions: [{
                type: Input
            }], layoutActionsTemplateRef: [{
                type: Input
            }], layout94: [{
                type: Input
            }], settings: [{
                type: Input
            }], workflowPanelUi: [{
                type: Input
            }], title: [{
                type: Input
            }], subtitle: [{
                type: Input
            }], description: [{
                type: Input
            }], facetList: [{
                type: Input
            }], removeHeaderBorder: [{
                type: Input
            }], removeContentPadding: [{
                type: Input
            }], isMobile: [{
                type: Input
            }], avatar: [{
                type: Input
            }], rtl: [{
                type: Input
            }], mask: [{
                type: Input
            }], canSend: [{
                type: Input
            }], landscape: [{
                type: Input
            }], standalone: [{
                type: Input
            }], footerDesign: [{
                type: Input
            }], workflowButtons: [{
                type: Input
            }], workflowButtonsComboMode: [{
                type: Input
            }], fieldDict: [{
                type: Input
            }], contentDensity: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], dirValue: [{
                type: Input
            }], modernTabs: [{
                type: Input
            }], mo: [{
                type: Input
            }], events: [{
                type: Output
            }] } });

class LinearListHelper {
    constructor(_uploadService, _filesValidationHelper, _fieldDefId) {
        this._uploadService = _uploadService;
        this._filesValidationHelper = _filesValidationHelper;
        this._fieldDefId = _fieldDefId;
        this.uploading$ = new Observable();
        this._onDestroy$ = new Subject();
        this._valueExtra$ = new BehaviorSubject({});
        this._loading$ = new Subject();
        this._delete$ = new Subject();
        this._newFileUploaded$ = new Subject();
        this._uploadService.uploadingState$.pipe(takeUntil(this._onDestroy$)).subscribe((uploadState) => {
            const uploadStateValue = this._getFileValueExtra(uploadState.key);
            uploadStateValue.Progress = uploadState.progress;
            uploadStateValue.UploadState = uploadState.state;
            this._valueExtra[uploadState.key] = uploadStateValue;
            this._valueExtra$.next({ ...this._valueExtra });
        });
    }
    get loading$() {
        return this._loading$.asObservable();
    }
    get valueExtra$() {
        return this._valueExtra$.asObservable();
    }
    get delete$() {
        return this._delete$.asObservable();
    }
    get newFileUploaded$() {
        return this._newFileUploaded$.asObservable();
    }
    init(fileAttachmentInfo) {
        const fileValueExtra = this._getFileValueExtra(fileAttachmentInfo.Id);
        this._setIconAndImage(fileAttachmentInfo, fileValueExtra);
    }
    cancel(fileAttachment) {
        this._valueExtra[fileAttachment.Id].cancelation$?.next();
    }
    retry(fileAttachment) {
        this.uploadFile(fileAttachment).subscribe();
    }
    uploadToServer(files, key = '') {
        const isValid = this._filesValidationHelper.validateFiles(0, files);
        if (!isValid) {
            return;
        }
        const fileAttachments = files.map((c) => this._createFileAttachment(c));
        forkJoin(fileAttachments.map((fileAttachment) => this.uploadFile(fileAttachment, key ? key : fileAttachment.Id))).subscribe();
    }
    destroy() {
        this._onDestroy$.next();
    }
    get _valueExtra() {
        return this._valueExtra$.getValue();
    }
    _getFileValueExtra(fileId) {
        const valueExtra = this._valueExtra;
        const fileValueExtra = valueExtra[fileId];
        if (!fileValueExtra) {
            valueExtra[fileId] = {};
            this._valueExtra$.next({ ...valueExtra });
        }
        return valueExtra[fileId];
    }
    _setIconAndImage(fileAttachment, fileValueExtra) {
        const fileType = fileAttachment.Type;
        const fileId = fileAttachment.Id;
        if (fileAttachment.IsNew && !fileValueExtra.UploadState) {
            fileValueExtra.FileUrl = 'document';
            fileValueExtra.IsIcon = true;
        }
        else if (isImage(fileType)) {
            fileValueExtra.FileUrl = getImagePath('ID', '', fileId);
            fileValueExtra.IsIcon = false;
        }
        else {
            fileValueExtra.FileUrl = getIcon(fileType);
            fileValueExtra.IsIcon = true;
        }
    }
    _setLoading(loading) {
        this._loading$.next(loading);
    }
    _createFileAttachment(file, key = null) {
        const id = key ?? getUniqueId(4);
        const temp = file.name.split('.');
        const ext = temp[temp.length - 1];
        const newFileAttachment = {
            FileName: file.name,
            Id: id,
            FileId: id,
            IsDeleted: false,
            IsNew: true,
            Type: ext
        };
        const fileValueExtra = this._getFileValueExtra(newFileAttachment.Id);
        this._setIconAndImage(newFileAttachment, fileValueExtra);
        fileValueExtra.UploadState = 'Ready';
        fileValueExtra.binary = file;
        fileValueExtra.cancelation$ = new Subject();
        return newFileAttachment;
    }
    uploadFile(fileAttachment, key = '') {
        const formData = new FormData();
        formData.append('unicFileName', 'x' + BarsaApi.Common.Util.GetNewMetaGuid() + ';;;' + fileAttachment.FileName);
        formData.append('file', this._valueExtra[fileAttachment.Id].binary);
        return this._uploadService.upload(formData, this._fieldDefId, key).pipe(tap((res) => {
            if (Array.isArray(res)) {
                this._updateValue(fileAttachment, res);
            }
        }));
    }
    _updateValue(fileAttachment, res) {
        this._delete$.next(fileAttachment);
        // this._deleteFileAttachment(fileAttachment);
        const id = res[0].FileId;
        const newFileAttachment = {
            ...fileAttachment,
            Id: id,
            FileId: id,
            FileName: res[0].FileName,
            IsDeleted: false
        };
        const fileValueExtra = this._getFileValueExtra(id);
        fileValueExtra.binary = null;
        this._setIconAndImage(newFileAttachment, fileValueExtra);
        this._newFileUploaded$.next(newFileAttachment);
    }
}

class PageWithFormHandlerBaseComponent extends PageBaseComponent {
    constructor() {
        super(...arguments);
        this.isFirstPage = true;
        /* eslint-disable */
        this.ShowFormPanelControl = (formpanelCtrlr) => {
            this.formpanelCtrlr = formpanelCtrlr;
            this._showFormPanel();
        };
        /* eslint-disable */
        this.ForceCloseChild = () => {
            this._router.navigate(['../'], { relativeTo: this._activatedRoute });
        };
        /* eslint-disable */
        this.RefreshFormPanelControl = (formpanelCtrlr) => {
            if (!this.formpanelCtrlr) {
                this.formpanelCtrlr = formpanelCtrlr;
            }
            this._showFormPanel(true);
        };
    }
    _showFormPanel(refreshOnly = false) {
        this._portalService.ShowFormPanelControl(this.formpanelCtrlr, this._router, this._activatedRoute, this._formDialogComponent, this.isFirstPage, this._vcr, refreshOnly);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PageWithFormHandlerBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: PageWithFormHandlerBaseComponent, isStandalone: false, selector: "ng-component", inputs: { ShowFormPanelControl: "ShowFormPanelControl", ForceCloseChild: "ForceCloseChild", RefreshFormPanelControl: "RefreshFormPanelControl" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PageWithFormHandlerBaseComponent, decorators: [{
            type: Component,
            args: [{
                    template: '',
                    standalone: false
                }]
        }], propDecorators: { ShowFormPanelControl: [{
                type: Input
            }], ForceCloseChild: [{
                type: Input
            }], RefreshFormPanelControl: [{
                type: Input
            }] } });

class FormPageBaseComponent extends ContainerComponent {
    constructor() {
        super(...arguments);
        this._routingService = inject(RoutingService, { self: true, optional: true });
        this._containerServiceParent = inject(ContainerService, { skipSelf: true, optional: true });
    }
    ngOnInit() {
        super.ngOnInit();
        this._routingService && (this._routingService.isFirstPage = false);
        this._activatedRoute.params.pipe(takeUntil(this._onDestroy$)).subscribe((params) => {
            const state = this._router.getCurrentNavigation()?.extras.state;
            this.prepareIds(state?.formPanelCtrlrId, params);
        });
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        if (!this.formPanelCtrlr) {
            this.formPanelCtrlr = this._portalService.formPanels[this.formpanelCtrlrId];
        }
        if (BarsaApi.LoginFormData.IsServiceDesk) {
            setTimeout(() => {
                window.scrollTo({ top: 0 });
            }, 0);
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this._portalService.formPanels[this.formpanelCtrlrId] = null;
    }
    onFormClose() {
        if (this._activatedRoute.snapshot.params.isFirst &&
            this._activatedRoute.parent?.parent?.routeConfig?.path === 'form') {
            let parentUrl = this._router.url.split('/form/')[0];
            parentUrl = fixUnclosedParentheses(parentUrl);
            this._router.navigateByUrl(parentUrl, {
                replaceUrl: true
            });
            // this.router.navigate(['../']);
            // this.router.navigate([{ outlets: { main: null } }], {
            //   relativeTo: this.activatedRoute,
            // });
        }
        else {
            this._router.navigate(['../'], {
                relativeTo: this._activatedRoute,
                replaceUrl: true
            });
        }
    }
    prepareIds(formpanelCtrlrId, params) {
        this.formpanelCtrlrId = formpanelCtrlrId || params.formPanelCtrlrId;
        if (this.formpanelCtrlrId) {
            this.formPanelCtrlr = this._portalService.formPanels[this.formpanelCtrlrId];
        }
        const moId = params.id;
        const typeDefId = params.tyid;
        const reportId = params.repid;
        const viewId = params.vid;
        this.params = Object.assign({}, { moId, typeDefId, reportId, viewId });
        this._cdr.detectChanges();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormPageBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FormPageBaseComponent, isStandalone: false, selector: "bnrc-form-page-base", inputs: { formPanelCtrlr: "formPanelCtrlr" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormPageBaseComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-form-page-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { formPanelCtrlr: [{
                type: Input
            }] } });

class FormComponent extends BaseComponent {
    constructor() {
        const el = inject(ElementRef);
        super();
        this.titleChanged = new EventEmitter();
        this.moChanged = new EventEmitter();
        this.formClose = new EventEmitter();
        this.uiComponent = new EventEmitter();
        this.formRendered = new EventEmitter();
        this.bruleAction = new EventEmitter();
        this.beforeTransition = new EventEmitter();
        this.afterTransition = new EventEmitter();
        this.uiFormComponent = signal(undefined);
        this.cdr = inject(ChangeDetectorRef);
        this.portalService = inject(PortalService);
        this.injector = inject(Injector);
        this._activatedRoute = inject(ActivatedRoute);
        this._router = inject(Router);
        this._containerService = inject(ContainerService, { self: false, optional: true });
        this._routingService = inject(RoutingService, { skipSelf: true, optional: true });
        el.nativeElement.id = this.uniqueId = getUniqueId(4);
    }
    ngOnInit() {
        super.ngOnInit();
        if (this.formPanelCtrlId && !this.formPanelCtrl) {
            this.formPanelCtrl = this.portalService.formPanels[this.formPanelCtrlId];
        }
        this.appendForm(this.params);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        if (changes.params && !changes.params.firstChange) {
            const params = changes.params;
            const currVal = JSON.stringify(params.currentValue);
            const prevVal = JSON.stringify(params.previousValue);
            if (currVal !== prevVal) {
                // this.vcr.clear();
                // this.appendForm(currVal);
            }
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        const x = this.uiFormComponent();
        if (x) {
            x.destroy();
            this.uiFormComponent.set(undefined);
        }
    }
    _handleSaveOnFieldValueChange() {
        if (!this.formPanelCtrl) {
            return;
        }
        this.formPanelCtrl.on({
            ValueChange: (fpctrlr) => {
                if (this.saveOnChange) {
                    fpctrlr.Save();
                }
            }
        });
    }
    appendForm(params) {
        if (this.formPanelCtrl || this.customFormPanelUi) {
            const customFromPanelUi = this.customFormPanelUi || this.formPanelCtrl.Adapter.Control;
            this._handleSaveOnFieldValueChange();
            this._renderFormPanelUi(customFromPanelUi);
            return;
        }
        const { formSetting, moId, typeDefId, reportId, viewId, viewName, loadActivityView } = params;
        let options = null;
        if (formSetting) {
            options = {
                Mo: formSetting.Data.Mo,
                TypeDefId: formSetting.Data.Mo.$TypeDefId
            };
        }
        else if (moId && (typeDefId || reportId)) {
            options = {
                MoId: moId,
                MoContext: {
                    ReportId: reportId,
                    ViewId: viewId,
                    ViewName: viewName
                },
                TypeDefId: typeDefId,
                ReportId: reportId
            };
        }
        const frmParams = new BarsaApi.Ul.FormRequestParams(options);
        if (loadActivityView) {
            frmParams.LoadActivityView = true;
        }
        const urlparams = this._activatedRoute.snapshot.params;
        urlparams && urlparams.moid && (frmParams.MoId = urlparams.moid);
        const formpanelCtrlr = new BarsaApi.Ul.FormPanelCtrlr({
            FormRequestParams: frmParams
        });
        formpanelCtrlr.inDialog = this.params.inDialog;
        formpanelCtrlr.UlvMainCtrlr = this.UlvMainCtrlr;
        formpanelCtrlr.Setting = formSetting;
        formpanelCtrlr.InlineEditInReport = this.inlineEditInReport;
        if (this._routingService) {
            this._routingService.FormPanelCtrlr = formpanelCtrlr;
            formpanelCtrlr.Page = this._routingService;
        }
        const nav = this._router.getCurrentNavigation();
        formpanelCtrlr.FormRequestParams.state = nav?.extras.state;
        formpanelCtrlr.on({
            BeforeTransition: () => this.beforeTransition.emit(),
            AfterTransition: (_sender, e) => this.afterTransition.emit(e),
            bruleShowMessageAction: this._handleBruleShowMessageAction.bind(this),
            ValueChange: (fpctrlr) => {
                this.moChanged.emit(fpctrlr.Mo);
            }
        });
        this.formPanelCtrl = formpanelCtrlr;
        this._handleSaveOnFieldValueChange();
        this.portalService.formPanels[this.formPanelCtrlId] = formpanelCtrlr;
        BarsaApi.Common.Async.Waterfall('Ul.SystemContainerCtrlr.CreateFormPanel', [
            formpanelCtrlr.LoadAndCreate.bind(formpanelCtrlr, frmParams, false, formSetting ? false : true),
            (doReturn0) => {
                this._renderFormPanelUi(formpanelCtrlr.Adapter.Control);
                doReturn0();
            }
        ], (err, result) => {
            //  me.UnmaskPage(),
            if (err) {
                console.error(err);
            }
            BarsaApi.Common.Async.Finalize(err, result);
        });
    }
    _handleBruleShowMessageAction(action) {
        this.bruleAction.emit(action);
    }
    async _renderFormPanelUi(customFormPanelUi) {
        if (this.params?.isSimple) {
            if (!customFormPanelUi.Setting.View.ExtraJsonProp) {
                customFormPanelUi.Setting.View.ExtraJsonProp = {};
            }
            customFormPanelUi.Setting.View.ExtraJsonProp.IsSimple = this.params.isSimple;
        }
        const customUiSetting = BarsaApi.Common.Util.TryGetValue(customFormPanelUi.Setting, 'View.CustomUi', null);
        const { moduleName, modulePath, componentName, selector } = getComponentDefined(customFormPanelUi, customUiSetting);
        this.portalService
            .getComponent(moduleName, modulePath, componentName, selector, this.injector)
            .pipe(takeUntil(this._onDestroy$), tap((component) => {
            const componentInstance = component.instance;
            componentInstance.FormPanelCtrlr = this.formPanelCtrl;
            componentInstance.context = customFormPanelUi;
            componentInstance.toolbar = customFormPanelUi.toolbar;
            componentInstance.setting = customFormPanelUi.Setting;
            componentInstance.title = customFormPanelUi.title;
            componentInstance.groupVisibility = customFormPanelUi.groupVisibility;
            this.vcr.insert(component.hostView);
            componentInstance.mo$.pipe(takeUntil(this._onDestroy$)).subscribe((mo) => {
                this.moChanged.emit(mo);
            });
            componentInstance.title$.pipe(takeUntil(this._onDestroy$)).subscribe((title) => {
                this.titleChanged.emit(title);
            });
            componentInstance.forceClose$.pipe(takeUntil(this._onDestroy$)).subscribe(() => {
                this.formClose.emit();
            });
            // this.formPanelCtrl.on('ValueChange', () => this.moChanged.emit(this.formPanelCtrl.Mo));
            // component.instance.addEventListener('formClose', this.close);
            // el.appendChild(htmlElement);
            this.formRendered.emit(customFormPanelUi);
        }))
            .subscribe((component) => {
            this.uiFormComponent.set(component);
            this.uiComponent.emit(component.instance);
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FormComponent, isStandalone: false, selector: "bnrc-form", inputs: { params: "params", customFormPanelUi: "customFormPanelUi", formPanelCtrl: "formPanelCtrl", UlvMainCtrlr: "UlvMainCtrlr", formPanelCtrlId: "formPanelCtrlId", saveOnChange: "saveOnChange", inlineEditInReport: "inlineEditInReport" }, outputs: { titleChanged: "titleChanged", moChanged: "moChanged", formClose: "formClose", uiComponent: "uiComponent", formRendered: "formRendered", bruleAction: "bruleAction", beforeTransition: "beforeTransition", afterTransition: "afterTransition" }, viewQueries: [{ propertyName: "vcr", first: true, predicate: ["placeholder"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-container #placeholder> </ng-container>', isInline: true, styles: [":host{display:block;width:100%;min-height:100%}:host ::ng-deep bsu-ly-layout-container-of-root.ismobile bnrc-field-ui{padding:.3rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-form', template: '<ng-container #placeholder> </ng-container>', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block;width:100%;min-height:100%}:host ::ng-deep bsu-ly-layout-container-of-root.ismobile bnrc-field-ui{padding:.3rem}\n"] }]
        }], ctorParameters: () => [], propDecorators: { params: [{
                type: Input
            }], customFormPanelUi: [{
                type: Input
            }], formPanelCtrl: [{
                type: Input
            }], UlvMainCtrlr: [{
                type: Input
            }], formPanelCtrlId: [{
                type: Input
            }], saveOnChange: [{
                type: Input
            }], inlineEditInReport: [{
                type: Input
            }], titleChanged: [{
                type: Output
            }], moChanged: [{
                type: Output
            }], formClose: [{
                type: Output
            }], uiComponent: [{
                type: Output
            }], formRendered: [{
                type: Output
            }], bruleAction: [{
                type: Output
            }], beforeTransition: [{
                type: Output
            }], afterTransition: [{
                type: Output
            }], vcr: [{
                type: ViewChild,
                args: ['placeholder', { read: ViewContainerRef, static: true }]
            }] } });

class BaseDirective {
    constructor() {
        this._el = inject(ElementRef);
        this._portalService = inject(PortalService);
        this._renderer2 = inject(Renderer2);
        this._onDestroy$ = new Subject();
    }
    get renderer2() {
        return this._renderer2;
    }
    ngAfterContentInit() {
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log('ngAfterContentInit');
        console.log(this);
    }
    ngOnChanges(changes) {
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log(changes);
    }
    ngOnInit() {
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log('ngOnInit');
        console.log(this);
    }
    ngAfterViewInit() {
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log('ngAfterViewInit');
        console.log(this);
    }
    ngOnDestroy() {
        this._onDestroy$.next();
        this._onDestroy$.complete();
        if (!BarsaApi.Common.Debug?.Data?.CustomUi) {
            return;
        }
        console.log('ngOnDestroy');
        console.log(this);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: BaseDirective, isStandalone: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseDirective, decorators: [{
            type: Directive
        }] });

class FormCloseDirective extends BaseDirective {
    ngAfterViewInit() {
        super.ngAfterViewInit();
        if (!this.isMobile) {
            return;
        }
        const formDom = this._el.nativeElement;
        const titleContainerDom = formDom.querySelector('.fd-dynamic-page__title-container');
        const closeButton = formDom.querySelector('button[title="Close"');
        if (closeButton && titleContainerDom) {
            titleContainerDom?.insertAdjacentElement('afterbegin', closeButton);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormCloseDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: FormCloseDirective, isStandalone: false, selector: "[formClose]", inputs: { isMobile: "isMobile" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormCloseDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[formClose]',
                    standalone: false
                }]
        }], propDecorators: { isMobile: [{
                type: Input
            }] } });

class FormPageComponent extends FormPageBaseComponent {
    constructor() {
        super(...arguments);
        this.sectionClass = true;
        this.absolutePageClass = false;
    }
    ngOnInit() {
        this.containerRef.insert(this._placeHolderTemplate.createEmbeddedView(this, this._injector));
        super.ngOnInit();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FormPageComponent, isStandalone: false, selector: "bnrc-form-page", inputs: { formPanelCtrlr: "formPanelCtrlr" }, host: { properties: { "class.section": "this.sectionClass", "class.absolute-page": "this.absolutePageClass" } }, providers: [FormService, RoutingService, ContainerService], viewQueries: [{ propertyName: "_placeHolderTemplate", first: true, predicate: ["placeHolderTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
        <ng-template #placeHolderTemplate>
            <bnrc-form
                [formPanelCtrl]="formPanelCtrlr"
                [formPanelCtrlId]="formpanelCtrlrId"
                [params]="params"
                (formClose)="onFormClose()"
            ></bnrc-form>
        </ng-template>
        <ng-container #containerRef> </ng-container>
        <router-outlet></router-outlet>
    `, isInline: true, styles: [":host{display:block;background:var(--sapBackgroundColor)}\n"], dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: FormComponent, selector: "bnrc-form", inputs: ["params", "customFormPanelUi", "formPanelCtrl", "UlvMainCtrlr", "formPanelCtrlId", "saveOnChange", "inlineEditInReport"], outputs: ["titleChanged", "moChanged", "formClose", "uiComponent", "formRendered", "bruleAction", "beforeTransition", "afterTransition"] }, { kind: "directive", type: FormCloseDirective, selector: "[formClose]", inputs: ["isMobile"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormPageComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-form-page', template: `
        <ng-template #placeHolderTemplate>
            <bnrc-form
                [formPanelCtrl]="formPanelCtrlr"
                [formPanelCtrlId]="formpanelCtrlrId"
                [params]="params"
                (formClose)="onFormClose()"
            ></bnrc-form>
        </ng-template>
        <ng-container #containerRef> </ng-container>
        <router-outlet></router-outlet>
    `, providers: [FormService, RoutingService, ContainerService], changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block;background:var(--sapBackgroundColor)}\n"] }]
        }], propDecorators: { _placeHolderTemplate: [{
                type: ViewChild,
                args: ['placeHolderTemplate', { static: true }]
            }], formPanelCtrlr: [{
                type: Input
            }], sectionClass: [{
                type: HostBinding,
                args: ['class.section']
            }], absolutePageClass: [{
                type: HostBinding,
                args: ['class.absolute-page']
            }] } });

class BaseColumnPropsComponent extends BaseComponent {
    constructor() {
        super();
        this.save = new EventEmitter();
        // eslint-disable-next-line
        this.cancel = new EventEmitter();
        this.tab = new EventEmitter();
        this.changeToEditMode = new EventEmitter();
        this._columnService = inject(ColumnService, { optional: true, self: true });
        if (this._columnService) {
            this._columnService.uiControlRendered.pipe(takeUntil$1(this._onDestroy$)).subscribe(() => {
                this._callChangeToEditMode();
            });
        }
        else {
            this._log.error(nullOrUndefinedString('BaseColumnPropsComponent=> _columnService'));
        }
    }
    _callChangeToEditMode() {
        this.changeToEditMode.emit(this._el.nativeElement);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseColumnPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseColumnPropsComponent, isStandalone: false, selector: "bnrc-base-column-props", inputs: { allColumns: "allColumns", column: "column", attachmentViewType: "attachmentViewType", mo: "mo", index: "index", editMode: "editMode", isMobile: "isMobile", customRowHeight: "customRowHeight", controlUi: "controlUi", formLayoutShowLabel: "formLayoutShowLabel", isChecked: "isChecked", isdirty: "isdirty", isNewInlineMo: "isNewInlineMo", layout94: "layout94", detailsComponentSetting: "detailsComponentSetting", value: "value", icon: "icon", rtl: "rtl", cellEdit: "cellEdit", deviceName: "deviceName", deviceSize: "deviceSize", customComponent: "customComponent" }, outputs: { save: "save", cancel: "cancel", tab: "tab", changeToEditMode: "changeToEditMode" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseColumnPropsComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-base-column-props',
                    template: ``,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { save: [{
                type: Output
            }], cancel: [{
                type: Output
            }], tab: [{
                type: Output
            }], changeToEditMode: [{
                type: Output
            }], allColumns: [{
                type: Input
            }], column: [{
                type: Input
            }], attachmentViewType: [{
                type: Input
            }], mo: [{
                type: Input
            }], index: [{
                type: Input
            }], editMode: [{
                type: Input
            }], isMobile: [{
                type: Input
            }], customRowHeight: [{
                type: Input
            }], controlUi: [{
                type: Input
            }], formLayoutShowLabel: [{
                type: Input
            }], isChecked: [{
                type: Input
            }], isdirty: [{
                type: Input
            }], isNewInlineMo: [{
                type: Input
            }], layout94: [{
                type: Input
            }], detailsComponentSetting: [{
                type: Input
            }], value: [{
                type: Input
            }], icon: [{
                type: Input
            }], rtl: [{
                type: Input
            }], cellEdit: [{
                type: Input
            }], deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], customComponent: [{
                type: Input
            }] } });

class TilePropsComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.hideClick = new EventEmitter();
        this.renameClick = new EventEmitter();
        this.changeGroupClick = new EventEmitter();
        this._renderer2 = inject(Renderer2);
        this._cdr = inject(ChangeDetectorRef);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TilePropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: TilePropsComponent, isStandalone: false, selector: "bnrc-tile-base", inputs: { parameters: "parameters", data: "data", context: "context", edit: "edit", deviceSize: "deviceSize", setToStorage: "setToStorage", listMode: "listMode", navigateBackOnClick: "navigateBackOnClick", groupType: "groupType", layoutInfo: "layoutInfo" }, outputs: { hideClick: "hideClick", renameClick: "renameClick", changeGroupClick: "changeGroupClick" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TilePropsComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-tile-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { parameters: [{
                type: Input
            }], data: [{
                type: Input
            }], context: [{
                type: Input
            }], edit: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], setToStorage: [{
                type: Input
            }], listMode: [{
                type: Input
            }], navigateBackOnClick: [{
                type: Input
            }], groupType: [{
                type: Input
            }], layoutInfo: [{
                type: Input
            }], hideClick: [{
                type: Output
            }], renameClick: [{
                type: Output
            }], changeGroupClick: [{
                type: Output
            }] } });

class FormFieldReportPageComponent extends BaseComponent {
    constructor() {
        super();
        this.sectionClass = true;
        this.absolutePageClass = true;
        this._activatedRoute = inject(ActivatedRoute);
        this._portalService = inject(PortalService);
        this._injector = inject(Injector);
        this._cdr = inject(ChangeDetectorRef);
        this._loadingSource = new BehaviorSubject(false);
        this.loading$ = this._loadingSource.asObservable().pipe(takeUntil(this._onDestroy$), debounceTime(200));
    }
    ngOnInit() {
        super.ngOnInit();
        this._activatedRoute.params
            .pipe(takeUntil(this._onDestroy$), tap(() => this._setLoading(true)), map((params) => ({
            Id: 0,
            ReportId: params.id
        })), switchMap$1((navItem) => this._portalService.renderUlvMainUi(navItem, this.containerRef, this._injector, true)))
            .subscribe(() => {
            this._setLoading(false);
        });
    }
    ngOnDestroy() {
        super.ngOnDestroy();
    }
    _setLoading(val) {
        this._loadingSource.next(val);
        this._cdr.detectChanges();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormFieldReportPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FormFieldReportPageComponent, isStandalone: false, selector: "bnrc-form-field-report-page.component", host: { properties: { "class.section": "this.sectionClass", "class.absolute-page": "this.absolutePageClass" } }, viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["containerRef"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `<ng-container #containerRef></ng-container><router-outlet></router-outlet>`, isInline: true, styles: [":host{display:block;background:var(--sapBackgroundColor)}\n"], dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormFieldReportPageComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-form-field-report-page.component', template: `<ng-container #containerRef></ng-container><router-outlet></router-outlet>`, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block;background:var(--sapBackgroundColor)}\n"] }]
        }], ctorParameters: () => [], propDecorators: { containerRef: [{
                type: ViewChild,
                args: ['containerRef', { static: true, read: ViewContainerRef }]
            }], sectionClass: [{
                type: HostBinding,
                args: ['class.section']
            }], absolutePageClass: [{
                type: HostBinding,
                args: ['class.absolute-page']
            }] } });

class ColumnRendererBase extends BaseComponent {
    constructor() {
        super(...arguments);
        this._isSmall = false;
        this.errorMessage = signal('');
        this.errorCode = signal(-1);
        this.injector = inject(Injector);
        /**
         *
         */
        this._renderer2 = inject(Renderer2);
        this._cdr = inject(ChangeDetectorRef);
    }
    ngOnInit() {
        this.signalValue = signal(this.value);
        super.ngOnInit();
        this.fieldTypeId = Number(this.column.FieldTypeId);
        if (this.deviceSize === 's') {
            this._isSmall = true;
        }
    }
    ngOnChanges(changes) {
        const { value } = changes;
        if (value && !value.firstChange) {
            this.signalValue.set(value.currentValue);
        }
    }
    ngAfterViewInit() {
        if (this.column.FieldTypeId.toString() === '31') {
            setTimeout(() => {
                this._cdr.detectChanges();
            }, 0);
        }
    }
    showError(message, code) {
        this.errorMessage.set(message);
        this.errorCode.set(code);
    }
    onElapsised(val) {
        if (this.disableEllapsis) {
            return;
        }
        this.showMore = val;
        this._cdr.detectChanges();
    }
    onSetMaxWidth() {
        this._renderer2.setStyle(this._filePopover.nativeElement, 'max-width', `${this.containerDom?.offsetWidth}px`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnRendererBase, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ColumnRendererBase, isStandalone: false, selector: "bsu-column-renderer-base", inputs: { cellEdit: "cellEdit", column: "column", allColumns: "allColumns", mo: "mo", index: "index", editMode: "editMode", attachmentViewType: "attachmentViewType", customRowHeight: "customRowHeight", controlUi: "controlUi", formLayoutShowLabel: "formLayoutShowLabel", isChecked: "isChecked", isNewInlineMo: "isNewInlineMo", containerDom: "containerDom", disableEllapsis: "disableEllapsis", rtl: "rtl", isMobile: "isMobile", fdTextMode: "fdTextMode", deviceName: "deviceName", deviceSize: "deviceSize", value: "value", icon: "icon", parameters: "parameters" }, host: { properties: { "class.isMobile": "this._isSmall" } }, viewQueries: [{ propertyName: "_filePopover", first: true, predicate: ["fileviewerPopover"], descendants: true, read: ElementRef }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnRendererBase, decorators: [{
            type: Component,
            args: [{
                    selector: 'bsu-column-renderer-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { _filePopover: [{
                type: ViewChild,
                args: ['fileviewerPopover', { static: false, read: ElementRef }]
            }], _isSmall: [{
                type: HostBinding,
                args: ['class.isMobile']
            }], cellEdit: [{
                type: Input
            }], column: [{
                type: Input
            }], allColumns: [{
                type: Input
            }], mo: [{
                type: Input
            }], index: [{
                type: Input
            }], editMode: [{
                type: Input
            }], attachmentViewType: [{
                type: Input
            }], customRowHeight: [{
                type: Input
            }], controlUi: [{
                type: Input
            }], formLayoutShowLabel: [{
                type: Input
            }], isChecked: [{
                type: Input
            }], isNewInlineMo: [{
                type: Input
            }], containerDom: [{
                type: Input
            }], disableEllapsis: [{
                type: Input
            }], rtl: [{
                type: Input
            }], isMobile: [{
                type: Input
            }], fdTextMode: [{
                type: Input
            }], deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], value: [{
                type: Input
            }], icon: [{
                type: Input
            }], parameters: [{
                type: Input
            }] } });

class ColumnRendererViewBase extends ColumnRendererBase {
    constructor() {
        super(...arguments);
        this.errorMessage = signal('');
        this.errorCode = signal(-1);
        this.injector = inject(Injector);
    }
    /**
     *
     */
    ngOnInit() {
        this.controller.init(this.parameters);
    }
    showError(message, code) {
        this.errorMessage.set(message);
        this.errorCode.set(code);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnRendererViewBase, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ColumnRendererViewBase, isStandalone: false, selector: "bnrc-ext-field-base", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnRendererViewBase, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-ext-field-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }] });

class EmptyPageComponent extends PageWithFormHandlerBaseComponent {
    constructor() {
        super(...arguments);
        this._position = null;
        this.sectionClass = true;
        this.absolutePageClass = true;
        this.ismodal = false;
    }
    ngOnInit() {
        this.settings = BarsaApi.Common.Util.TryGetValue(this._activatedRoute, 'data._value.pageData.Component.Settings', null);
        const isModal = this.settings?.IsModal;
        const isRelativePage = this._activatedRoute.snapshot.data?.pageData?.Component?.Settings?.IsRelativePage;
        if (isRelativePage || isModal) {
            if (this._parentContainerService) {
                this._parentContainerService.detachParent = false;
            }
            else {
                this._log.error(nullOrUndefinedString('EmptyPageComponent=> _containerService'));
            }
        }
        if (isModal) {
            this._position = 'absolute';
            this.ismodal = true;
        }
        super.ngOnInit();
        // if (!BarsaApi.LoginFormData.IsServiceDesk && !isModal) {
        //     this._position = 'initial';
        // }
        if (isRelativePage && !isModal) {
            this._position = 'initial';
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: EmptyPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: EmptyPageComponent, isStandalone: false, selector: "bnrc-empty-page", host: { properties: { "style.position": "this._position", "class.section": "this.sectionClass", "class.absolute-page": "this.absolutePageClass", "class.modal": "this.ismodal" } }, providers: [RoutingService, ContainerService], usesInheritance: true, ngImport: i0, template: `<ng-container #containerRef></ng-container>
        <router-outlet></router-outlet>
        <router-outlet name="dialog"></router-outlet>`, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: EmptyPageComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-empty-page', template: `<ng-container #containerRef></ng-container>
        <router-outlet></router-outlet>
        <router-outlet name="dialog"></router-outlet>`, providers: [RoutingService, ContainerService], changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block}\n"] }]
        }], propDecorators: { _position: [{
                type: HostBinding,
                args: ['style.position']
            }], sectionClass: [{
                type: HostBinding,
                args: ['class.section']
            }], absolutePageClass: [{
                type: HostBinding,
                args: ['class.absolute-page']
            }], ismodal: [{
                type: HostBinding,
                args: ['class.modal']
            }] } });

class SplitterComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.emptyClass = true;
        this.isBig = false;
        this.spliterResized = new EventEmitter();
        this._renderer = inject(Renderer2);
        this._portalService = inject(PortalService);
    }
    ngOnInit() {
        super.ngOnInit();
        if (this.config) {
            const { Bounds, MaxSize } = this.config;
            this.elHeight = Bounds.height;
            if (this.elHeight > 30) {
                this.isBig = true;
            }
            this.flex = Bounds.width;
            if (MaxSize.width > 0) {
                this.elMaxWidth = MaxSize.width;
            }
        }
        const mousedown$ = fromEvent(this.el.nativeElement, 'mousedown');
        const mousemove$ = fromEvent(document, 'mousemove');
        const mouseup$ = fromEvent(document, 'mouseup');
        mousedown$
            .pipe(tap$1((event) => {
            event.preventDefault();
            let nextElementSibling = this.el.nativeElement.nextElementSibling;
            while (nextElementSibling &&
                nextElementSibling.tagName.toLocaleLowerCase() === 'bnrc-dynamic-layout') {
                nextElementSibling &&
                    nextElementSibling.nextElementSibling &&
                    (nextElementSibling = nextElementSibling.nextElementSibling);
            }
            this.toggleResizingState(true, nextElementSibling);
        }), switchMap(() => {
            // تشخیص جهت در لحظه شروع درگ
            const isRtl = getComputedStyle(this.el.nativeElement).direction === 'rtl';
            let previousElementSibling = this.elDom || this.el.nativeElement.previousElementSibling;
            while (previousElementSibling &&
                previousElementSibling.tagName.toLocaleLowerCase() === 'bnrc-dynamic-layout') {
                previousElementSibling &&
                    previousElementSibling.previousElementSibling &&
                    (previousElementSibling = previousElementSibling.previousElementSibling);
            }
            let nextElementSibling = this.el.nativeElement.nextElementSibling;
            while (nextElementSibling &&
                nextElementSibling.tagName.toLocaleLowerCase() === 'bnrc-dynamic-layout') {
                nextElementSibling &&
                    nextElementSibling.nextElementSibling &&
                    (nextElementSibling = nextElementSibling.nextElementSibling);
            }
            const initialRect = previousElementSibling?.getBoundingClientRect();
            return mousemove$.pipe(tap$1((event) => {
                if (previousElementSibling && initialRect) {
                    this.calculateAndSetWidth(event, previousElementSibling, nextElementSibling, initialRect, isRtl);
                }
            }), takeUntil$1(mouseup$.pipe(tap$1(() => this.toggleResizingState(false, nextElementSibling)))));
        }), takeUntil$1(this._onDestroy$))
            .subscribe();
    }
    calculateAndSetWidth(event, sibling, nextSibling, rect, isRtl) {
        let newWidth;
        if (isRtl) {
            // در RTL: فاصله لبه راستِ المنت تا موقعیت ماوس
            newWidth = rect.right - event.clientX;
        }
        else {
            // در LTR: فاصله موقعیت ماوس تا لبه چپِ المنت
            newWidth = event.clientX - rect.left;
        }
        if ((!this.minWidth || newWidth >= this.minWidth) && (!this.maxWidth || newWidth <= this.maxWidth)) {
            nextSibling && this._renderer.setStyle(nextSibling, 'overflow', `hidden`);
            const value = `${newWidth}px`;
            this._renderer.setStyle(sibling, 'width', value);
            this._renderer.setStyle(sibling, 'flex', 'none');
            this.spliterResized.emit(value);
        }
    }
    toggleResizingState(isResizing, nextSibling) {
        const action = isResizing ? 'addClass' : 'removeClass';
        this._renderer[action](document.body, 'resizing-active');
        this._renderer[action](this.el.nativeElement, 'is-resizing');
        if (!isResizing) {
            nextSibling && this._renderer.removeClass(nextSibling, 'tw-overflow-hidden');
            this._portalService.windowResize();
        }
        else {
            nextSibling && this._renderer.addClass(nextSibling, 'tw-overflow-hidden');
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SplitterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: SplitterComponent, isStandalone: false, selector: "bnrc-splitter", inputs: { minWidth: "minWidth", maxWidth: "maxWidth", config: "config", elDom: "elDom" }, outputs: { spliterResized: "spliterResized" }, host: { properties: { "class.empty-space": "this.emptyClass", "class.big": "this.isBig", "style.flex": "this.flex", "style.max-width.px": "this.elMaxWidth", "style.height.px": "this.elHeight" } }, usesInheritance: true, ngImport: i0, template: `<div class="splitter-container">
        <div class="splitter-line"></div>
        <div class="grip-handle">
            <svg viewBox="0 0 24 24" fill="currentColor">
                <circle cx="9" cy="8" r="1.5" />
                <circle cx="15" cy="8" r="1.5" />
                <circle cx="9" cy="12" r="1.5" />
                <circle cx="15" cy="12" r="1.5" />
                <circle cx="9" cy="16" r="1.5" />
                <circle cx="15" cy="16" r="1.5" />
            </svg>
        </div>
    </div>`, isInline: true, styles: [":host{display:flex;align-items:center;justify-content:center;width:12px;cursor:col-resize;z-index:50;-webkit-user-select:none;user-select:none;position:relative;background:var(--sapBackgroundColor)}.splitter-container{height:100%;width:100%;display:flex;align-items:center;justify-content:center;position:relative}.splitter-line{width:1px;height:90%;background:linear-gradient(to bottom,transparent 0%,rgba(203,213,225,1) 15%,rgba(203,213,225,1) 85%,transparent 100%);transition:all .2s}.grip-handle{position:absolute;width:17px;height:20px;background:#fff;border:1px solid #e2e8f0;border-radius:6px;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 4px #0000000d;transition:all .2s;color:#94a3b8}.grip-handle svg{width:14px;height:14px}:host:hover .splitter-line,.is-resizing .splitter-line{background:linear-gradient(to bottom,transparent 0%,#3b82f6 15%,#3b82f6 85%,transparent 100%);width:2px}:host:hover .grip-handle,.is-resizing .grip-handle{border-color:#3b82f6;color:#3b82f6;box-shadow:0 4px 6px -1px #3b82f633;transform:scale(1.05)}\n"] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SplitterComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-splitter', standalone: false, template: `<div class="splitter-container">
        <div class="splitter-line"></div>
        <div class="grip-handle">
            <svg viewBox="0 0 24 24" fill="currentColor">
                <circle cx="9" cy="8" r="1.5" />
                <circle cx="15" cy="8" r="1.5" />
                <circle cx="9" cy="12" r="1.5" />
                <circle cx="15" cy="12" r="1.5" />
                <circle cx="9" cy="16" r="1.5" />
                <circle cx="15" cy="16" r="1.5" />
            </svg>
        </div>
    </div>`, styles: [":host{display:flex;align-items:center;justify-content:center;width:12px;cursor:col-resize;z-index:50;-webkit-user-select:none;user-select:none;position:relative;background:var(--sapBackgroundColor)}.splitter-container{height:100%;width:100%;display:flex;align-items:center;justify-content:center;position:relative}.splitter-line{width:1px;height:90%;background:linear-gradient(to bottom,transparent 0%,rgba(203,213,225,1) 15%,rgba(203,213,225,1) 85%,transparent 100%);transition:all .2s}.grip-handle{position:absolute;width:17px;height:20px;background:#fff;border:1px solid #e2e8f0;border-radius:6px;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 4px #0000000d;transition:all .2s;color:#94a3b8}.grip-handle svg{width:14px;height:14px}:host:hover .splitter-line,.is-resizing .splitter-line{background:linear-gradient(to bottom,transparent 0%,#3b82f6 15%,#3b82f6 85%,transparent 100%);width:2px}:host:hover .grip-handle,.is-resizing .grip-handle{border-color:#3b82f6;color:#3b82f6;box-shadow:0 4px 6px -1px #3b82f633;transform:scale(1.05)}\n"] }]
        }], propDecorators: { emptyClass: [{
                type: HostBinding,
                args: ['class.empty-space']
            }], isBig: [{
                type: HostBinding,
                args: ['class.big']
            }], flex: [{
                type: HostBinding,
                args: ['style.flex']
            }], elMaxWidth: [{
                type: HostBinding,
                args: ['style.max-width.px']
            }], elHeight: [{
                type: HostBinding,
                args: ['style.height.px']
            }], spliterResized: [{
                type: Output
            }], minWidth: [{
                type: Input
            }], maxWidth: [{
                type: Input
            }], config: [{
                type: Input
            }], elDom: [{
                type: Input
            }] } });

/**
 * Fills remaining vertical space for the host element.
 *
 * - **viewport** — page-level: uses `window.innerHeight` and offset from the top of the viewport.
 * - **container** — nested layouts: bounds from the **resolved container** (`[containerDom]` if set,
 * else nearest ancestor with `fillEmptySpace`, else `document.documentElement`).
 *
 * Vertical scroll ownership is **not** decided here; use `ScrollLayoutContextHolder` (`nested` | `isolated` | `root`)
 *  from `barsa-novin-ray-core` on the page shell.
 *
 * @deprecated Do not use this directive as the primary way to **size individual reports** (grids, calendars).
 * Prefer the report layout policy / scroll shell (`resolveReportLayoutPolicy`, `report-grid-wrapper`). Filling
 * **page or shell containers** remains an appropriate use case.
 **/
class FillEmptySpaceDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        /**
         * `viewport` — fill against the browser viewport (default).
         * `container` — fill inside resolved container: optional `[containerDom]`, else nearest parent `[fillEmptySpace]`, else document root.
         */
        this.mode = 'viewport';
        this.heightChanged = new EventEmitter();
        this._rafId = null;
        this._viewReady = false;
        this._onWindowResize = () => this.scheduleMeasure();
    }
    ngAfterViewInit() {
        this._viewReady = true;
        this.syncFillWatchersAndMeasure();
    }
    ngOnChanges(_changes) {
        if (!this._viewReady) {
            return;
        }
        this.syncFillWatchersAndMeasure();
    }
    ngOnDestroy() {
        this.cancelScheduledMeasure();
        this.teardownFillLayoutWatchers();
        super.ngOnDestroy();
    }
    Refresh() {
        this.measureAndApply();
    }
    scheduleMeasure() {
        if (this._rafId !== null) {
            cancelAnimationFrame(this._rafId);
        }
        this._rafId = requestAnimationFrame(() => {
            this._rafId = null;
            this.measureAndApply();
        });
    }
    cancelScheduledMeasure() {
        if (this._rafId !== null) {
            cancelAnimationFrame(this._rafId);
            this._rafId = null;
        }
    }
    syncFillWatchersAndMeasure() {
        this.teardownFillLayoutWatchers();
        this.cancelScheduledMeasure();
        if (this.disable) {
            return;
        }
        if (this.height != null) {
            this.measureAndApply();
            return;
        }
        this.setupFillLayoutWatchers();
        this.scheduleMeasure();
    }
    setupFillLayoutWatchers() {
        if (typeof ResizeObserver === 'undefined') {
            window.addEventListener('resize', this._onWindowResize);
            return;
        }
        const roTarget = this.getContainerElement();
        this._ro = new ResizeObserver(() => this.scheduleMeasure());
        this._ro.observe(roTarget);
        window.addEventListener('resize', this._onWindowResize);
    }
    teardownFillLayoutWatchers() {
        this._ro?.disconnect();
        this._ro = undefined;
        window.removeEventListener('resize', this._onWindowResize);
    }
    measureAndApply() {
        if (this.disable) {
            return;
        }
        const dom = this._el.nativeElement;
        if (dom.getClientRects().length === 0) {
            return;
        }
        if (this.height != null) {
            this.applyFixedHeight(dom);
            return;
        }
        const hostRect = dom.getBoundingClientRect();
        const containerRect = this.getContainerMetrics();
        const offsetTop = this.getOffsetTop(hostRect, containerRect);
        const decrementPx = this.parseCssSize(this.decrement);
        const available = this.calculateAvailableHeight(containerRect.height, offsetTop, decrementPx);
        this.applyFillHeight(dom, available);
    }
    /**
     * Element used for ResizeObserver and for `container` mode metrics:
     * `[containerDom]` → parent `closest('[fillEmptySpace]')` → `document.documentElement`.
     * Uses `parentElement` before `closest` so the host itself is not selected.
     */
    getContainerElement() {
        if (this.containerDom) {
            return this.containerDom;
        }
        const host = this._el.nativeElement;
        const parentFill = host.parentElement?.closest('[fillEmptySpace]');
        if (parentFill) {
            return parentFill;
        }
        return document.documentElement;
    }
    getContainerMetrics() {
        if (this.mode === 'viewport') {
            // Same spirit as legacy `100svh`: viewport height; explicit container is not used for sizing.
            return { top: 0, height: window.innerHeight };
        }
        const r = this.getContainerElement().getBoundingClientRect();
        return { top: r.top, height: r.height };
    }
    getOffsetTop(hostRect, containerRect) {
        return this.dontUseTopBound ? 0 : hostRect.top - containerRect.top;
    }
    calculateAvailableHeight(containerHeight, offsetTop, decrementPx) {
        return Math.max(0, containerHeight - offsetTop - decrementPx);
    }
    applyFillHeight(dom, px) {
        const prop = this.getStyleProperty();
        if (prop === 'min-height' || prop === 'max-height') {
            this._renderer2.setStyle(dom, 'height', 'auto');
        }
        this._renderer2.setStyle(dom, prop, `${px}px`);
        this.heightChanged.emit();
    }
    applyFixedHeight(dom) {
        if (this.setMinHeight) {
            this._renderer2.setStyle(dom, 'height', 'auto');
        }
        if (this.setMaxHeight) {
            this._renderer2.setStyle(dom, 'height', 'auto');
        }
        const prop = this.setMinHeight ? 'min-height' : this.setMaxHeight ? 'max-height' : 'height';
        this._renderer2.setStyle(dom, prop, `${this.height}px`);
        this.heightChanged.emit();
    }
    getStyleProperty() {
        if (this.setMinHeight) {
            return 'min-height';
        }
        if (this.setMaxHeight) {
            return 'max-height';
        }
        return 'height';
    }
    parseCssSize(value) {
        if (value == null || value === '') {
            return 0;
        }
        if (typeof value === 'number' && !Number.isNaN(value)) {
            return value;
        }
        const s = String(value).trim().toLowerCase();
        if (!s) {
            return 0;
        }
        if (s.endsWith('rem')) {
            const n = parseFloat(s);
            if (Number.isNaN(n)) {
                return 0;
            }
            const rootPx = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
            return n * rootPx;
        }
        if (s.endsWith('px')) {
            const n = parseFloat(s);
            return Number.isNaN(n) ? 0 : n;
        }
        const n = parseFloat(s);
        return Number.isNaN(n) ? 0 : n;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FillEmptySpaceDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: FillEmptySpaceDirective, isStandalone: false, selector: "[fillEmptySpace]", inputs: { mode: "mode", containerDom: "containerDom", decrement: "decrement", disable: "disable", height: "height", dontUseTopBound: "dontUseTopBound", setMinHeight: "setMinHeight", setMaxHeight: "setMaxHeight" }, outputs: { heightChanged: "heightChanged" }, exportAs: ["fillEmptySpace"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FillEmptySpaceDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[fillEmptySpace]',
                    exportAs: 'fillEmptySpace',
                    standalone: false
                }]
        }], propDecorators: { mode: [{
                type: Input
            }], containerDom: [{
                type: Input
            }], decrement: [{
                type: Input
            }], disable: [{
                type: Input
            }], height: [{
                type: Input
            }], dontUseTopBound: [{
                type: Input
            }], setMinHeight: [{
                type: Input
            }], setMaxHeight: [{
                type: Input
            }], heightChanged: [{
                type: Output
            }] } });

class MasterDetailsPageComponent extends PageWithFormHandlerBaseComponent {
    constructor() {
        super(...arguments);
        this._position = null;
        this.sectionClass = true;
        this.ismodal = false;
        this.isinsideview = false;
        this._scrollLayoutContext = inject(ScrollLayoutContextHolder);
    }
    ngOnInit() {
        this._scrollLayoutContext.setMode('isolated');
        this.settings = BarsaApi.Common.Util.TryGetValue(this._activatedRoute, 'data._value.pageData.Component.Settings', null);
        const isModal = this.settings?.IsModal;
        if (isModal) {
            if (this._parentContainerService) {
                this._parentContainerService.detachParent = false;
            }
            else {
                this._log.error(nullOrUndefinedString('EmptyPageComponent=> _containerService'));
            }
            this._position = 'absolute';
            this.ismodal = true;
        }
        super.ngOnInit();
        this._routingService && (this._routingService.masterDetails = true);
        // if (!BarsaApi.LoginFormData.IsServiceDesk && !isModal) {
        //     this._position = 'initial';
        // }
        if (this._activatedRoute.snapshot.data?.pageData?.Component?.Settings?.IsRelativePage && !isModal) {
            this._position = 'initial';
        }
        const insdeideView = this._activatedRoute.snapshot.params.id;
        if (insdeideView && insdeideView.split('__').some((c) => c.startsWith('ulv'))) {
            this.isinsideview = true;
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        // add ngondestroy because to call routingservice ngondestroy.
        // if i dont add this ngondestroy in routingservice do not call.
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MasterDetailsPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: MasterDetailsPageComponent, isStandalone: false, selector: "bnrc-master-details-page", host: { properties: { "style.position": "this._position", "class.section": "this.sectionClass", "class.modal": "this.ismodal", "class.insideview": "this.isinsideview" } }, providers: [RoutingService, ContainerService, ScrollLayoutContextHolder], usesInheritance: true, ngImport: i0, template: `
        <div
            class="tw-flex tw-h-full tw-w-full tw-flex-col md:tw-flex-row tw-p-2"
            fillEmptySpace
            style="box-sizing: border-box;"
        >
            <!-- لیست -->
            <div class="tw-w-full md:tw-w-96 master">
                <ng-container #containerRef></ng-container>
            </div>
            <bnrc-splitter></bnrc-splitter>
            <!-- جزئیات -->
            <div
                class="fd-dynamic-page__content tw-flex tw-flex-1 tw-flex-col tw-h-full tw-min-h-0 tw-w-full md:tw-flex-1 
                !tw-overflow-hidden details tw-min-w-0 tw-p-0"
            >
                <router-outlet name="details"></router-outlet>
            </div>
        </div>
        <router-outlet></router-outlet>
        <router-outlet name="dialog"></router-outlet>
    `, isInline: true, styles: [":host{display:block;box-sizing:border-box}:host .fd-dynamic-page__content ::ng-deep bnrc-empty-page{flex:1 1 auto;min-height:0}\n"], dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: SplitterComponent, selector: "bnrc-splitter", inputs: ["minWidth", "maxWidth", "config", "elDom"], outputs: ["spliterResized"] }, { kind: "directive", type: FillEmptySpaceDirective, selector: "[fillEmptySpace]", inputs: ["mode", "containerDom", "decrement", "disable", "height", "dontUseTopBound", "setMinHeight", "setMaxHeight"], outputs: ["heightChanged"], exportAs: ["fillEmptySpace"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MasterDetailsPageComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-master-details-page', template: `
        <div
            class="tw-flex tw-h-full tw-w-full tw-flex-col md:tw-flex-row tw-p-2"
            fillEmptySpace
            style="box-sizing: border-box;"
        >
            <!-- لیست -->
            <div class="tw-w-full md:tw-w-96 master">
                <ng-container #containerRef></ng-container>
            </div>
            <bnrc-splitter></bnrc-splitter>
            <!-- جزئیات -->
            <div
                class="fd-dynamic-page__content tw-flex tw-flex-1 tw-flex-col tw-h-full tw-min-h-0 tw-w-full md:tw-flex-1 
                !tw-overflow-hidden details tw-min-w-0 tw-p-0"
            >
                <router-outlet name="details"></router-outlet>
            </div>
        </div>
        <router-outlet></router-outlet>
        <router-outlet name="dialog"></router-outlet>
    `, providers: [RoutingService, ContainerService, ScrollLayoutContextHolder], changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block;box-sizing:border-box}:host .fd-dynamic-page__content ::ng-deep bnrc-empty-page{flex:1 1 auto;min-height:0}\n"] }]
        }], propDecorators: { _position: [{
                type: HostBinding,
                args: ['style.position']
            }], sectionClass: [{
                type: HostBinding,
                args: ['class.section']
            }], ismodal: [{
                type: HostBinding,
                args: ['class.modal']
            }], isinsideview: [{
                type: HostBinding,
                args: ['class.insideview']
            }] } });

class PortalPageComponent extends PageWithFormHandlerBaseComponent {
    ngOnInit() {
        super.ngOnInit();
        this.addModulesToDom();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: PortalPageComponent, isStandalone: false, selector: "bnrc-portal-page", providers: [RoutingService], usesInheritance: true, ngImport: i0, template: `<ng-container #containerRef></ng-container> <router-outlet></router-outlet
        ><router-outlet name="dialog"></router-outlet>
        <ng-container #containerBottomRef></ng-container> `, isInline: true, styles: [":host{min-height:100svh}\n"], dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalPageComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-portal-page', template: `<ng-container #containerRef></ng-container> <router-outlet></router-outlet
        ><router-outlet name="dialog"></router-outlet>
        <ng-container #containerBottomRef></ng-container> `, changeDetection: ChangeDetectionStrategy.OnPush, providers: [RoutingService], standalone: false, styles: [":host{min-height:100svh}\n"] }]
        }] });

class PortalPageSidebarComponent extends PageBaseComponent {
    constructor() {
        super(...arguments);
        this._routingService = inject(RoutingService);
    }
    ngOnInit() {
        super.ngOnInit();
        this._routingService.isSidebar = true;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalPageSidebarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: PortalPageSidebarComponent, isStandalone: false, selector: "bnrc-portal-page-sidebar", providers: [RoutingService], usesInheritance: true, ngImport: i0, template: `<div class="page-sidebar-wrapper">
            <div class="sidebar" fillEmptySpace><ng-container #containerRef></ng-container></div>
            <div class="mainside"><router-outlet name="mainside"></router-outlet></div>
        </div>
        <router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: FillEmptySpaceDirective, selector: "[fillEmptySpace]", inputs: ["mode", "containerDom", "decrement", "disable", "height", "dontUseTopBound", "setMinHeight", "setMaxHeight"], outputs: ["heightChanged"], exportAs: ["fillEmptySpace"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalPageSidebarComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-portal-page-sidebar',
                    template: `<div class="page-sidebar-wrapper">
            <div class="sidebar" fillEmptySpace><ng-container #containerRef></ng-container></div>
            <div class="mainside"><router-outlet name="mainside"></router-outlet></div>
        </div>
        <router-outlet></router-outlet>`,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    providers: [RoutingService],
                    standalone: false
                }]
        }] });

class BaseDynamicComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.events = new EventEmitter();
        this._vcr = inject(ViewContainerRef);
        this._cdr = inject(ChangeDetectorRef);
        this._portalService = inject(PortalService);
        this._injector = inject(Injector);
    }
    async ngOnInit() {
        super.ngOnInit();
        if (!this._container) {
            this._container = this._vcr;
        }
        this._renderComponentInstance();
    }
    ngOnChanges(changes) {
        if (!this._component?.instance) {
            return;
        }
        // const changesKey = Object.keys(changes);
        // changesKey
        //     .filter((c) => !changes[c].firstChange)
        //     .forEach((c) => (this._component.instance[c] = changes[c].currentValue));
        this._component.instance.ngOnChanges(changes);
    }
    ngOnDestroy() {
        this._destroyComponentInstance();
    }
    async _renderComponentInstance() {
        this._destroyComponentInstance();
        if (!this.component) {
            return;
        }
        const { Module, ModuleFileName, Name, Selector } = this.component;
        this._portalService
            .getComponent(Module, ModuleFileName, Name, Selector, this._injector)
            .pipe(takeUntil$1(this._onDestroy$))
            .subscribe((componentRef) => {
            this._component = componentRef;
            if (this.component.Parameters) {
                this._component.instance.parameters = this.component.Parameters;
                this._component.instance.settings = this.component.Parameters;
            }
            else if (this.component.Settings) {
                this._component.instance.parameters = this.component.Settings;
                this._component.instance.settings = this.component.Settings;
            }
            if (this.value) {
                this._component.instance.value = this.value;
            }
            this.setComponentInputs();
            if (typeof this.FnHandleEvents === 'function') {
                this.FnHandleEvents(this._component.instance);
            }
            const events = this._component.instance.events;
            if (events) {
                events
                    .pipe(takeUntil$1(this._onDestroy$), tap$1((c) => this.events.emit(c)))
                    .subscribe();
            }
            this._container.insert(componentRef.hostView);
            this._cdr.detectChanges();
        });
        // this.setComponentInputs();
    }
    setOutput() { }
    setComponentInputs() {
        const inputProperties = Object.keys(this).filter((c) => !c.startsWith('_') && c !== 'events');
        inputProperties.forEach((key) => {
            const property = this._component.instance[key];
            if (property instanceof EventEmitter) {
                property.pipe(takeUntil$1(this._onDestroy$)).subscribe((e) => {
                    this[key].emit(e);
                });
            }
            else {
                this._component.instance[key] = this[key];
            }
        });
    }
    _destroyComponentInstance() {
        if (this._component) {
            this._component.destroy();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseDynamicComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseDynamicComponent, isStandalone: false, selector: "bnrc-dynamic-component", inputs: { component: "component", FnHandleEvents: "FnHandleEvents", value: "value" }, outputs: { events: "events" }, viewQueries: [{ propertyName: "_container", first: true, predicate: ["componentContainer"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<ng-container #componentContainer></ng-container>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseDynamicComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-dynamic-component',
                    template: `<ng-container #componentContainer></ng-container>`,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { _container: [{
                type: ViewChild,
                args: ['componentContainer', { read: ViewContainerRef, static: true }]
            }], component: [{
                type: Input
            }], FnHandleEvents: [{
                type: Input
            }], value: [{
                type: Input
            }], events: [{
                type: Output
            }] } });

class DynamicFormComponent extends BaseDynamicComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: DynamicFormComponent, isStandalone: false, selector: "bnrc-dynamic-form-component", inputs: { breadCrumbs: "breadCrumbs", toolbarVisible: "toolbarVisible", toolbarItems: "toolbarItems", layoutActions: "layoutActions", layoutActionsTemplateRef: "layoutActionsTemplateRef", workflowButtons: "workflowButtons", layout94: "layout94", footerDesign: "footerDesign", settings: "settings", workflowPanelUi: "workflowPanelUi", title: "title", subtitle: "subtitle", description: "description", facetList: "facetList", removeHeaderBorder: "removeHeaderBorder", removeContentPadding: "removeContentPadding", isMobile: "isMobile", avatar: "avatar", rtl: "rtl", mask: "mask", mo: "mo", contentDensity: "contentDensity", deviceSize: "deviceSize", dirValue: "dirValue", fieldDict: "fieldDict", modernTabs: "modernTabs" }, usesInheritance: true, ngImport: i0, template: `<ng-container #componentContainer></ng-container>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicFormComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-dynamic-form-component',
                    template: `<ng-container #componentContainer></ng-container>`,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { breadCrumbs: [{
                type: Input
            }], toolbarVisible: [{
                type: Input
            }], toolbarItems: [{
                type: Input
            }], layoutActions: [{
                type: Input
            }], layoutActionsTemplateRef: [{
                type: Input
            }], workflowButtons: [{
                type: Input
            }], layout94: [{
                type: Input
            }], footerDesign: [{
                type: Input
            }], settings: [{
                type: Input
            }], workflowPanelUi: [{
                type: Input
            }], title: [{
                type: Input
            }], subtitle: [{
                type: Input
            }], description: [{
                type: Input
            }], facetList: [{
                type: Input
            }], removeHeaderBorder: [{
                type: Input
            }], removeContentPadding: [{
                type: Input
            }], isMobile: [{
                type: Input
            }], avatar: [{
                type: Input
            }], rtl: [{
                type: Input
            }], mask: [{
                type: Input
            }], mo: [{
                type: Input
            }], contentDensity: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], dirValue: [{
                type: Input
            }], fieldDict: [{
                type: Input
            }], modernTabs: [{
                type: Input
            }] } });

class DynamicItemComponent extends BaseDynamicComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: DynamicItemComponent, isStandalone: false, selector: "bnrc-dynamic-item-component", inputs: { mo: "mo", allColumns: "allColumns", moDataList: "moDataList", columns: "columns", column: "column", index: "index", last: "last", hideOpenIcon: "hideOpenIcon", deviceName: "deviceName", deviceSize: "deviceSize", rtl: "rtl", editMode: "editMode", setting: "setting", parameters: "parameters", contextMenuItems: "contextMenuItems", canView: "canView", showRowNumber: "showRowNumber", rowNumber: "rowNumber", formSetting: "formSetting", conditionalFormats: "conditionalFormats", disableOverflowContextMenu: "disableOverflowContextMenu", navigationArrow: "navigationArrow", isCheckList: "isCheckList", maxHeightHeader: "maxHeightHeader", fields: "fields", isChecked: "isChecked", layout94$: "layout94$", inlineEditMode: "inlineEditMode", isNewInlineMo: "isNewInlineMo", allowInlineEdit: "allowInlineEdit", typeDefId: "typeDefId", rowIndicator: "rowIndicator", rowIndicatorColor: "rowIndicatorColor", UlvMainCtrlr: "UlvMainCtrlr" }, usesInheritance: true, ngImport: i0, template: `<ng-container #componentContainer></ng-container>`, isInline: true, styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicItemComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-dynamic-item-component', template: `<ng-container #componentContainer></ng-container>`, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:contents}\n"] }]
        }], propDecorators: { mo: [{
                type: Input
            }], allColumns: [{
                type: Input
            }], moDataList: [{
                type: Input
            }], columns: [{
                type: Input
            }], column: [{
                type: Input
            }], index: [{
                type: Input
            }], last: [{
                type: Input
            }], hideOpenIcon: [{
                type: Input
            }], deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], rtl: [{
                type: Input
            }], editMode: [{
                type: Input
            }], setting: [{
                type: Input
            }], parameters: [{
                type: Input
            }], contextMenuItems: [{
                type: Input
            }], canView: [{
                type: Input
            }], showRowNumber: [{
                type: Input
            }], rowNumber: [{
                type: Input
            }], formSetting: [{
                type: Input
            }], conditionalFormats: [{
                type: Input
            }], disableOverflowContextMenu: [{
                type: Input
            }], navigationArrow: [{
                type: Input
            }], isCheckList: [{
                type: Input
            }], maxHeightHeader: [{
                type: Input
            }], fields: [{
                type: Input
            }], isChecked: [{
                type: Input
            }], layout94$: [{
                type: Input
            }], inlineEditMode: [{
                type: Input
            }], isNewInlineMo: [{
                type: Input
            }], allowInlineEdit: [{
                type: Input
            }], typeDefId: [{
                type: Input
            }], rowIndicator: [{
                type: Input
            }], rowIndicatorColor: [{
                type: Input
            }], UlvMainCtrlr: [{
                type: Input
            }] } });

class CardDynamicItemComponent extends DynamicItemComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardDynamicItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: CardDynamicItemComponent, isStandalone: false, selector: "bnrc-card-dynamic-item-component", inputs: { columnTemplate: "columnTemplate", extendedHeaderTemplate: "extendedHeaderTemplate" }, usesInheritance: true, ngImport: i0, template: `<ng-container #componentContainer></ng-container>`, isInline: true, styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardDynamicItemComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-card-dynamic-item-component', template: `<ng-container #componentContainer></ng-container>`, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:contents}\n"] }]
        }], propDecorators: { columnTemplate: [{
                type: Input
            }], extendedHeaderTemplate: [{
                type: Input
            }] } });

class BaseViewPropsComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.rowActivable = true;
        this.rtl = true;
        this.resetWorkflowState = new EventEmitter();
        this.deselectAll = new EventEmitter();
        this.escapeKey = new EventEmitter();
        this.rowCheck = new EventEmitter();
        this.workflowShareButtons = new EventEmitter();
        this.rowClick = new EventEmitter();
        this.ulvCommand = new EventEmitter();
        this.editFormPanelCancel = new EventEmitter();
        this.editFormPanelSave = new EventEmitter();
        this.selectNextInlineRecord = new EventEmitter();
        this.action = new EventEmitter();
        this.expandClick = new EventEmitter();
        this.editFormPanelValueChange = new EventEmitter();
        this.cartableFormClosed = new EventEmitter();
    }
    _trackByRow(index, row) {
        return `${row.$Group ? row.$Group : row.Id}${index}`;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseViewPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseViewPropsComponent, isStandalone: false, selector: "bnrc-base-view-props", inputs: { detailsComponent: "detailsComponent", detailsColumns: "detailsColumns", detailsText: "detailsText", detailsTextFunction: "detailsTextFunction", moDataList: "moDataList", reportId: "reportId", allColumns: "allColumns", hideOpenIcon: "hideOpenIcon", isCheckList: "isCheckList", allChecked: "allChecked", canView: "canView", visibility: "visibility", level: "level", expanded: "expanded", styleIndex: "styleIndex", parentExpanded: "parentExpanded", access: "access", groupby: "groupby", UlvMainCtrlr: "UlvMainCtrlr", conditionalFormats: "conditionalFormats", deviceName: "deviceName", deviceSize: "deviceSize", contextMenuItems: "contextMenuItems", columns: "columns", allowInlineEdit: "allowInlineEdit", secondaryColumns: "secondaryColumns", popin: "popin", typeDefId: "typeDefId", columnsCount: "columnsCount", mobileOrTablet: "mobileOrTablet", containerWidth: "containerWidth", newInlineEditMo: "newInlineEditMo", inlineEditMode: "inlineEditMode", onlyInlineEdit: "onlyInlineEdit", rowHoverable: "rowHoverable", openOnClick: "openOnClick", tlbButtons: "tlbButtons", setting: "setting", parameters: "parameters", formSetting: "formSetting", disableOverflowContextMenu: "disableOverflowContextMenu", rowActivable: "rowActivable", contentDensity: "contentDensity", rtl: "rtl", showOkCancelButtons: "showOkCancelButtons", title: "title", isChecked: "isChecked", navigationArrow: "navigationArrow" }, outputs: { resetWorkflowState: "resetWorkflowState", deselectAll: "deselectAll", escapeKey: "escapeKey", rowCheck: "rowCheck", workflowShareButtons: "workflowShareButtons", rowClick: "rowClick", ulvCommand: "ulvCommand", editFormPanelCancel: "editFormPanelCancel", editFormPanelSave: "editFormPanelSave", selectNextInlineRecord: "selectNextInlineRecord", action: "action", expandClick: "expandClick", editFormPanelValueChange: "editFormPanelValueChange", cartableFormClosed: "cartableFormClosed" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseViewPropsComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-base-view-props',
                    template: ``,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { detailsComponent: [{
                type: Input
            }], detailsColumns: [{
                type: Input
            }], detailsText: [{
                type: Input
            }], detailsTextFunction: [{
                type: Input
            }], moDataList: [{
                type: Input
            }], reportId: [{
                type: Input
            }], allColumns: [{
                type: Input
            }], hideOpenIcon: [{
                type: Input
            }], isCheckList: [{
                type: Input
            }], allChecked: [{
                type: Input
            }], canView: [{
                type: Input
            }], visibility: [{
                type: Input
            }], level: [{
                type: Input
            }], expanded: [{
                type: Input
            }], styleIndex: [{
                type: Input
            }], parentExpanded: [{
                type: Input
            }], access: [{
                type: Input
            }], groupby: [{
                type: Input
            }], UlvMainCtrlr: [{
                type: Input
            }], conditionalFormats: [{
                type: Input
            }], deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], contextMenuItems: [{
                type: Input
            }], columns: [{
                type: Input
            }], allowInlineEdit: [{
                type: Input
            }], secondaryColumns: [{
                type: Input
            }], popin: [{
                type: Input
            }], typeDefId: [{
                type: Input
            }], columnsCount: [{
                type: Input
            }], mobileOrTablet: [{
                type: Input
            }], containerWidth: [{
                type: Input
            }], newInlineEditMo: [{
                type: Input
            }], inlineEditMode: [{
                type: Input
            }], onlyInlineEdit: [{
                type: Input
            }], rowHoverable: [{
                type: Input
            }], openOnClick: [{
                type: Input
            }], tlbButtons: [{
                type: Input
            }], setting: [{
                type: Input
            }], parameters: [{
                type: Input
            }], formSetting: [{
                type: Input
            }], disableOverflowContextMenu: [{
                type: Input
            }], rowActivable: [{
                type: Input
            }], contentDensity: [{
                type: Input
            }], rtl: [{
                type: Input
            }], showOkCancelButtons: [{
                type: Input
            }], title: [{
                type: Input
            }], isChecked: [{
                type: Input
            }], navigationArrow: [{
                type: Input
            }], resetWorkflowState: [{
                type: Output
            }], deselectAll: [{
                type: Output
            }], escapeKey: [{
                type: Output
            }], rowCheck: [{
                type: Output
            }], workflowShareButtons: [{
                type: Output
            }], rowClick: [{
                type: Output
            }], ulvCommand: [{
                type: Output
            }], editFormPanelCancel: [{
                type: Output
            }], editFormPanelSave: [{
                type: Output
            }], selectNextInlineRecord: [{
                type: Output
            }], action: [{
                type: Output
            }], expandClick: [{
                type: Output
            }], editFormPanelValueChange: [{
                type: Output
            }], cartableFormClosed: [{
                type: Output
            }] } });

class BaseViewContentPropsComponent extends BaseViewPropsComponent {
    constructor() {
        super(...arguments);
        this.actionListClick = new EventEmitter();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseViewContentPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseViewContentPropsComponent, isStandalone: false, selector: "bnrc-base-view-content-props", inputs: { moDataList: "moDataList", maxHeightHeader: "maxHeightHeader", setting: "setting" }, outputs: { actionListClick: "actionListClick" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseViewContentPropsComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-base-view-content-props',
                    template: ``,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { moDataList: [{
                type: Input
            }], maxHeightHeader: [{
                type: Input
            }], setting: [{
                type: Input
            }], actionListClick: [{
                type: Output
            }] } });

class BaseViewItemPropsComponent extends BaseViewPropsComponent {
    set serializedRelatedMo(val) {
        this._serializedRelatedMo = val;
        this._updateCartableMo(val);
        this._createCartableParams();
    }
    set cartableTemplate(val) {
        this._cartableTemplate = val;
        this._createCartableParams();
    }
    set cartableMo(val) {
        this._cartableMo = val;
        this._updateCartableMo(this._serializedRelatedMo);
        this._createCartableParams();
    }
    set cartableWorkflowData(val) {
        this._cartableWorkflowData = val;
        this._createCartableParams();
    }
    constructor() {
        super();
        this.actionListClick = new EventEmitter();
        this.events = new EventEmitter();
        this.hasError = false;
        this._focusToFirstEidtableColumn = false;
        this.inlineEditInReport = true;
        this.rewriteLayout = true;
        this.hasCartableTemplate = false;
        this.workflowState = signal(null);
        this.bruleActionMessage = signal(null);
        this.activeColumn = signal(undefined);
        this._domSanitizer = inject(DomSanitizer);
        this._cdr = inject(ChangeDetectorRef);
        this._reportValuePipe = inject(MoReportValuePipe);
        this._parentFormPanelService = inject(FormPanelService, { optional: true, skipSelf: true });
        this._formPanelService = inject(FormPanelService, { optional: true, self: true });
        this._ulvMainService = inject(UlvMainService, { optional: true });
        this._saveEditedMo$ = new Subject();
        this._formpanelValueChanged$ = new Subject();
        this._saveEditedMo$
            .asObservable()
            .pipe(takeUntil$1(this._onDestroy$), 
        // debounceTime(500),
        exhaustMap((reason) => this._inlineEditSaveFormPanel(reason)), catchError$1((err) => throwError(() => err)))
            .subscribe((res) => {
            if (res.saved) {
                this.mo.$IsChecked = false;
                this.editFormPanelValueChange.emit({ mo: this.mo, fieldDbName: '$InlineMoState' });
                // this._formpanelValueChanged$.next('');
                this._cdr.markForCheck();
                !this.hasError && (this.mo.$InlineMoState = RowState.Clean);
                this.hasError && (this.mo.$InlineMoState = RowState.SaveFailed);
                this.editFormPanelValueChange.emit({ mo: this.mo });
            }
            if (res.reason === 'TAB' || res.reason === 'CTRL+ENTER') {
                this.selectNextInlineRecord.emit(this.mo);
            }
            else if (res.reason === 'ESC') {
                this.editFormPanelCancel.emit(this.mo);
                this.mo.$InlineMoState = RowState.Clean;
            }
        });
        this._formpanelValueChanged$
            .asObservable()
            .pipe(takeUntil$1(this._onDestroy$), 
        // switchMap(() => this._syncMo()),
        tap$1((_) => this._syncMo()), tap$1((_) => {
            if (typeof this.mo.$InlineMoChanged === 'undefined') {
                this.mo.$InlineMoChanged = true;
                this.mo.$InlineMoState = RowState.Dirty;
            }
        }))
            .subscribe((c) => {
            c && (this.mo.$InlineMoState = RowState.Dirty);
            this.editFormPanelValueChange.emit({ mo: this.mo, fieldDbName: c });
        });
    }
    get _hasFormPanelService() {
        return this._formPanelService !== null && this.formSetting;
    }
    ngOnInit() {
        super.ngOnInit();
        if (this._hasFormPanelService) {
            if (this._formPanelService) {
                this._formPanelService.context$.pipe(takeUntil$1(this._onDestroy$)).subscribe();
                this._formPanelService.view$.pipe(takeUntil$1(this._onDestroy$)).subscribe();
                this.layout$ = this._formPanelService.layout$;
                if (this.inlineEditWithoutSelection) {
                    this._loadAndCreateFormPanelCtrlr();
                }
            }
            else {
                this._log.error(nullOrUndefinedString('BaseViewItemPropsComponent=> _formPanelService'));
            }
        }
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { isChecked, inlineEditMode } = changes;
        let needToLoadForm = false;
        if (this.inlineEditMode) {
            if (isChecked) {
                if (!isChecked.currentValue && isChecked.previousValue) {
                    if (this._needToSave()) {
                        this._saveEditedMo$.next('CHECK_CHANGED');
                    }
                }
                else if (isChecked.currentValue) {
                    needToLoadForm = true;
                }
            }
        }
        if (isChecked && !isChecked.firstChange) {
            this._raiseWorkflowShareButtons(isChecked.currentValue);
        }
        if (inlineEditMode?.currentValue && !inlineEditMode?.previousValue && this.isChecked) {
            needToLoadForm = true;
        }
        else if (!inlineEditMode?.currentValue && inlineEditMode?.previousValue && this.isChecked) {
            this._saveEditedMo$.next('ESC');
        }
        if (needToLoadForm && !this.inlineEditWithoutSelection) {
            this._loadAndCreateFormPanelCtrlr();
        }
        if (changes.mo && !changes.mo.firstChange && this.inlineEditMode) {
            if (this._formPanelLoaded) {
                this.formPanelCtrlr.SetValue(changes.mo.currentValue);
            }
        }
        // if (mo && !mo.firstChange && this._hasFormPanelService && this.isChecked && this.inlineEditMode) {
        //     //this.formPanelCtrlr.SetValue(changes.mo.currentValue);
        // }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        if (this.formPanelCtrlr) {
            this.formPanelCtrlr.un('bruleShowMessageAction', this._handleBruleShowMessageAction);
        }
    }
    OnCartableFormClick(e) {
        if (this.isChecked) {
            e.preventDefault();
            e.stopPropagation();
        }
    }
    onLongPress() {
        if (this.inlineEditMode && this.allowInlineEdit) {
            return;
        }
        if (!this._ulvMainService?.openOneClick) {
            this._ulvMainService?.setIsMultiSelect(true);
        }
    }
    onRowCheck(onlyCheck) {
        this._rowCheck(onlyCheck);
    }
    onRowClick() {
        this.rowClick.emit({ mo: this.mo, index: this.index });
    }
    onColumnChangeToEditMode(elDom, index) {
        const focusables = elDom.querySelectorAll(getFocusableTagNames());
        this._lastEditableColumnIndex = index;
        if (!focusables.length || this._focusToFirstEidtableColumn) {
            return;
        }
        this._focusToFirstEidtableColumn = true;
        const lastFocusable = focusables[0];
        setTimeout(() => {
            lastFocusable?.focus();
        }, 0);
    }
    onTabKeyDown(e, index) {
        if (index === this._lastEditableColumnIndex) {
            if (this.index === this.moDataList.length - 1) {
                PreventDefaulEvent(e);
            }
            this._saveEditedMo$.next('TAB');
        }
    }
    onEditFormPanelSave(_) {
        this._saveEditedMo$.next('CTRL+ENTER');
    }
    onEditFormPanelCancel(_) {
        this.escapeKey.emit(this.mo);
    }
    onUlvCommand() {
        this.ulvCommand.emit({ mo: this.mo, index: this.index });
    }
    onAction(commandBody) {
        this.action.emit(commandBody);
    }
    onExpandClick() {
        this.expandClick.emit(this.mo);
    }
    onDynamicComponentEvents(e) {
        switch (e.title) {
            case 'rowCheck':
                this.onRowCheck();
                break;
            case 'rowClick':
                this.onRowClick();
                break;
            case 'ulvCommand':
                this.onUlvCommand();
                break;
        }
    }
    onCartableFormClosed() {
        this.cartableFormClosed.emit({ mo: this.mo, index: this.index });
    }
    onCartableBruleAction(bruleAction) {
        this._handleBruleShowMessageAction(bruleAction);
    }
    onCartableAfterTansition(e) {
        this.workflowState.set({
            error: this.bruleActionMessage() ? this.bruleActionMessage() : e.error,
            state: 'Finish'
        });
    }
    onCartableBeforeTansition() {
        this.workflowState.set({ state: 'Pending', error: null });
    }
    onResetWorkflowState() {
        this._handleResetWorkflowState();
    }
    _trackByColumn(index, column) {
        return `${column.Name}${index}`;
    }
    _handleResetWorkflowState() {
        this._resetBruleActionMessage();
        this.workflowState.set({ state: '', error: null });
    }
    _resetBruleActionMessage() {
        this.bruleActionMessage.set(null);
    }
    _updateCartableMo(serializeMo) {
        if (serializeMo && this._cartableMo) {
            serializeMo = `${serializeMo}`;
            const mo = BarsaApi.Ext.decode(serializeMo);
            this._cartableMo = { ...this._cartableMo, ...mo };
        }
    }
    _createCartableParams() {
        let cartableTemplate = this._cartableTemplate;
        const cartableMo = this._cartableMo;
        const cartableWorkflowData = this._cartableWorkflowData;
        if (this.hasCartableTemplate) {
            // TODO update cartable mo;
            return;
        }
        if (cartableTemplate &&
            cartableMo &&
            typeof cartableWorkflowData !== 'undefined' &&
            this._serializedRelatedMo) {
            cartableTemplate = JSON.parse(JSON.stringify(cartableTemplate));
            const view = cartableTemplate.View;
            cartableTemplate.Data = { Mo: { ...cartableMo } };
            cartableTemplate.Workflow = cartableWorkflowData === '' ? null : JSON.parse(cartableWorkflowData);
            if (!view.ExtraJsonProp) {
                view.ExtraJsonProp = {};
            }
            view.ExtraJsonProp.IsSimple = true;
            this.cartableParams = {
                formSetting: cartableTemplate,
                moId: cartableMo.Id,
                typeDefId: cartableMo.$TypeDefId,
                viewId: view.TypeViewId,
                inDialog: false,
                loadActivityView: true
            };
            this.hasCartableTemplate = true;
            this._cdr.markForCheck();
        }
    }
    _needToSave() {
        // if (!this.isChecked) {
        //     return false;
        // }
        // const isChildNode = (this._el.nativeElement as HTMLElement).contains(e.target);
        // if (isChildNode) {
        //     return false;
        // }
        const t = this.inlineEditMode && this._hasFormPanelService;
        if (!t) {
            return false;
        }
        return this.formPanelCtrlr && this.formPanelCtrlr.IsMoChanged();
    }
    _checkfocusOutFromRow(_target) {
        // const focusable: NodeList = this._focusableControls;
        // let foundInFocusable = false;
        // focusable.forEach((c) => {
        //     if (c === target) {
        //         foundInFocusable = true;
        //     }
        // });
        // if (!foundInFocusable) {
        //     this._saveEditedMo$.next('TAB');
        // }
    }
    _rowCheck(onlyCheck) {
        this.rowCheck.emit({ mo: this.mo, index: this.index, onlyCheck });
    }
    _raiseWorkflowShareButtons(isChecked) {
        if (this.cartableParams) {
            const choiceList = this.cartableParams.formSetting?.Workflow?.ChoiceList;
            if (choiceList?.length) {
                setTimeout(() => {
                    this.workflowShareButtons.emit({
                        formPanelCtrlr: this._cartableFormRef.formPanelCtrl,
                        mo: this.mo,
                        choiceList,
                        add: isChecked
                    });
                });
            }
        }
    }
    _handleValueChange(_formPanelCtrl, fieldCtrlr) {
        if (!this.isChecked) {
            this.onRowCheck();
        }
        this._formpanelValueChanged$.next(fieldCtrlr?.Setting?.ControlName);
    }
    _syncMo() {
        const syncWithFormpanelMo = this.mo;
        const _isChecked = this.mo.$IsChecked;
        const formPanelCtrlrMo = this.formPanelCtrlr.Mo;
        this._updateWithOriginalValues(formPanelCtrlrMo, syncWithFormpanelMo);
        syncWithFormpanelMo['$OriginalValues'] = formPanelCtrlrMo['$OriginalValues'];
        syncWithFormpanelMo['$FieldDict'] = formPanelCtrlrMo['$FieldDict'];
        syncWithFormpanelMo['$State'] = formPanelCtrlrMo['$State']; // this add because if we edit unchanged mo it does not reflect to mo of ulv.
        this.mo = this._getMoWithoutWrapper(syncWithFormpanelMo);
        this.mo.$IsChecked = _isChecked;
        return from(Promise.resolve());
    }
    _getMoWithoutWrapper(syncWithFormpanelMo) {
        // eslint-disable-next-line no-unused-vars
        const { $Wrapper: _Wrapper, ...x } = syncWithFormpanelMo;
        return x;
    }
    _updateWithOriginalValues(source, dest) {
        Object.keys(source.$OriginalValues).forEach((c) => {
            dest[c] = source[c];
            if (source[c + '$Caption']) {
                dest[c + '$Caption'] = source[c + '$Caption'];
            }
            if (source[c + '$Icon']) {
                dest[c + '$Icon'] = source[c + '$Icon'];
            }
        });
    }
    _raiseFormPanelValueChanged() {
        this.editFormPanelValueChange.emit({ mo: this.mo });
    }
    _handleBruleShowMessageAction(action) {
        action.MessageExpressionHtml = this._domSanitizer.bypassSecurityTrustHtml(action.MessageExpression);
        this.bruleActionMessage.set(action);
    }
    _createFormPanelCtrlr(mo, typeDefId) {
        if (!this.formPanelCtrlr) {
            this.formPanelCtrlr = createGridEditorFormPanel(this.formSetting, { ...this._getMoWithoutWrapper(mo) }, typeDefId, this.extraRelation, this.rewriteLayout, this.UlvMainCtrlr
            // BarsaApi.Common.Util.TryGetValue(this.context.Setting, 'Extra.Relation')
            );
        }
        this.formPanelCtrlr.InlineEditInReport = true;
        this.formPanelCtrlr.on({
            bruleShowMessageAction: this._handleBruleShowMessageAction.bind(this),
            valueChange: this._handleValueChange.bind(this)
        });
        return this.formPanelCtrlr;
    }
    _loadAndCreateFormPanelCtrlr() {
        const formSettingData = this.formSetting.Data;
        const formMo = {
            ...this.mo,
            $FieldDict: formSettingData.Mo.$FieldDict,
            $TypeDefId: formSettingData.Mo.$TypeDefId,
            $OriginalValues: this.extraRelation?.RelationType === 'Composition' ? this.mo.$OriginalValues || {} : {}
        };
        if (this._formPanelLoaded) {
            this.formPanelCtrlr.SetValue(formMo);
            return;
        }
        this._createFormPanelCtrlr(formMo, this.typeDefId);
        this._formPanelLoaded = true;
        const formPanelCtrlr = this.formPanelCtrlr;
        this.formPanelCtrlr.UlvMoDataListCount = this.moDataListCount - 1;
        formPanelCtrlr.LoadAndCreate(null, false, false, () => {
            const customFormPanelUi = formPanelCtrlr.Adapter.Control;
            const parentMo = this._parentFormPanelService ? this._parentFormPanelService.mo : null;
            if (this.extraRelation && parentMo && this.extraRelation.RelationType === 'Composition') {
                formPanelCtrlr.Mo.SetFValue(this.extraRelation.ParentFdName, parentMo);
                // newFormSettings.Data.Mo[relation.ParentFdName] = parentMo.GetChangedObject();
                // newFormSettings.Data.Mo[relation.ParentFdName].$State = parentMo.$State;
            }
            customFormPanelUi.Refresh = () => { };
            if (this._formPanelService) {
                this._formPanelService.context = formPanelCtrlr.Adapter.Control;
            }
            else {
                this._log.error(nullOrUndefinedString('BaseViewItemPropsComponent=> _formPanelService'));
            }
        });
    }
    _resetSavingStates() {
        this.hasError = false;
        this._resetBruleActionMessage();
        this.saved = false;
        this._cdr.markForCheck();
    }
    _setSavingState(err) {
        if (err) {
            this.hasError = true;
            this._handleBruleShowMessageAction({
                MessageExpression: err.Text,
                MessageType: 2,
                MessageExpressionHtml: err.Text,
                EscapeCharacters: true
            });
            return;
        }
        this.hasError = false;
        this.saved = true;
    }
    _inlineEditSaveFormPanel(reason) {
        return new Promise((resolve, _reject) => {
            if (!this.formPanelCtrlr.IsMoChanged() && this.formPanelCtrlr.Mo.GetState() !== 'New') {
                // if state of mo is new or modidfied then it needs to update
                resolve({ reason, succeed: true, saved: false });
                return;
            }
            const formPanelCtrlrMo = this.formPanelCtrlr.Mo;
            delete formPanelCtrlrMo.json;
            // this.saving = true;
            this.mo.$InlineMoChanged = false;
            this.editFormPanelSave.emit(this.mo);
            this._resetBruleActionMessage();
            if (this.noSaveInlineEditInServer) {
                resolve({ reason, succeed: true, saved: true });
                return;
            }
            this.formPanelCtrlr.Save(false, (err) => {
                // this.saving = false;
                if (err instanceof BarsaApi.Common.SilentException) {
                    resolve({ reason: 'NONE', succeed: true, saved: true });
                    return;
                }
                this.formPanelCtrlr.SetIsChanged(false);
                this._setSavingState(err);
                resolve({ reason, succeed: true, saved: true });
            });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseViewItemPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseViewItemPropsComponent, isStandalone: false, selector: "bnrc-base-view-item-props", inputs: { checkboxComponent: "checkboxComponent", disableEllapsis: "disableEllapsis", isslider: "isslider", attachmentViewType: "attachmentViewType", dirtyColumns: "dirtyColumns", contextMenuOverflowText: "contextMenuOverflowText", detailsComponent: "detailsComponent", detailsColumns: "detailsColumns", detailsText: "detailsText", mo: "mo", moDataListCount: "moDataListCount", index: "index", last: "last", hideHeader: "hideHeader", isdirty: "isdirty", isChecked: "isChecked", hideDetailsText: "hideDetailsText", showViewButton: "showViewButton", isNewInlineMo: "isNewInlineMo", extraRelation: "extraRelation", hideOpenIcon: "hideOpenIcon", inlineEditWithoutSelection: "inlineEditWithoutSelection", inDialog: "inDialog", isMobile: "isMobile", isMultiSelect: "isMultiSelect", rowIndicator: "rowIndicator", groupSummary: "groupSummary", isLastChildGroup: "isLastChildGroup", showRowNumber: "showRowNumber", rowNumber: "rowNumber", coloringRow: "coloringRow", noSaveInlineEditInServer: "noSaveInlineEditInServer", rowIndicatorColor: "rowIndicatorColor", maxHeightHeader: "maxHeightHeader", UlvMainCtrlr: "UlvMainCtrlr", fieldDict: "fieldDict", actionList: "actionList", serializedRelatedMo: "serializedRelatedMo", cartableTemplate: "cartableTemplate", cartableMo: "cartableMo", cartableWorkflowData: "cartableWorkflowData" }, outputs: { actionListClick: "actionListClick", events: "events" }, viewQueries: [{ propertyName: "_cartableFormRef", first: true, predicate: ["cartableFormRef"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseViewItemPropsComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-base-view-item-props',
                    template: ``,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { actionListClick: [{
                type: Output
            }], events: [{
                type: Output
            }], _cartableFormRef: [{
                type: ViewChild,
                args: ['cartableFormRef', { static: false }]
            }], checkboxComponent: [{
                type: Input
            }], disableEllapsis: [{
                type: Input
            }], isslider: [{
                type: Input
            }], attachmentViewType: [{
                type: Input
            }], dirtyColumns: [{
                type: Input
            }], contextMenuOverflowText: [{
                type: Input
            }], detailsComponent: [{
                type: Input
            }], detailsColumns: [{
                type: Input
            }], detailsText: [{
                type: Input
            }], mo: [{
                type: Input
            }], moDataListCount: [{
                type: Input
            }], index: [{
                type: Input
            }], last: [{
                type: Input
            }], hideHeader: [{
                type: Input
            }], isdirty: [{
                type: Input
            }], isChecked: [{
                type: Input
            }], hideDetailsText: [{
                type: Input
            }], showViewButton: [{
                type: Input
            }], isNewInlineMo: [{
                type: Input
            }], extraRelation: [{
                type: Input
            }], hideOpenIcon: [{
                type: Input
            }], inlineEditWithoutSelection: [{
                type: Input
            }], inDialog: [{
                type: Input
            }], isMobile: [{
                type: Input
            }], isMultiSelect: [{
                type: Input
            }], rowIndicator: [{
                type: Input
            }], groupSummary: [{
                type: Input
            }], isLastChildGroup: [{
                type: Input
            }], showRowNumber: [{
                type: Input
            }], rowNumber: [{
                type: Input
            }], coloringRow: [{
                type: Input
            }], noSaveInlineEditInServer: [{
                type: Input
            }], rowIndicatorColor: [{
                type: Input
            }], maxHeightHeader: [{
                type: Input
            }], UlvMainCtrlr: [{
                type: Input
            }], fieldDict: [{
                type: Input
            }], actionList: [{
                type: Input
            }], serializedRelatedMo: [{
                type: Input
            }], cartableTemplate: [{
                type: Input
            }], cartableMo: [{
                type: Input
            }], cartableWorkflowData: [{
                type: Input
            }] } });
var RowState;
(function (RowState) {
    RowState[RowState["Clean"] = 0] = "Clean";
    RowState[RowState["Dirty"] = 1] = "Dirty";
    RowState[RowState["Saving"] = 2] = "Saving";
    RowState[RowState["Invalid"] = 3] = "Invalid";
    RowState[RowState["SaveFailed"] = 4] = "SaveFailed";
})(RowState || (RowState = {}));

class BaseItemContentPropsComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.events = new EventEmitter();
        this._rval = inject(MoReportValuePipe);
        this._findColumnPipe = inject(FindColumnByDbNamePipe);
        this._cdr = inject(ChangeDetectorRef);
        this._el = inject(ElementRef);
        this._renderer2 = inject(Renderer2);
        this._ulvMainService = inject(UlvMainService);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        let detectChanges = false;
        Object.keys(changes).forEach((key) => {
            if (!changes[key].firstChange) {
                this[key] = changes[key].currentValue;
                detectChanges = true;
            }
        });
        if (detectChanges) {
            this.detectChanges();
        }
    }
    detectChanges() {
        this._cdr.detectChanges();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseItemContentPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseItemContentPropsComponent, isStandalone: false, selector: "bnrc-base-item-content-props", inputs: { mo: "mo", allColumns: "allColumns", column: "column", index: "index", styleIndex: "styleIndex", deviceName: "deviceName", deviceSize: "deviceSize", rtl: "rtl", editMode: "editMode", setting: "setting", parameters: "parameters", contextMenuItems: "contextMenuItems", canView: "canView", conditionalFormats: "conditionalFormats", disableOverflowContextMenu: "disableOverflowContextMenu", navigationArrow: "navigationArrow", isCheckList: "isCheckList", fields: "fields", isChecked: "isChecked", hideOpenIcon: "hideOpenIcon", layout94$: "layout94$", inlineEditMode: "inlineEditMode", allowInlineEdit: "allowInlineEdit", isNewInlineMo: "isNewInlineMo", formSetting: "formSetting", typeDefId: "typeDefId", maxHeightHeader: "maxHeightHeader", UlvMainCtrlr: "UlvMainCtrlr" }, outputs: { events: "events" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseItemContentPropsComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-base-item-content-props',
                    template: ``,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { events: [{
                type: Output
            }], mo: [{
                type: Input
            }], allColumns: [{
                type: Input
            }], column: [{
                type: Input
            }], index: [{
                type: Input
            }], styleIndex: [{
                type: Input
            }], deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], rtl: [{
                type: Input
            }], editMode: [{
                type: Input
            }], setting: [{
                type: Input
            }], parameters: [{
                type: Input
            }], contextMenuItems: [{
                type: Input
            }], canView: [{
                type: Input
            }], conditionalFormats: [{
                type: Input
            }], disableOverflowContextMenu: [{
                type: Input
            }], navigationArrow: [{
                type: Input
            }], isCheckList: [{
                type: Input
            }], fields: [{
                type: Input
            }], isChecked: [{
                type: Input
            }], hideOpenIcon: [{
                type: Input
            }], layout94$: [{
                type: Input
            }], inlineEditMode: [{
                type: Input
            }], allowInlineEdit: [{
                type: Input
            }], isNewInlineMo: [{
                type: Input
            }], formSetting: [{
                type: Input
            }], typeDefId: [{
                type: Input
            }], maxHeightHeader: [{
                type: Input
            }], UlvMainCtrlr: [{
                type: Input
            }] } });

class CardBaseItemContentPropsComponent extends BaseItemContentPropsComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardBaseItemContentPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: CardBaseItemContentPropsComponent, isStandalone: false, selector: "bnrc-card-base-item-content-props", inputs: { columnTemplate: "columnTemplate", extendedHeaderTemplate: "extendedHeaderTemplate" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardBaseItemContentPropsComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-card-base-item-content-props',
                    template: ``,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { columnTemplate: [{
                type: Input
            }], extendedHeaderTemplate: [{
                type: Input
            }] } });

class BaseFormToolbaritemPropsComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.ulvClick = new EventEmitter();
        this.commandClick = new EventEmitter();
        this._reportValuePipe = inject(MoReportValuePipe);
        this._cdr = inject(ChangeDetectorRef);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseFormToolbaritemPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseFormToolbaritemPropsComponent, isStandalone: false, selector: "bnrc-form-toolbaritem-props", inputs: { deviceName: "deviceName", deviceSize: "deviceSize", btn: "btn", context: "context", isEnable: "isEnable", inlineEditMode: "inlineEditMode", parameters: "parameters", mo: "mo", allColumns: "allColumns", index: "index", showText: "showText", conditionalFormats: "conditionalFormats" }, outputs: { ulvClick: "ulvClick", commandClick: "commandClick" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseFormToolbaritemPropsComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-form-toolbaritem-props',
                    template: ``,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], btn: [{
                type: Input
            }], context: [{
                type: Input
            }], isEnable: [{
                type: Input
            }], inlineEditMode: [{
                type: Input
            }], parameters: [{
                type: Input
            }], ulvClick: [{
                type: Output
            }], mo: [{
                type: Input
            }], allColumns: [{
                type: Input
            }], index: [{
                type: Input
            }], showText: [{
                type: Input
            }], conditionalFormats: [{
                type: Input
            }], commandClick: [{
                type: Output
            }] } });

class DynamicFormToolbaritemComponent extends BaseDynamicComponent {
    constructor() {
        super(...arguments);
        this.btnClick = new EventEmitter();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicFormToolbaritemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: DynamicFormToolbaritemComponent, isStandalone: false, selector: "bnrc-dynamic-form-toolbaritem", inputs: { mo: "mo", index: "index", deviceName: "deviceName", deviceSize: "deviceSize", context: "context", btn: "btn", isEnable: "isEnable", showText: "showText", allColumns: "allColumns", conditionalFormats: "conditionalFormats" }, outputs: { btnClick: "btnClick" }, usesInheritance: true, ngImport: i0, template: `<ng-container #componentContainer></ng-container>`, isInline: true, styles: [":host{display:block;width:min-content}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicFormToolbaritemComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-dynamic-form-toolbaritem', template: `<ng-container #componentContainer></ng-container>`, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block;width:min-content}\n"] }]
        }], propDecorators: { btnClick: [{
                type: Output
            }], mo: [{
                type: Input
            }], index: [{
                type: Input
            }], deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], context: [{
                type: Input
            }], btn: [{
                type: Input
            }], isEnable: [{
                type: Input
            }], showText: [{
                type: Input
            }], allColumns: [{
                type: Input
            }], conditionalFormats: [{
                type: Input
            }] } });

class DynamicLayoutComponent extends BaseDynamicComponent {
    async ngOnInit() {
        if (this.config.CustomUi) {
            const { Module, ModuleFileName, Name, Selector, Parameters, Settings } = this.config.CustomUi;
            this.component = {
                Id: getUniqueId(3),
                $Caption: getUniqueId(3),
                Module,
                ModuleFileName,
                Name,
                Selector,
                Parameters: Parameters || Settings
            };
        }
        else {
            this.component = {
                Id: getUniqueId(3),
                $Caption: getUniqueId(3),
                Module: this.module,
                ModuleFileName: this.moduleFileName,
                Name: this.name,
                Selector: this.selector,
                Parameters: this.parameters
            };
        }
        super.ngOnInit();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicLayoutComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: DynamicLayoutComponent, isStandalone: false, selector: "bnrc-dynamic-layout", inputs: { selector: "selector", module: "module", name: "name", parameters: "parameters", moduleFileName: "moduleFileName", flex: "flex", config: "config", maxLabelWidth: "maxLabelWidth", hasHorizontalText: "hasHorizontalText", isSearchPanel: "isSearchPanel" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, styles: [":host{display:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicLayoutComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-dynamic-layout', template: ``, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:none}\n"] }]
        }], propDecorators: { selector: [{
                type: Input
            }], module: [{
                type: Input
            }], name: [{
                type: Input
            }], parameters: [{
                type: Input
            }], moduleFileName: [{
                type: Input
            }], flex: [{
                type: Input
            }], config: [{
                type: Input
            }], maxLabelWidth: [{
                type: Input
            }], hasHorizontalText: [{
                type: Input
            }], isSearchPanel: [{
                type: Input
            }] } });

class DynamicUlvToolbarComponent extends BaseDynamicComponent {
    constructor() {
        super(...arguments);
        this.hideTitle = false;
    }
    ngOnChanges(changes) {
        if (this._component) {
            Object.keys(changes).forEach((key) => {
                if (!changes[key].firstChange) {
                    this._component.instance[key] = changes[key].currentValue;
                }
            });
            this._component.instance.ngOnChanges(changes);
            this._component.instance.changeDetect && this._component.instance.changeDetect();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicUlvToolbarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: DynamicUlvToolbarComponent, isStandalone: false, selector: "bnrc-dynamic-ulv-toolbar-component", inputs: { viewSettings: "viewSettings", allowGridColumnSort: "allowGridColumnSort", useLayoutItemTextForControl: "useLayoutItemTextForControl", enableSearch: "enableSearch", hideTitle: "hideTitle", title: "title", icon: "icon", deviceName: "deviceName", deviceSize: "deviceSize", access: "access", hideToolbar: "hideToolbar", toolbarButtons: "toolbarButtons", contentDensity: "contentDensity", inlineEditMode: "inlineEditMode", allowInlineEdit: "allowInlineEdit", gridSetting: "gridSetting", viewCollection: "viewCollection", toolbarButtonsReportView: "toolbarButtonsReportView", reportView: "reportView", inDialog: "inDialog", isMultiSelect: "isMultiSelect", cls: "cls", hasSelected: "hasSelected", config: "config", hidden: "hidden", buttons: "buttons", moDataListCount: "moDataListCount" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<ng-container #componentContainer></ng-container>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicUlvToolbarComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-dynamic-ulv-toolbar-component',
                    template: `<ng-container #componentContainer></ng-container>`,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { viewSettings: [{
                type: Input
            }], allowGridColumnSort: [{
                type: Input
            }], useLayoutItemTextForControl: [{
                type: Input
            }], enableSearch: [{
                type: Input
            }], hideTitle: [{
                type: Input
            }], title: [{
                type: Input
            }], icon: [{
                type: Input
            }], deviceName: [{
                type: Input
            }], deviceSize: [{
                type: Input
            }], access: [{
                type: Input
            }], hideToolbar: [{
                type: Input
            }], toolbarButtons: [{
                type: Input
            }], contentDensity: [{
                type: Input
            }], inlineEditMode: [{
                type: Input
            }], allowInlineEdit: [{
                type: Input
            }], gridSetting: [{
                type: Input
            }], viewCollection: [{
                type: Input
            }], toolbarButtonsReportView: [{
                type: Input
            }], reportView: [{
                type: Input
            }], inDialog: [{
                type: Input
            }], isMultiSelect: [{
                type: Input
            }], cls: [{
                type: Input
            }], hasSelected: [{
                type: Input
            }], config: [{
                type: Input
            }], hidden: [{
                type: Input
            }], buttons: [{
                type: Input
            }], moDataListCount: [{
                type: Input
            }] } });

class DynamicUlvPagingComponent extends BaseDynamicComponent {
    ngOnChanges(changes) {
        if (this._component) {
            Object.keys(changes).forEach((key) => {
                if (!changes[key].firstChange) {
                    this._component.instance[key] = changes[key].currentValue;
                }
            });
            this._component.instance.ngOnChanges(changes);
            this._component.instance.changeDetect && this._component.instance.changeDetect();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicUlvPagingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: DynamicUlvPagingComponent, isStandalone: false, selector: "bnrc-dynamic-ulv-paging-component", inputs: { pagingSetting: "pagingSetting", context: "context" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<ng-container #componentContainer></ng-container>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicUlvPagingComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-dynamic-ulv-paging-component',
                    template: `<ng-container #componentContainer></ng-container>`,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { pagingSetting: [{
                type: Input
            }], context: [{
                type: Input
            }] } });

class UnlimitSessionComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this._portalService = inject(PortalService);
        this._storageService = inject(LocalStorageService);
        this._Key = 'S_S_Ex';
    }
    ngOnInit() {
        super.ngOnInit();
        combineLatest([this._portalService.userLoggedIn$, this._portalService.standalone$]).subscribe(([isLoggedIn, standalone]) => {
            const key = this._Key;
            if (isLoggedIn && standalone && !this._storageService.getItem(key)) {
                try {
                    this._setStandaloneApp();
                }
                catch { }
                this._storageService.setItem(key, 'true');
            }
            if (!isLoggedIn) {
                this._storageService.remove(key);
            }
        });
    }
    _setStandaloneApp() {
        this._portalService.RunBlMethodAsync('BarsaSetStandAloneApp', [BarsaApi.LoginFormData.PortalId]).catch((_) => { });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UnlimitSessionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: UnlimitSessionComponent, isStandalone: false, selector: "bnrc-unlimit-session", usesInheritance: true, ngImport: i0, template: "", styles: [":host{background:#191919 -webkit-linear-gradient(top,#000 0%,#191919 100%) no-repeat;background:#191919 linear-gradient(to bottom,#000,#191919) no-repeat;text-align:center}:host h1,:host h2{font-weight:400}:host h1{margin:0 auto;padding:.15em;font-size:10em;text-shadow:0 2px 2px #000}:host h2{margin-bottom:2em}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UnlimitSessionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-unlimit-session', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "", styles: [":host{background:#191919 -webkit-linear-gradient(top,#000 0%,#191919 100%) no-repeat;background:#191919 linear-gradient(to bottom,#000,#191919) no-repeat;text-align:center}:host h1,:host h2{font-weight:400}:host h1{margin:0 auto;padding:.15em;font-size:10em;text-shadow:0 2px 2px #000}:host h2{margin-bottom:2em}\n"] }]
        }] });

class PushBannerComponent extends BaseComponent {
    constructor() {
        super();
        this._pushService = inject(PushNotificationService);
        this.push = this._pushService.push;
    }
    get bannerPositionClass() {
        const userAgent = navigator.userAgent;
        const isMobile = /Android|iPhone|iPad|iPod/i.test(userAgent);
        if (!isMobile) {
            // دسکتاپ: بالا، راست/چپ
            return 'position-desktop';
        }
        const isAndroid = /Android/i.test(userAgent);
        const isIOS = /iPhone|iPad|iPod/i.test(userAgent);
        if (isAndroid) {
            // موبایل اندروید: بالا
            return 'position-android-top';
        }
        if (isIOS) {
            // موبایل iOS: پایین (برای جلوگیری از تداخل با نوار آدرس Safari/Chrome)
            return 'position-ios-bottom';
        }
        // پیش‌فرض برای هر موبایل دیگر
        return 'position-ios-bottom';
    }
    onHideBanner() {
        this._pushService.hideBanner();
    }
    onEnable() {
        this._pushService.subscribe();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushBannerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: PushBannerComponent, isStandalone: false, selector: "bnrc-push-banner", usesInheritance: true, ngImport: i0, template: `
        @if(push().bannerVisible){
        <div class="push-banner" [ngClass]="bannerPositionClass">
            <div class="text">
                <b>فعال‌سازی اعلان‌ها</b>
                <p>برای دریافت پیام‌ها و رویدادهای مهم، اعلان‌ها را فعال کنید.</p>
            </div>
            <div class="actions">
                <button class="btn enable" (click)="onEnable()">فعال‌سازی</button>
                <button class="btn later" (click)="onHideBanner()">بعداً</button>
            </div>
            @if(push().errorMessage){
            <p class="error">{{ push().errorMessage }}</p>
            }
        </div>
        }
    `, isInline: true, styles: [".push-banner{position:fixed;left:0;right:0;font-family:var(--sapFontFamily);background:#fff;border-radius:12px 12px 0 0;box-shadow:0 -4px 16px #00000026;padding:16px;display:flex;flex-direction:column;gap:8px;z-index:9999}.actions{display:flex;gap:8px}.btn.enable{background:#25d366;color:#fff;border-radius:8px;padding:8px 12px;border:none}.btn.later{background:transparent;color:#666;border:none;padding:8px 12px}.error{color:red;font-size:13px}.position-ios-bottom{bottom:0;top:auto;border-radius:12px 12px 0 0}.position-android-top{top:0;bottom:auto;border-radius:0 0 12px 12px}.position-desktop{inset:20px 20px auto auto;width:320px;max-width:90%;border-radius:8px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushBannerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-push-banner', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: `
        @if(push().bannerVisible){
        <div class="push-banner" [ngClass]="bannerPositionClass">
            <div class="text">
                <b>فعال‌سازی اعلان‌ها</b>
                <p>برای دریافت پیام‌ها و رویدادهای مهم، اعلان‌ها را فعال کنید.</p>
            </div>
            <div class="actions">
                <button class="btn enable" (click)="onEnable()">فعال‌سازی</button>
                <button class="btn later" (click)="onHideBanner()">بعداً</button>
            </div>
            @if(push().errorMessage){
            <p class="error">{{ push().errorMessage }}</p>
            }
        </div>
        }
    `, styles: [".push-banner{position:fixed;left:0;right:0;font-family:var(--sapFontFamily);background:#fff;border-radius:12px 12px 0 0;box-shadow:0 -4px 16px #00000026;padding:16px;display:flex;flex-direction:column;gap:8px;z-index:9999}.actions{display:flex;gap:8px}.btn.enable{background:#25d366;color:#fff;border-radius:8px;padding:8px 12px;border:none}.btn.later{background:transparent;color:#666;border:none;padding:8px 12px}.error{color:red;font-size:13px}.position-ios-bottom{bottom:0;top:auto;border-radius:12px 12px 0 0}.position-android-top{top:0;bottom:auto;border-radius:0 0 12px 12px}.position-desktop{inset:20px 20px auto auto;width:320px;max-width:90%;border-radius:8px}\n"] }]
        }], ctorParameters: () => [] });

class LoadExternalFilesDirective {
    constructor() {
        this._renderer2 = inject(Renderer2);
    }
    ngOnInit() {
        const jsfiles = [];
        const cssfiles = [];
        Object.keys(BarsaApi.LoginFormData).forEach((key) => {
            if (key.startsWith('JSFile')) {
                jsfiles.push(BarsaApi.LoginFormData[key]);
            }
            if (key.startsWith('CSSFile')) {
                cssfiles.push(BarsaApi.LoginFormData[key]);
            }
        });
        if (jsfiles.length > 0) {
            head.load(jsfiles);
        }
        if (cssfiles.length > 0) {
            cssfiles.forEach((c) => {
                document.head.insertAdjacentHTML('beforeend', ` <link href="${c}" rel="stylesheet" noportal />`);
            });
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LoadExternalFilesDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: LoadExternalFilesDirective, isStandalone: false, selector: "[loadExternalFiles]", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LoadExternalFilesDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[loadExternalFiles]',
                    standalone: false
                }]
        }] });

class RootPortalComponent extends PageBaseComponent {
    constructor() {
        super(...arguments);
        this._dir = 'ltr';
        this.isRoot = true;
        this.inLocalMode = signal(false);
    }
    ngOnInit() {
        super.ngOnInit();
        this.addModulesToDom();
        this.inLocalMode.set(isInLocalMode());
        this._portalService.rtl$.subscribe((c) => {
            this._dir = c ? 'rtl' : 'ltr';
        });
        this._portalService.deviceSize$.subscribe((c) => {
            this._deviceSize = c;
        });
        // this.inLocalMode = true;
        this._router.events.subscribe((event) => {
            if (event instanceof NavigationStart && event instanceof RouterEvent) {
                this._portalService.naviationStart(event);
            }
            if (event instanceof NavigationEnd && event instanceof RouterEvent) {
                this._portalService.naviationEnd(event);
            }
        });
    }
    onSendOfflineDataToServer() {
        BarsaApi.Bw.Msg.YesNo(BarsaApi.BBB.OfflineGoOnline, BarsaApi.BBB.Delete, function (buttonId) {
            if (buttonId === 'yes') {
                BarsaApi.Bw.Msg.Wait(0, BarsaApi.BBB.LoadingMaskMsg, 'wait');
                BarsaApi.Offline.GoOnline(function () {
                    window.location.reload();
                });
            }
        });
    }
    onRemoveOfflineDataAndReturnToOnline() {
        BarsaApi.Bw.Msg.YesNo(BarsaApi.BBB.OfflineClearAll, BarsaApi.BBB.Delete, function (buttonId) {
            if (buttonId === 'yes') {
                BarsaApi.Offline.ClearAll();
                window.location.reload();
            }
        });
    }
    onRemoveOfflineData() {
        BarsaApi.Bw.Msg.YesNo(BarsaApi.BBB.OfflineClearUnsavedData, BarsaApi.BBB.Delete, function (buttonId) {
            if (buttonId === 'yes') {
                BarsaApi.Offline.CachedData.UnsavedData = {};
                BarsaApi.Offline.CachedData.save();
                BarsaApi.Bw.Toast.Success(BarsaApi.BBB.Action + BarsaApi.BBB.JobCompleted);
            }
        });
    }
    addFooter(pageData) {
        if (!pageData?.Footer) {
            return;
        }
        const footerComponent = pageData.Footer.Component;
        this.getComponentFactory(footerComponent)
            .pipe(takeUntil$1(this._onDestroy$), tap$1((controlUi) => {
            controlUi.instance.settings = footerComponent.Settings;
            controlUi.instance.activatedRoute = this._activatedRoute;
            if (this.footerRefVcr) {
                this.footerRefVcr.insert(controlUi.hostView);
            }
        }))
            .subscribe();
    }
    renderPlaceHolders(pageData) {
        super.renderPlaceHolders(pageData);
        this.addFooter(pageData);
        BigNumber.prototype.subtract = BigNumber.prototype.minus;
        BigNumber.prototype.add = BigNumber.prototype.plus;
        const { BackgroundId, BackgroundColor, HasOverlay, BackgroundSize } = this.pageData;
        if (BackgroundId) {
            this.backgroundColor = BackgroundColor;
            this.hasOverlay = HasOverlay !== 'False';
            this._renderer2.addClass(this._el.nativeElement, 'root-custom-background');
            this.hasOverlay && this._renderer2.addClass(this._el.nativeElement, 'root-background-overlay');
            BackgroundSize && this._renderer2.addClass(this._el.nativeElement, 'size-' + BackgroundSize);
            this.imageUrl = `/IH.ashx?ty=ID&moId=&id=${BackgroundId}`;
            this._portalService.setSiteImageUrl(BackgroundColor, this.imageUrl);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RootPortalComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: RootPortalComponent, isStandalone: false, selector: "bnrc-root-portal", host: { properties: { "attr.dir": "this._dir", "attr.devicesize": "this._deviceSize" } }, viewQueries: [{ propertyName: "sectionRef", first: true, predicate: ["sectionRef"], descendants: true }, { propertyName: "footerRefVcr", first: true, predicate: ["footerRef"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: `
        <span
            class="!tw-hidden tw-grid-cols-[1fr_auto] tw-text-bold tw-grid tw-grid-cols-12 tw-gap-2 tw-py-1 tw-px-2 tw-font-semibold
            max-md:tw-grid-cols-1  tw-inline-flex tw-items-center tw-gap-1 tw-px-3 
            tw-py-1 tw-text-xs tw-font-semibold tw-text-red-700 tw-bg-red-100 tw-border 
            tw-border-red-300 tw-rounded-full"
        >
            <span class="tw-w-2 tw-h-2 tw-bg-red-500 tw-rounded-full tw-animate-pulse"></span>            
        </span>
        <div
            class=" tw-text-muted tw-hidden grid-cols-0 tw-grid-cols-1 tw-grid-cols-2 tw-grid-cols-3 tw-grid-cols-4 tw-grid-cols-5 
            tw-grid-cols-6 tw-grid-cols-7 tw-grid-cols-8 tw-grid-cols-9 tw-grid-cols-10 tw-grid-cols-11 tw-grid-cols-12"
        ></div>
        <div
            class="tw-hidden md:grid-cols-0 md:tw-grid-cols-1 md:tw-grid-cols-2 md:tw-grid-cols-3 md:tw-grid-cols-4 
            md:tw-grid-cols-5 md:tw-grid-cols-6 md:tw-grid-cols-7 md:tw-grid-cols-8 md:tw-grid-cols-9 md:tw-grid-cols-10 md:tw-grid-cols-11 md:tw-grid-cols-12"
        ></div>
        <div
            class="tw-hidden lg:grid-cols-0 lg:tw-grid-cols-1 lg:tw-grid-cols-2 lg:tw-grid-cols-3 
            lg:tw-grid-cols-4 lg:tw-grid-cols-5 lg:tw-grid-cols-6 lg:tw-grid-cols-7 lg:tw-grid-cols-8 lg:tw-grid-cols-9 
            lg:tw-grid-cols-10 lg:tw-grid-cols-11 lg:tw-grid-cols-12"
        ></div>
        <div
            class="tw-hidden xl:grid-cols-0 xl:tw-grid-cols-1 xl:tw-grid-cols-2 xl:tw-grid-cols-3 
            xl:tw-grid-cols-4 xl:tw-grid-cols-5 xl:tw-grid-cols-6 xl:tw-grid-cols-7 xl:tw-grid-cols-8 
            xl:tw-grid-cols-9 xl:tw-grid-cols-10 xl:tw-grid-cols-11 xl:tw-grid-cols-12"
        ></div>
        <div
            class="tw-hidden 2xl:grid-cols-0 2xl:tw-grid-cols-1 2xl:tw-grid-cols-2 2xl:tw-grid-cols-3 
            2xl:tw-grid-cols-4 2xl:tw-grid-cols-5 2xl:tw-grid-cols-6 2xl:tw-grid-cols-7 2xl:tw-grid-cols-8 2xl:tw-grid-cols-9 
            2xl:tw-grid-cols-10 2xl:tw-grid-cols-11 2xl:tw-grid-cols-12"
        ></div>
        @if(inLocalMode()){
        <div class="fd-toolbar" style="flex-wrap:wrap;padding:0.5rem;height:auto">
            <button class="fd-button fd-button--attention is-compact" (click)="onRemoveOfflineData()">
                حذف اطلاعات آفلاین
            </button>
            <button class="fd-button fd-button--negative is-compact" (click)="onRemoveOfflineDataAndReturnToOnline()">
                حذف اطلاعات آفلاین و برگشت به حالت آنلاین
            </button>
            <button class="fd-button fd-button--positive is-compact" (click)="onSendOfflineDataToServer()">
                ارسال اطلاعات آفلاین به سرور
            </button>
        </div>
        } @if (imageUrl) {
        <div id="headerSpaceHolder" #headerSpaceHolder>
            <div id="bgOuterHolder" #bgOuterHolder>
                <div id="bgInnerHolder" style="height: 100vh">
                    <div
                        class="backgroundImage"
                        id="backgroundImage"
                        [style.background-color]="backgroundColor"
                        [style.background-image]="'url(' + imageUrl + ')'"
                    >
                        <!-- <img class="picture" [src]="imageUrl" loading="lazy" /> -->
                        @if(hasOverlay){
                        <span id="backgroundImageOverlay" class="overlay"></span>
                        }
                    </div>
                </div>
            </div>
        </div>
        }
        <section loadExternalFiles class="tw-invisible section" id="mainpage" #sectionRef>
            <div #containerRef></div>
        </section>
        <div class="page-wrapper">
            <router-outlet></router-outlet>
        </div>
        <!-- <footer #footerRef></footer> -->
        <ng-container #footerRef></ng-container>
        @if(pageData?.UnlimitSession==='True'){
        <bnrc-unlimit-session></bnrc-unlimit-session>
        }
        <bnrc-push-banner></bnrc-push-banner>
    `, isInline: true, dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: UnlimitSessionComponent, selector: "bnrc-unlimit-session" }, { kind: "component", type: PushBannerComponent, selector: "bnrc-push-banner" }, { kind: "directive", type: LoadExternalFilesDirective, selector: "[loadExternalFiles]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RootPortalComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-root-portal',
                    template: `
        <span
            class="!tw-hidden tw-grid-cols-[1fr_auto] tw-text-bold tw-grid tw-grid-cols-12 tw-gap-2 tw-py-1 tw-px-2 tw-font-semibold
            max-md:tw-grid-cols-1  tw-inline-flex tw-items-center tw-gap-1 tw-px-3 
            tw-py-1 tw-text-xs tw-font-semibold tw-text-red-700 tw-bg-red-100 tw-border 
            tw-border-red-300 tw-rounded-full"
        >
            <span class="tw-w-2 tw-h-2 tw-bg-red-500 tw-rounded-full tw-animate-pulse"></span>            
        </span>
        <div
            class=" tw-text-muted tw-hidden grid-cols-0 tw-grid-cols-1 tw-grid-cols-2 tw-grid-cols-3 tw-grid-cols-4 tw-grid-cols-5 
            tw-grid-cols-6 tw-grid-cols-7 tw-grid-cols-8 tw-grid-cols-9 tw-grid-cols-10 tw-grid-cols-11 tw-grid-cols-12"
        ></div>
        <div
            class="tw-hidden md:grid-cols-0 md:tw-grid-cols-1 md:tw-grid-cols-2 md:tw-grid-cols-3 md:tw-grid-cols-4 
            md:tw-grid-cols-5 md:tw-grid-cols-6 md:tw-grid-cols-7 md:tw-grid-cols-8 md:tw-grid-cols-9 md:tw-grid-cols-10 md:tw-grid-cols-11 md:tw-grid-cols-12"
        ></div>
        <div
            class="tw-hidden lg:grid-cols-0 lg:tw-grid-cols-1 lg:tw-grid-cols-2 lg:tw-grid-cols-3 
            lg:tw-grid-cols-4 lg:tw-grid-cols-5 lg:tw-grid-cols-6 lg:tw-grid-cols-7 lg:tw-grid-cols-8 lg:tw-grid-cols-9 
            lg:tw-grid-cols-10 lg:tw-grid-cols-11 lg:tw-grid-cols-12"
        ></div>
        <div
            class="tw-hidden xl:grid-cols-0 xl:tw-grid-cols-1 xl:tw-grid-cols-2 xl:tw-grid-cols-3 
            xl:tw-grid-cols-4 xl:tw-grid-cols-5 xl:tw-grid-cols-6 xl:tw-grid-cols-7 xl:tw-grid-cols-8 
            xl:tw-grid-cols-9 xl:tw-grid-cols-10 xl:tw-grid-cols-11 xl:tw-grid-cols-12"
        ></div>
        <div
            class="tw-hidden 2xl:grid-cols-0 2xl:tw-grid-cols-1 2xl:tw-grid-cols-2 2xl:tw-grid-cols-3 
            2xl:tw-grid-cols-4 2xl:tw-grid-cols-5 2xl:tw-grid-cols-6 2xl:tw-grid-cols-7 2xl:tw-grid-cols-8 2xl:tw-grid-cols-9 
            2xl:tw-grid-cols-10 2xl:tw-grid-cols-11 2xl:tw-grid-cols-12"
        ></div>
        @if(inLocalMode()){
        <div class="fd-toolbar" style="flex-wrap:wrap;padding:0.5rem;height:auto">
            <button class="fd-button fd-button--attention is-compact" (click)="onRemoveOfflineData()">
                حذف اطلاعات آفلاین
            </button>
            <button class="fd-button fd-button--negative is-compact" (click)="onRemoveOfflineDataAndReturnToOnline()">
                حذف اطلاعات آفلاین و برگشت به حالت آنلاین
            </button>
            <button class="fd-button fd-button--positive is-compact" (click)="onSendOfflineDataToServer()">
                ارسال اطلاعات آفلاین به سرور
            </button>
        </div>
        } @if (imageUrl) {
        <div id="headerSpaceHolder" #headerSpaceHolder>
            <div id="bgOuterHolder" #bgOuterHolder>
                <div id="bgInnerHolder" style="height: 100vh">
                    <div
                        class="backgroundImage"
                        id="backgroundImage"
                        [style.background-color]="backgroundColor"
                        [style.background-image]="'url(' + imageUrl + ')'"
                    >
                        <!-- <img class="picture" [src]="imageUrl" loading="lazy" /> -->
                        @if(hasOverlay){
                        <span id="backgroundImageOverlay" class="overlay"></span>
                        }
                    </div>
                </div>
            </div>
        </div>
        }
        <section loadExternalFiles class="tw-invisible section" id="mainpage" #sectionRef>
            <div #containerRef></div>
        </section>
        <div class="page-wrapper">
            <router-outlet></router-outlet>
        </div>
        <!-- <footer #footerRef></footer> -->
        <ng-container #footerRef></ng-container>
        @if(pageData?.UnlimitSession==='True'){
        <bnrc-unlimit-session></bnrc-unlimit-session>
        }
        <bnrc-push-banner></bnrc-push-banner>
    `,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { sectionRef: [{
                type: ViewChild,
                args: ['sectionRef']
            }], footerRefVcr: [{
                type: ViewChild,
                args: ['footerRef', { read: ViewContainerRef }]
            }], _dir: [{
                type: HostBinding,
                args: ['attr.dir']
            }], _deviceSize: [{
                type: HostBinding,
                args: ['attr.devicesize']
            }] } });

class AnchorScrollDirective {
    scrollInto() {
        const element = document.querySelector('#' + this.anchorScroll);
        if (element != null) {
            element.scrollIntoView();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AnchorScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: AnchorScrollDirective, isStandalone: false, selector: "[anchorScroll]", inputs: { anchorScroll: "anchorScroll" }, host: { listeners: { "click": "scrollInto()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AnchorScrollDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[anchorScroll]',
                    standalone: false
                }]
        }], propDecorators: { anchorScroll: [{
                type: Input
            }], scrollInto: [{
                type: HostListener,
                args: ['click']
            }] } });

class AttrRtlDirective extends BaseDirective {
    constructor() {
        super();
        const rtl = this.rtl;
        if (rtl === false) {
            this._setRtlAttribute(rtl);
            return;
        }
        this._portalService.rtl$.pipe(takeUntil(this._onDestroy$)).subscribe((rtlValue) => {
            this._setRtlAttribute(rtlValue);
        });
    }
    _setRtlAttribute(rtl) {
        this._renderer2.setAttribute(this._el.nativeElement, 'rtl', `${rtl}`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AttrRtlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: AttrRtlDirective, isStandalone: false, selector: "[attrRtl]", inputs: { rtl: ["attrRtl", "rtl"] }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AttrRtlDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[attrRtl]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { rtl: [{
                type: Input,
                args: ['attrRtl']
            }] } });

class ColumnResizerDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.renderer = inject(Renderer2);
    }
    ngOnInit() {
        super.ngOnInit();
        if (!this.disableResizer) {
            this._addColumnsResizer();
        }
    }
    _addColumnsResizer() {
        const cell = this._el.nativeElement;
        if (cell.hasAttribute('NoResizable')) {
            return;
        }
        const columnResizer = this.renderer.createElement('div');
        this.renderer.appendChild(cell, columnResizer);
        columnResizer.setAttribute('class', 'column-resizer');
        this.renderer.setAttribute(columnResizer, 'style', 'cursor: col-resize; width: 8px;position: absolute;left:0; top:0; bottom:0');
        this.renderer.setStyle(cell, 'padding-left', 0);
        this.renderer.setStyle(cell, 'position', 'relative');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnResizerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ColumnResizerDirective, isStandalone: false, selector: "[columnResizer]", inputs: { disableResizer: "disableResizer" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnResizerDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[columnResizer]',
                    standalone: false
                }]
        }], propDecorators: { disableResizer: [{
                type: Input
            }] } });

class DynamicCommandDirective {
    constructor() {
        this.commandClick = new EventEmitter();
    }
    onClick(event) {
        if (typeof this.enableCommand === typeof undefined) {
            this.enableCommand = true;
        }
        if (!this.enableCommand || !this.dynCommand) {
            return true;
        }
        const command = this.dynCommand;
        event.stopPropagation();
        event.preventDefault();
        ExecuteDynamicCommand(command, this.mo);
        this.commandClick.emit();
        return false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicCommandDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: DynamicCommandDirective, isStandalone: false, selector: "[dynCommand]", inputs: { dynCommand: "dynCommand", mo: "mo", enableCommand: "enableCommand" }, outputs: { commandClick: "commandClick" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicCommandDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[dynCommand]',
                    standalone: false
                }]
        }], propDecorators: { dynCommand: [{
                type: Input
            }], mo: [{
                type: Input
            }], enableCommand: [{
                type: Input
            }], commandClick: [{
                type: Output
            }], onClick: [{
                type: HostListener,
                args: ['click', ['$event']]
            }] } });

class EllipsifyDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.renderer = inject(Renderer2);
    }
    moseMove(e) {
        if (e.buttons) {
            this._heightChange();
        }
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        setTimeout(() => {
            this.childes = this._el.nativeElement.querySelectorAll('span, h5, p');
            this._initStyle();
            this._handleNoEllipsis();
            this._heightChange();
        }, 100);
    }
    _heightChange() {
        this.childes.forEach((child) => {
            if (child.childElementCount === 0) {
                const height = child.clientHeight;
                const lineHeightStr = getComputedStyle(child).lineHeight.replace('px', '');
                const lineHeight = Number(lineHeightStr);
                let limitLine = this.limitLine ? this.limitLine : Math.round(height / lineHeight);
                limitLine = limitLine && limitLine !== 0 ? limitLine : 1;
                this.renderer.setStyle(child, '-webkit-line-clamp', limitLine.toString());
            }
        });
    }
    _initStyle() {
        this.childes.forEach((child) => {
            if (child.childElementCount === 0) {
                this.renderer.setStyle(child, 'height', 'inherit');
                this.renderer.setStyle(child, 'overflow', 'hidden');
                this.renderer.setStyle(child, '-webkit-box-orient', 'vertical');
                this.renderer.setStyle(child, 'display', '-webkit-box');
                this.renderer.setStyle(child, 'width', 'fit-content');
            }
        });
    }
    _handleNoEllipsis() {
        const noEllipsisEls = this._el.nativeElement.querySelectorAll('[ellipsis=no-ellipsis]');
        noEllipsisEls.forEach((el) => {
            const all = el.querySelectorAll('span, h5, p');
            all.forEach((el2) => {
                if (el2.childElementCount === 0) {
                    this.renderer.setStyle(el2, 'white-space', 'break-spaces');
                }
            });
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: EllipsifyDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: EllipsifyDirective, isStandalone: false, selector: "[ellipsify]", inputs: { limitLine: "limitLine" }, host: { listeners: { "mousemove": "moseMove($event)" } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: EllipsifyDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[ellipsify]',
                    standalone: false
                }]
        }], propDecorators: { limitLine: [{
                type: Input
            }], moseMove: [{
                type: HostListener,
                args: ['mousemove', ['$event']]
            }] } });

class FieldDirective {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: FieldDirective, isStandalone: false, selector: "[field]", inputs: { field: "field", value: "value" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[field]',
                    standalone: false
                }]
        }], propDecorators: { field: [{
                type: Input
            }], value: [{
                type: Input
            }] } });

class ImageLazyDirective extends BaseDirective {
    constructor() {
        super();
        this.auto = true;
        this.threshold = 20;
        this.imageLoaded = new EventEmitter();
        this.portalService = inject(PortalService);
        this._imageViewed$ = new Subject();
        this._imgEl = this._el.nativeElement;
    }
    ngOnInit() {
        super.ngOnInit();
        const supports = 'loading' in HTMLImageElement.prototype;
        if (supports) {
            this.handleLoadEvent(this._imgEl);
            this._imgEl.src = this.imgLazy;
            this._imgEl.setAttribute('loading', 'lazy');
            return;
        }
        const timer1 = timer(1000);
        if (this.auto) {
            const isCached = this.portalService.cachedImages[this.imgLazy];
            if (isCached) {
                this._imgEl.src = this.imgLazy;
                return;
            }
            merge([timer1, fromEvent(window, 'scroll')])
                .pipe(takeUntil(this._imageViewed$), takeUntil(this._onDestroy$), debounceTime(20), filter(() => this.isInViewport()), tap(() => this.showImage()))
                .subscribe();
        }
    }
    showImage() {
        const imgEl = this._imgEl;
        if (this.imgLazy === this._imgEl.src) {
            imgEl.parentElement?.setAttribute('imgLoaded', 'true');
            return;
        }
        this.portalService.cachedImages[this.imgLazy] = true;
        imgEl.src = this.imgLazy;
        this.handleLoadEvent(imgEl);
        this._imageViewed$.next();
    }
    handleLoadEvent(imgEl) {
        imgEl.addEventListener('load', () => {
            imgEl.parentElement?.setAttribute('imgLoaded', 'true');
            this.imageLoaded.emit();
        });
    }
    isInViewport() {
        const rect = this._imgEl.getBoundingClientRect();
        const isInViewport = rect.top >= 0 &&
            rect.left >= 0 &&
            rect.bottom - this.threshold <= (window.innerHeight || document.documentElement.clientHeight) &&
            rect.right <= (window.innerWidth || document.documentElement.clientWidth);
        return isInViewport;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ImageLazyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ImageLazyDirective, isStandalone: false, selector: "[imgLazy]", inputs: { auto: "auto", threshold: "threshold", imgLazy: "imgLazy" }, outputs: { imageLoaded: "imageLoaded" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ImageLazyDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[imgLazy]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { auto: [{
                type: Input
            }], threshold: [{
                type: Input
            }], imageLoaded: [{
                type: Output
            }], imgLazy: [{
                type: Input
            }] } });

var IntersectionStatus;
(function (IntersectionStatus) {
    IntersectionStatus["Visible"] = "Visible";
    IntersectionStatus["Pending"] = "Pending";
    IntersectionStatus["NotVisible"] = "NotVisible";
})(IntersectionStatus || (IntersectionStatus = {}));
/* eslint-disable */
const fromIntersectionObserver = (element, config, debounce = 0, autoStop = true) => new Observable((subscriber) => {
    const subject$ = new Subject();
    const intersectionObserver = new IntersectionObserver((entries, observer) => {
        entries.forEach((entry) => {
            if (isIntersecting(entry)) {
                subject$.next({ entry, observer });
            }
        });
    }, config);
    subject$.subscribe(() => {
        subscriber.next(IntersectionStatus.Pending);
    });
    subject$.pipe(debounceTime(debounce), filter(Boolean)).subscribe(async (x) => {
        const { entry, observer } = x;
        const isEntryVisible = await isVisible(entry.target);
        if (isEntryVisible) {
            subscriber.next(IntersectionStatus.Visible);
            autoStop && observer.unobserve(entry.target);
        }
        else {
            subscriber.next(IntersectionStatus.NotVisible);
        }
    });
    intersectionObserver.observe(element);
    return {
        unsubscribe() {
            intersectionObserver.disconnect();
            subject$.unsubscribe();
        }
    };
});
async function isVisible(element) {
    return new Promise((resolve) => {
        const observer = new IntersectionObserver(([entry]) => {
            resolve(entry.isIntersecting);
            observer.disconnect();
        });
        observer.observe(element);
    });
}
function isIntersecting(entry) {
    return true; // entry.isIntersecting || entry.intersectionRatio > 0;
}

class IntersectionObserverDirective {
    constructor() {
        this.intersectionDebounce = 0;
        this.intersectionRootMargin = '';
        this.visibilityChange = new EventEmitter();
        this.element = inject(ElementRef);
        this.destroy$ = new Subject();
    }
    ngOnInit() {
        const element = this.element.nativeElement;
        this.intersectionDebounce = this.intersectionDebounce || 0;
        this.intersectionRootMargin = this.intersectionRootMargin || '0px';
        const config = {
            root: this.intersectionRoot,
            rootMargin: this.intersectionRootMargin,
            threshold: this.intersectionThreshold
        };
        fromIntersectionObserver(element, config, this.intersectionDebounce, false)
            .pipe(takeUntil(this.destroy$))
            .subscribe((status) => {
            this.visibilityChange.emit(status);
        });
    }
    ngOnDestroy() {
        this.destroy$.next();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IntersectionObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: IntersectionObserverDirective, isStandalone: false, selector: "[intersectionObserver]", inputs: { intersectionDebounce: "intersectionDebounce", intersectionRootMargin: "intersectionRootMargin", intersectionRoot: "intersectionRoot", intersectionThreshold: "intersectionThreshold" }, outputs: { visibilityChange: "visibilityChange" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IntersectionObserverDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[intersectionObserver]',
                    standalone: false
                }]
        }], propDecorators: { intersectionDebounce: [{
                type: Input
            }], intersectionRootMargin: [{
                type: Input
            }], intersectionRoot: [{
                type: Input
            }], intersectionThreshold: [{
                type: Input
            }], visibilityChange: [{
                type: Output
            }] } });

class ItemsRendererDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.itemClick = new EventEmitter();
        this.handleClick = false;
    }
    ngOnInit() {
        super.ngOnInit();
        const context = this.itemsRenderer.context;
        const { itemSelector } = this.itemsRenderer;
        const fragmentDoc = document.createDocumentFragment();
        if (!this.moDataList) {
            this.moDataList = this.itemsRenderer.moDataList;
        }
        this.moDataList.forEach((mo, index) => {
            const itemComponentElement = document.createElement(itemSelector);
            itemComponentElement.addEventListener('itemClick', (e) => {
                if (this.handleClick) {
                    this.itemClick.emit(e.detail);
                }
                else {
                    mo.$IsChecked = true;
                    context?.fireEvent('rowdblclick', context, index, mo);
                }
            });
            itemComponentElement.context = context;
            itemComponentElement.mo = mo;
            itemComponentElement.index = index;
            itemComponentElement.classNames = this.itemClass;
            itemComponentElement.allColumns = this.itemsRenderer.allColumns;
            fragmentDoc.appendChild(itemComponentElement);
        });
        this._el.nativeElement.appendChild(fragmentDoc);
        this._fragmentDoc = fragmentDoc;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ItemsRendererDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ItemsRendererDirective, isStandalone: false, selector: "[itemsRenderer]", inputs: { itemsRenderer: "itemsRenderer", moDataList: "moDataList", itemClass: "itemClass", handleClick: "handleClick" }, outputs: { itemClick: "itemClick" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ItemsRendererDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[itemsRenderer]',
                    standalone: false
                }]
        }], propDecorators: { itemsRenderer: [{
                type: Input
            }], moDataList: [{
                type: Input
            }], itemClass: [{
                type: Input
            }], itemClick: [{
                type: Output
            }], handleClick: [{
                type: Input
            }] } });

class NumbersOnlyInputDirective {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this.elRef = inject(ElementRef);
    }
    onInputChange(event) {
        const initalValue = this.elRef.nativeElement.value;
        this.elRef.nativeElement.value = initalValue.replace(/[^0-9]*/g, '');
        if (initalValue !== this.elRef.nativeElement.value) {
            event.stopPropagation();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NumbersOnlyInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: NumbersOnlyInputDirective, isStandalone: false, selector: "input[type=number], input[numbersOnly]", host: { listeners: { "input": "onInputChange($event)" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NumbersOnlyInputDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: 'input[type=number], input[numbersOnly]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { onInputChange: [{
                type: HostListener,
                args: ['input', ['$event']]
            }] } });

class PlaceHolderDirective {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PlaceHolderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: PlaceHolderDirective, isStandalone: false, selector: "[placeHolder]", inputs: { placeHolder: "placeHolder" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PlaceHolderDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[placeHolder]',
                    standalone: false
                }]
        }], propDecorators: { placeHolder: [{
                type: Input
            }] } });

class RenderUlvViewerDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this._injector = inject(Injector);
        this._vcr = inject(ViewContainerRef);
        this._cdr = inject(ChangeDetectorRef);
        this._renderer = inject(Renderer2);
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        this._render();
    }
    ngOnChanges(changes) {
        if (changes.viewer && !changes.viewer.firstChange) {
            this._vcr.clear();
            this._render();
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        if (this.component) {
            this.component.destroy();
        }
    }
    _render() {
        const context = this.viewer;
        if (context) {
            let defaultSetting = BarsaApi.Common.Util.TryGetValue(context.Setting, 'ClassNames.CustomUi', null);
            const customUi = BarsaApi.Common.Util.TryGetValue(context.Setting, 'View.CustomUi', null);
            if (customUi !== null) {
                defaultSetting = customUi;
            }
            const { moduleName, modulePath, componentName, selector } = getComponentDefined(context, defaultSetting);
            this._portalService
                .getComponent(moduleName, modulePath, componentName, selector, this._injector)
                .pipe(takeUntil(this._onDestroy$), tap((component) => {
                component.instance.id = getUniqueId(4);
                this._renderer.addClass(component.location.nativeElement, 'ulv-viewer');
                component.instance.context = context;
                component.instance.isReportPage = this.isReportPage;
                component.instance.layoutInfo = this.layoutInfo;
                context.controlUi = component.instance;
                this.component = component;
                this._vcr.insert(component.hostView);
                this._cdr.detectChanges();
            }))
                .subscribe();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RenderUlvViewerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: RenderUlvViewerDirective, isStandalone: false, selector: "[renderUlvViewer]", inputs: { mask: "mask", isReportPage: "isReportPage", layoutInfo: "layoutInfo", viewer: ["renderUlvViewer", "viewer"] }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RenderUlvViewerDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[renderUlvViewer]',
                    standalone: false
                }]
        }], propDecorators: { mask: [{
                type: Input
            }], isReportPage: [{
                type: Input
            }], layoutInfo: [{
                type: Input
            }], viewer: [{
                type: Input,
                args: ['renderUlvViewer']
            }] } });

class RenderUlvPaginDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.pageChange = new EventEmitter();
        this._injector = inject(Injector);
        this._vcr = inject(ViewContainerRef);
        this._cdr = inject(ChangeDetectorRef);
    }
    async ngOnInit() {
        super.ngOnInit();
        this._render();
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this.component?.destroy();
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        if (this.component) {
            Object.keys(changes).forEach((key) => {
                if (!changes[key].firstChange) {
                    this.component.instance[key] = changes[key].currentValue;
                }
            });
            this.component.instance.ngOnChanges(changes);
        }
    }
    async _render() {
        const context = this.context;
        if (context) {
            const customUiSetting = BarsaApi.Common.Util.TryGetValue(context.Setting, 'ClassNames.CustomUi', null);
            const { moduleName, modulePath
            // componentName,
            // selector
             } = getComponentDefined(context, customUiSetting);
            this._portalService
                .getComponent(moduleName, modulePath, 'UlvPaging', 'bsu-ulv-paging', this._injector)
                .pipe(takeUntil(this._onDestroy$), delay(0), tap((component) => {
                const instance = component.instance;
                instance.id = getUniqueId(4);
                instance.context = context;
                instance.pagingSetting = this.pagingSetting;
                instance.pageChange?.pipe(takeUntil(this._onDestroy$)).subscribe((e) => {
                    this.pageChange.emit(e);
                });
                this.component = component;
                this._vcr.insert(component.hostView);
                this._cdr.detectChanges();
            }))
                .subscribe();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RenderUlvPaginDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: RenderUlvPaginDirective, isStandalone: false, selector: "[renderUlvPaging]", inputs: { mask: "mask", pagingSetting: "pagingSetting", context: ["renderUlvPaging", "context"] }, outputs: { pageChange: "pageChange" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RenderUlvPaginDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[renderUlvPaging]',
                    standalone: false
                }]
        }], propDecorators: { pageChange: [{
                type: Output
            }], mask: [{
                type: Input
            }], pagingSetting: [{
                type: Input
            }], context: [{
                type: Input,
                args: ['renderUlvPaging']
            }] } });

class TableResizerDirective extends BaseDirective {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        super();
        this.columnResized = new EventEmitter();
        this.renderer = inject(Renderer2);
        fromEvent(document, 'mouseup')
            .pipe(takeUntil(this._onDestroy$))
            .subscribe(() => {
            this._mouseUp();
        });
        fromEvent(document, 'mousemove')
            .pipe(takeUntil(this._onDestroy$))
            .subscribe((e) => {
            this._mouseMove(e);
        });
    }
    get _table() {
        return this._el.nativeElement;
    }
    moseDown(e) {
        this._mouseDown(e);
    }
    moseMove(e) {
        this._mouseMove(e);
    }
    ngAfterViewInit() {
        if (this.rowResizer) {
            this._putBodyCellsContentIntoDiv();
        }
        if (this.rowResizer) {
            this._addRowsResizer();
        }
        this._setTableMode(this.fitWidth);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { fitWidth } = changes;
        if (this.enableResizing && fitWidth && !fitWidth.firstChange) {
            const newFitWidth = fitWidth.currentValue;
            this._setTableMode(newFitWidth);
        }
    }
    _initializeTable() {
        this._initTable();
        this._setTableMode(this.fitWidth);
    }
    _resizeRow(event) {
        this._currentResizer = "Row" /* Resizer.Row */;
        const elementFromPoint = document.elementFromPoint(event.pageX, event.pageY);
        this._currentCell = elementFromPoint?.closest('td');
        this._startY = event.pageY;
        this._currentRowHeight = this._currentCell?.clientHeight || 0;
    }
    _resizeColumn(event) {
        if (!this.fitWidth) {
            this._setTableFreeSize();
        }
        this._currentResizer = "Column" /* Resizer.Column */;
        const elementFromPoint = document.elementFromPoint(event.pageX, event.pageY);
        this._currentCell = elementFromPoint?.closest('th');
        this._startX = event.pageX;
        this._currentColumnWidth = this._currentCell?.clientWidth || 0;
        this._sideCell = this._getSideCell(this._currentCell);
        this._sideColumnWidth = this._sideCell?.clientWidth;
    }
    _addRowsResizer() {
        const table = this._table;
        const rowsLabel = table.querySelectorAll('.vertical-label');
        rowsLabel.forEach((cell) => {
            const rowResizer = this.renderer.createElement('div');
            this.renderer.appendChild(cell, rowResizer);
            rowResizer.setAttribute('class', 'row-resizer');
            this.renderer.setStyle(cell, 'height', 'inherit');
            this.renderer.setStyle(cell, 'position', 'relative');
            this.renderer.setAttribute(rowResizer, 'style', 'cursor: row-resize; height:8px; position:absolute;bottom:0;left:0;right:0');
        });
    }
    _putBodyCellsContentIntoDiv() {
        const table = this._table;
        const bodyCells = table.querySelectorAll('body td:not(.vertical-label)');
        bodyCells.forEach((cell) => {
            const contentContainer = this.renderer.createElement('div');
            cell.children.forEach((child) => {
                contentContainer.appendChild(child);
            });
            this.renderer.setStyle(cell, 'overflow', 'hidden');
            this.renderer.setStyle(cell, 'height', 'inherit');
            this.renderer.setStyle(contentContainer, 'height', 'inherit');
            this.renderer.setStyle(contentContainer, 'display', 'block');
            cell.appendChild(contentContainer);
        });
    }
    _getSideCell(currentCell) {
        const currentRow = this._currentCell.parentNode?.children;
        if (currentRow) {
            const cellIndexInRow = Array.from(currentRow).indexOf(currentCell);
            return Array.from(currentRow)[cellIndexInRow + 1];
        }
        return null;
    }
    _changeWidth(fitWidth, sideCell, currentCell, changedCurrentCellWidth, changedSideCellWidth) {
        if (fitWidth) {
            if (sideCell && changedCurrentCellWidth >= this.minWidth && changedSideCellWidth >= this.minWidth) {
                this.renderer.setStyle(sideCell, 'width', changedSideCellWidth + 'px');
                this.renderer.setStyle(sideCell, 'min-width', changedSideCellWidth + 'px');
                this.renderer.setStyle(currentCell, 'width', changedCurrentCellWidth + 'px');
                this.renderer.setStyle(currentCell, 'min-width', changedCurrentCellWidth + 'px');
            }
        }
        else if (changedCurrentCellWidth >= this.minWidth) {
            this.renderer.setStyle(currentCell, 'width', changedCurrentCellWidth + 'px');
            this.renderer.setStyle(currentCell, 'min-width', changedCurrentCellWidth + 'px');
        }
    }
    _changeHeight(currentCell, changedHeight, minHeight) {
        if (changedHeight > minHeight) {
            this.renderer.setStyle(currentCell.closest('tr'), 'height', changedHeight + 'px');
        }
    }
    _initTable() {
        if (this._isInitTable) {
            return;
        }
        this._isInitTable = true;
        const table = this._table;
        const parent = table.parentElement;
        this.renderer.setStyle(parent, 'overflow-x', this.fitWidth ? 'hidden' : 'auto');
        // this.renderer.setStyle(parent, 'overflow-y', 'auto');
        this.renderer.setStyle(parent, 'width', '100%');
    }
    _setTableMode(isFitWidth) {
        if (isFitWidth) {
            this._setTableFitSize();
        }
    }
    _setTableFreeSize() {
        const table = this._table;
        this.renderer.setStyle(table, 'width', this.containerWidth + 'px');
        this.renderer.setStyle(table, 'max-width', 'unset');
        this.renderer.setStyle(table, 'min-width', this.containerWidth + 'px');
        const headCells = table.querySelectorAll('th');
        headCells.forEach((cell) => {
            const width = cell.offsetWidth;
            this.renderer.setStyle(cell, 'width', width + 'px');
            this.renderer.setStyle(cell, 'min-width', width + 'px');
        });
    }
    _setTableFitSize() {
        const table = this._table;
        this.renderer.setStyle(table, 'width', '100%');
        this.renderer.setStyle(table, 'max-width', '100%');
    }
    _mouseDown(e) {
        if (e.srcElement.className === 'row-resizer') {
            this._resizeRow(e);
            this.renderer.setStyle(this._el.nativeElement, 'cursor', 'row-resize');
        }
        else if (e.srcElement.className === 'column-resizer') {
            this._resizeColumn(e);
            this.renderer.setStyle(this._el.nativeElement, 'cursor', 'col-resize');
        }
    }
    _mouseMove(e) {
        if (e.buttons !== 0) {
            if (this._currentResizer === "Column" /* Resizer.Column */) {
                if (!this._isInitTable) {
                    this._initializeTable();
                }
                const endX = e.pageX;
                const dx = endX - this._startX;
                const changedCurrentCellWidth = this._currentColumnWidth - dx;
                const changedSideCellWidth = this._sideColumnWidth + dx;
                this._changeWidth(this.fitWidth, this._sideCell, this._currentCell, changedCurrentCellWidth, changedSideCellWidth);
            }
            else if (this._currentResizer === "Row" /* Resizer.Row */) {
                const endY = e.pageY;
                const dy = endY - this._startY;
                const changedCurrentRowHeight = this._currentRowHeight + dy;
                this._changeHeight(this._currentCell, changedCurrentRowHeight, this.minHeight);
            }
        }
    }
    _mouseUp() {
        if (this._currentResizer) {
            const table = this._el.nativeElement;
            const headers = table.querySelectorAll('th');
            const columnResized = [];
            for (let i = 0; i < headers.length; i++) {
                const header = headers[i];
                const columnName = header.attributes['columnname']?.value;
                if (typeof columnName !== 'undefined') {
                    columnResized.push({ name: columnName, width: header.offsetWidth, thDom: header });
                }
            }
            this.columnResized.emit(columnResized);
        }
        this._currentResizer = null;
        this.renderer.setStyle(this._el.nativeElement, 'cursor', 'default');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TableResizerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: TableResizerDirective, isStandalone: false, selector: "[tableResizer]", inputs: { fitWidth: "fitWidth", minWidth: "minWidth", minHeight: "minHeight", containerWidth: "containerWidth", rowResizer: "rowResizer", enableResizing: "enableResizing" }, outputs: { columnResized: "columnResized" }, host: { listeners: { "mousedown": "moseDown($event)", "mousemove": "moseMove($event)" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TableResizerDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[tableResizer]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { fitWidth: [{
                type: Input
            }], minWidth: [{
                type: Input
            }], minHeight: [{
                type: Input
            }], containerWidth: [{
                type: Input
            }], rowResizer: [{
                type: Input
            }], enableResizing: [{
                type: Input
            }], columnResized: [{
                type: Output
            }], moseDown: [{
                type: HostListener,
                args: ['mousedown', ['$event']]
            }], moseMove: [{
                type: HostListener,
                args: ['mousemove', ['$event']]
            }] } });

class UlvCommandDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.commandClick = new EventEmitter();
        this.$execute = new Subject();
    }
    onClick(event) {
        if (this.disable) {
            return false;
        }
        const button = this.ulvCommandHandler;
        event.stopPropagation();
        event.preventDefault();
        this.commandClick.emit(button);
        setTimeout(() => {
            // add settimeout because we need select row before execute row
            // executeUlvCommandHandler(button);
            this.$execute.next();
        });
        return false;
    }
    ngOnInit() {
        super.ngOnInit();
        this.$execute
            .pipe(exhaustMap(() => {
            executeUlvCommandHandler(this.ulvCommandHandler);
            return timer(1000); // ۱ ثانیه بلاک می‌شود
        }))
            .subscribe();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UlvCommandDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: UlvCommandDirective, isStandalone: false, selector: "[ulvCommandHandler]", inputs: { ulvCommandHandler: "ulvCommandHandler", disable: "disable" }, outputs: { commandClick: "commandClick" }, host: { listeners: { "click": "onClick($event)" } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UlvCommandDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[ulvCommandHandler]',
                    standalone: false
                }]
        }], propDecorators: { ulvCommandHandler: [{
                type: Input
            }], disable: [{
                type: Input
            }], commandClick: [{
                type: Output
            }], onClick: [{
                type: HostListener,
                args: ['click', ['$event']]
            }] } });

class UntilInViewDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.intersectionDebounce = 100;
        this._templateRef = inject(TemplateRef);
        this._vcr = inject(ViewContainerRef);
        this._cdr = inject(ChangeDetectorRef);
        this.viewed$ = new Subject();
    }
    viewed() {
        this.viewed$.next();
        this._vcr.createEmbeddedView(this._templateRef);
        this._cdr.detectChanges();
    }
    ngOnInit() {
        super.ngOnInit();
        const element = this.untilInView.nativeElement;
        const config = {
            root: null,
            rootMargin: '0px',
            threshold: 0
        };
        fromIntersectionObserver(element, config, this.intersectionDebounce)
            .pipe(takeUntil(this.viewed$), takeUntil(this._onDestroy$))
            .subscribe(() => {
            this.viewed();
        });
    }
    ngOnDestroy() {
        this._onDestroy$.next();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UntilInViewDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: UntilInViewDirective, isStandalone: false, selector: "[untilInView]", inputs: { untilInView: "untilInView", intersectionDebounce: "intersectionDebounce" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: UntilInViewDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[untilInView]',
                    standalone: false
                }]
        }], propDecorators: { untilInView: [{
                type: Input
            }], intersectionDebounce: [{
                type: Input
            }] } });

class WorfkflowwChoiceCommandDirective {
    constructor() {
        this.commandClick = new EventEmitter();
        this.workflowExecuteChoiceStatusChanged = new EventEmitter();
        this.status = {
            loading: false,
            result: null,
            error: null
        };
    }
    onClick(event) {
        if (typeof this.enableCommand === typeof undefined) {
            this.enableCommand = true;
        }
        if (!this.enableCommand) {
            return true;
        }
        event.stopPropagation();
        event.preventDefault();
        const choice = this.wfChoice;
        const param = {
            mo: this.mo,
            choiceDef: { ...choice }
        };
        this.status = { choice, loading: true, result: null, error: null };
        this.workflowExecuteChoiceStatusChanged.emit(this.status);
        ExecuteWorkflowChoiceDef(this, param, (result) => {
            this.workflowExecuteChoiceStatusChanged.emit({ ...this.status, loading: false, result, error: null });
        }, (error) => {
            this.workflowExecuteChoiceStatusChanged.emit({ ...this.status, loading: false, result: null, error });
        });
        this.commandClick.emit();
        return false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: WorfkflowwChoiceCommandDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: WorfkflowwChoiceCommandDirective, isStandalone: false, selector: "[wfChoice]", inputs: { wfChoice: "wfChoice", mo: "mo", enableCommand: "enableCommand" }, outputs: { commandClick: "commandClick", workflowExecuteChoiceStatusChanged: "workflowExecuteChoiceStatusChanged" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: WorfkflowwChoiceCommandDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[wfChoice]',
                    standalone: false
                }]
        }], propDecorators: { wfChoice: [{
                type: Input
            }], mo: [{
                type: Input
            }], enableCommand: [{
                type: Input
            }], commandClick: [{
                type: Output
            }], workflowExecuteChoiceStatusChanged: [{
                type: Output
            }], onClick: [{
                type: HostListener,
                args: ['click', ['$event']]
            }] } });

class CopyDirective extends BaseDirective {
    /**
     *
     */
    constructor() {
        super();
        this._toastService = inject(TOAST_SERVICE, { optional: true });
        if (!navigator.clipboard) {
            this._renderer2.addClass(this._el.nativeElement, 'hide');
        }
    }
    doCopy() {
        const inputEl = this._inputEl;
        inputEl.value = this.copy;
        const copyText = inputEl;
        /* Select the text field */
        copyText.select();
        copyText.setSelectionRange(0, inputEl.value.length); /* For mobile devices */
        /* Copy the text inside the text field */
        navigator.clipboard.writeText(copyText.value);
        if (this._toastService) {
            const texttoCopy = this.copy.length > 40 ? this.copy.substring(0, 40) + ' ...' : this.copy;
            this._toastService.open(` ${texttoCopy} copied. `, { duration: 5000 });
        }
    }
    ngOnInit() {
        super.ngOnInit();
        const dom = this._el.nativeElement;
        const inputEl = document.createElement('input');
        inputEl.style.display = 'none';
        dom.appendChild(inputEl);
        this._inputEl = inputEl;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CopyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: CopyDirective, isStandalone: false, selector: "[copy]", inputs: { copy: "copy" }, host: { listeners: { "click": "doCopy()" } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CopyDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[copy]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { copy: [{
                type: Input
            }], doCopy: [{
                type: HostListener,
                args: ['click']
            }] } });

class EllapsisTextDirective extends BaseDirective {
    constructor() {
        super();
        this.ellapsised = new EventEmitter();
        this._widthChange$ = new Subject();
        this.myObserver = new ResizeObserver((entries) => {
            entries.forEach((entry) => {
                if (entry.target === this._el.nativeElement) {
                    this._widthChange$.next(entry.target.offsetWidth);
                }
            });
        });
        this.myObserver.observe(this._el.nativeElement);
        this._widthChange$
            .asObservable()
            .pipe(takeUntil$1(this._onDestroy$), debounceTime$1(500))
            .subscribe((_) => this._checkEllapsised());
    }
    ngOnDestroy() {
        this._onDestroy$.next();
        this.myObserver.disconnect();
        this.myObserver.unobserve(this._el.nativeElement);
    }
    _checkEllapsised() {
        if (this.disableEllapsis) {
            return;
        }
        const labelWidth = measureText(this.ellapsisText, this.fontSize);
        if (labelWidth < 1) {
            return;
        }
        this.ellapsised.emit(this._isEllipsisActive(this._el.nativeElement));
    }
    _isEllipsisActive(element) {
        return element.scrollWidth > element.clientWidth;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: EllapsisTextDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: EllapsisTextDirective, isStandalone: false, selector: "[ellapsisText]", inputs: { ellapsisText: "ellapsisText", fontSize: "fontSize", disableEllapsis: "disableEllapsis" }, outputs: { ellapsised: "ellapsised" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: EllapsisTextDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[ellapsisText]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { ellapsisText: [{
                type: Input
            }], fontSize: [{
                type: Input
            }], disableEllapsis: [{
                type: Input
            }], ellapsised: [{
                type: Output
            }] } });

class MobileDirective extends BaseDirective {
    ngOnInit() {
        super.ngOnInit();
        const isMobile = getDeviceIsMobile();
        if (!isMobile) {
            return;
        }
        const dom = this._el.nativeElement;
        this._renderer2.addClass(dom, 'mobile');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MobileDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: MobileDirective, isStandalone: false, selector: "[mobile]", usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MobileDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[mobile]',
                    standalone: false
                }]
        }] });

class BodyClickDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this._document = inject(DOCUMENT);
    }
    onClick() {
        if (this.disableBodyClick) {
            return;
        }
        bodyClick(this._document, this._el);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BodyClickDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: BodyClickDirective, isStandalone: false, selector: "[bodyClick]", inputs: { disableBodyClick: "disableBodyClick" }, host: { listeners: { "click": "onClick()" } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BodyClickDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[bodyClick]',
                    standalone: false
                }]
        }], propDecorators: { disableBodyClick: [{
                type: Input
            }], onClick: [{
                type: HostListener,
                args: ['click']
            }] } });

class PreventDefaultDirective extends BaseDirective {
    onClick(e) {
        e.preventDefault();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PreventDefaultDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: PreventDefaultDirective, isStandalone: false, selector: "[preventDefault]", host: { listeners: { "click": "onClick($event)" } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PreventDefaultDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[preventDefault]',
                    standalone: false
                }]
        }], propDecorators: { onClick: [{
                type: HostListener,
                args: ['click', ['$event']]
            }] } });

class StopPropagationDirective extends BaseDirective {
    onClick(e) {
        e.stopPropagation();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: StopPropagationDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: StopPropagationDirective, isStandalone: false, selector: "[stopPropagation]", host: { listeners: { "click": "onClick($event)" } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: StopPropagationDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[stopPropagation]',
                    standalone: false
                }]
        }], propDecorators: { onClick: [{
                type: HostListener,
                args: ['click', ['$event']]
            }] } });

class CountDownDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.expired = new EventEmitter();
        this._dateService = inject(DateService);
    }
    ngOnInit() {
        super.ngOnInit();
        this._setCountDown(this.value);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { value } = changes;
        value && !value.firstChange && this._setCountDown(value.currentValue);
    }
    _setCountDown(value) {
        const _tempValue = value;
        const exp = this._dateService.getMoment(_tempValue);
        this.clearInterval();
        this._interval = setInterval(() => {
            const now = this._dateService.getMoment(new Date());
            const diffDuration = this._dateService.duration(exp.diff(now));
            const month = diffDuration.months();
            const days = diffDuration.days();
            const hours = diffDuration.hours().toLocaleString('en-US', {
                minimumIntegerDigits: 2,
                useGrouping: false
            });
            const minutes = diffDuration.minutes().toLocaleString('en-US', {
                minimumIntegerDigits: 2,
                useGrouping: false
            });
            const seconds = diffDuration.seconds().toLocaleString('en-US', {
                minimumIntegerDigits: 2,
                useGrouping: false
            });
            this.countDownText = `
            ${this.includeMonth ? this._getMonthText(month) : ''} 
            ${this.includeDay ? this._daysText(days) : ''} 
            ${this._getTimeText(hours, minutes, seconds)}`;
            this._el.nativeElement.innerHTML = this.countDownText;
        }, 1000);
    }
    clearInterval() {
        if (this._interval) {
            clearInterval(this._interval);
            this._interval = null;
        }
    }
    _getMonthText(month) {
        return month > 0 ? `${month} ماه` : '';
    }
    _daysText(days) {
        return days > 0 ? `${days} روز` : '';
    }
    _getTimeText(hours, minutes, seconds) {
        if (hours < 0 || minutes < 0 || seconds < 0) {
            this.clearInterval();
            this.expired.emit();
            return `${this.includeHour ? '00:' : ''}${this.includeMinute ? '00:' : ''}00`;
        }
        return `${this.includeHour ? hours + ':' : ''}${this.includeMinute ? minutes + ':' : ''}${seconds}`;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CountDownDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: CountDownDirective, isStandalone: false, selector: "[countDown]", inputs: { value: ["countDown", "value"], includeMonth: "includeMonth", includeDay: "includeDay", includeHour: "includeHour", includeMinute: "includeMinute" }, outputs: { expired: "expired" }, providers: [
            {
                provide: DateService,
                useFactory: getDateService,
                deps: [LogService]
            }
        ], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CountDownDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[countDown]',
                    providers: [
                        {
                            provide: DateService,
                            useFactory: getDateService,
                            deps: [LogService]
                        }
                    ],
                    standalone: false
                }]
        }], propDecorators: { value: [{
                type: Input,
                args: ['countDown']
            }], includeMonth: [{
                type: Input
            }], includeDay: [{
                type: Input
            }], includeHour: [{
                type: Input
            }], includeMinute: [{
                type: Input
            }], expired: [{
                type: Output
            }] } });

class RouteFormChangeDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.stateChanged = new EventEmitter();
        this._router = inject(Router);
    }
    ngOnInit() {
        super.ngOnInit();
        this._router.events
            .pipe(takeUntil$1(this._onDestroy$), filter$1((event) => event instanceof NavigationStart && event instanceof RouterEvent), mergeWith(this._portalService.openForm$))
            .subscribe((_event) => {
            this.stateChanged.emit();
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RouteFormChangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: RouteFormChangeDirective, isStandalone: false, selector: "[routeFormChange]", inputs: { handleBodyClick: "handleBodyClick" }, outputs: { stateChanged: "stateChanged" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RouteFormChangeDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[routeFormChange]',
                    standalone: false
                }]
        }], propDecorators: { handleBodyClick: [{
                type: Input
            }], stateChanged: [{
                type: Output
            }] } });

class DynamicStyleDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.id = `form_${getUniqueId(4)}`;
    }
    ngOnInit() {
        super.ngOnInit();
        this._style = AddDynamicFormStyles(this.id, this.cssStyle);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { cssStyle } = changes;
        if (cssStyle && !cssStyle.firstChange) {
            RemoveDynamicFormStyles(this._style);
            this._style = AddDynamicFormStyles(this.id, cssStyle.currentValue);
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        RemoveDynamicFormStyles(this._style);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicStyleDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: DynamicStyleDirective, isStandalone: false, selector: "[cssStyle]", inputs: { cssStyle: "cssStyle" }, host: { properties: { "attr.id": "this.id" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicStyleDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[cssStyle]',
                    standalone: false
                }]
        }], propDecorators: { cssStyle: [{
                type: Input
            }], id: [{
                type: HostBinding,
                args: ['attr.id']
            }] } });

class NowraptextDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this._renderer2 = inject(Renderer2);
    }
    ngOnInit() {
        const dom = this._el.nativeElement;
        this._renderer2.addClass(dom, 'ellapsis');
        this._renderer2.setStyle(dom, 'width', this.width);
        this._renderer2.setStyle(dom, 'display', 'block');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NowraptextDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: NowraptextDirective, isStandalone: false, selector: "[nowraptext]", inputs: { width: "width" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NowraptextDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[nowraptext]',
                    standalone: false
                }]
        }], propDecorators: { width: [{
                type: Input
            }] } });

class LabelmandatoryDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this._document = inject(DOCUMENT);
    }
    ngOnInit() {
        super.ngOnInit();
        this._checkStar(this.lblMandatory);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { lblMandatory } = changes;
        if (lblMandatory && !lblMandatory.firstChange) {
            this._checkStar(lblMandatory.currentValue);
        }
    }
    _checkStar(mandatory) {
        const dom = this._el.nativeElement;
        let style = '';
        if (this.mandatoryStyle) {
            style = `style='${this.mandatoryStyle}'`;
        }
        if (mandatory) {
            dom.innerHTML += `<strong ${style}>*</strong>`;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LabelmandatoryDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: LabelmandatoryDirective, isStandalone: false, selector: "[lblMandatory]", inputs: { lblMandatory: "lblMandatory", mandatoryStyle: "mandatoryStyle" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LabelmandatoryDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[lblMandatory]',
                    standalone: false
                }]
        }], propDecorators: { lblMandatory: [{
                type: Input
            }], mandatoryStyle: [{
                type: Input
            }] } });

class AbsoluteDivBodyDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.elemCreated = new EventEmitter();
        this.id = '_' + getUniqueId(4);
    }
    ngOnInit() {
        super.ngOnInit();
        this._appendDivToBody();
    }
    _appendDivToBody() {
        const elemDiv = document.createElement('div');
        elemDiv.id = this.id;
        elemDiv.style.cssText = 'position:absolute;opacity:0;visibility:hidden;';
        document.body.appendChild(elemDiv);
        this.elem = elemDiv;
        this.elemCreated.emit(elemDiv);
    }
    _getEl() {
        const x = document.querySelector('#' + this.id);
        return x;
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this.elem?.remove();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AbsoluteDivBodyDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: AbsoluteDivBodyDirective, isStandalone: false, selector: "[absDiv]", outputs: { elemCreated: "elemCreated" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AbsoluteDivBodyDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[absDiv]',
                    standalone: false
                }]
        }], propDecorators: { elemCreated: [{
                type: Output
            }] } });

class RenderUlvDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.reportId = input();
        this._logService = inject(LogService);
        this._injector = inject(Injector);
        this._vcr = inject(ViewContainerRef);
    }
    ngOnInit() {
        super.ngOnInit();
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        this._render();
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        if (this.component) {
            this.component.destroy();
        }
    }
    _render() {
        if (!this.reportId()) {
            this._logService.error(`reportId not produced to render ulv in renderulv directive.`);
            return;
        }
        this._portalService
            .renderUlvMainUi({
            Id: 0,
            ReportId: this.reportId(),
            isReportPage: false
        }, this._vcr, this._injector, false)
            .subscribe();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RenderUlvDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.6", type: RenderUlvDirective, isStandalone: false, selector: "[renderUlv]", inputs: { reportId: { classPropertyName: "reportId", publicName: "reportId", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RenderUlvDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[renderUlv]',
                    standalone: false
                }]
        }] });

class PrintFilesDirective {
    constructor() { }
    _handleClick() {
        const fullImageList = this.files?.map(function (record) {
            return record.mediaUrl;
        });
        const setting = {
            sources: fullImageList,
            customCss: "width:100%;margin-top:10px;",
            isCenter: true,
            header: 'لیست تصاویر',
        };
        PrintImage(setting);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PrintFilesDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: PrintFilesDirective, isStandalone: false, selector: "[printFiles]", inputs: { files: "files", file: "file", isImageGallery: "isImageGallery", component: "component" }, host: { listeners: { "click": "_handleClick()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PrintFilesDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[printFiles]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { files: [{
                type: Input
            }], file: [{
                type: Input
            }], isImageGallery: [{
                type: Input
            }], component: [{
                type: Input
            }], _handleClick: [{
                type: HostListener,
                args: ['click']
            }] } });

class SaveImageDirective {
    _handleClick() {
        if (!this.src || !this.name) {
            return;
        }
        SaveImageToFile(this.name, this.src);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SaveImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: SaveImageDirective, isStandalone: false, selector: "[saveImage]", inputs: { name: "name", src: "src" }, host: { listeners: { "click": "_handleClick()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SaveImageDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[saveImage]',
                    standalone: false
                }]
        }], propDecorators: { name: [{
                type: Input
            }], src: [{
                type: Input
            }], _handleClick: [{
                type: HostListener,
                args: ['click']
            }] } });

class WebOtpDirective {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this.otpRecieved = new EventEmitter();
        const _el = inject(ElementRef);
        const _renderer2 = inject(Renderer2);
        const input = _el.nativeElement;
        _renderer2.setAttribute(input, 'autocomplete', 'one-time-code');
        if ('OTPCredential' in window) {
            if (!input) {
                return;
            }
            this._ac = new AbortController();
            const x = navigator.credentials;
            x.get({
                otp: { transport: ['sms'] },
                signal: this._ac.signal
            })
                .then((otp) => {
                console.log(otp);
                if (otp) {
                    this.autoUpdate && (input.value = otp.code);
                    this.otpRecieved.emit(otp.code);
                }
            })
                .catch((err) => {
                console.error(err);
            });
        }
    }
    ngOnDestroy() {
        if (this._ac) {
            this._ac.abort();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: WebOtpDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: WebOtpDirective, isStandalone: false, selector: "[appWebotp]", inputs: { autoUpdate: "autoUpdate" }, outputs: { otpRecieved: "otpRecieved" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: WebOtpDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[appWebotp]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { otpRecieved: [{
                type: Output
            }], autoUpdate: [{
                type: Input
            }] } });

class SplideSliderDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.type = 'small';
        this.width = '100%';
        this.carouselCls = 'carousel-full';
        this.numWidth = window.innerWidth;
        this.height = this.numWidth / 2;
        this.rval = inject(MoReportValuePipe);
        this._picFieldSrc = inject(PictureFieldSourcePipe);
        this._renderer2 = inject(Renderer2);
        this._el = inject(ElementRef);
        this._portalService = inject(PortalService);
    }
    get dom() {
        return this._el.nativeElement;
    }
    ngOnInit() {
        super.ngOnInit();
        this.type = this.type || 'full';
        this._width = this.width;
        this._portalService.landscape$
            .pipe(takeUntil$1(this._onDestroy$), debounceTime$1(100))
            .subscribe((_c) => this._refreshSplide());
    }
    ngAfterViewInit() {
        this._init();
        setTimeout(() => {
            this._refreshSplide();
        }, 200);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { moDataList } = changes;
        if (moDataList && moDataList.currentValue) {
            this._refreshSplide();
        }
    }
    onRefresh() {
        this._refreshSplide();
    }
    _refreshSplide() {
        this._splide && this._splide.refresh();
        this._splide && this._splide.length < this._splide.options.perPage && this._splide.Components.Arrows.destroy();
    }
    _init() {
        this._renderer2.setAttribute(this.dom, 'data-splide', `{"direction":"${this.direction}"}`);
        this._splide = new Splide(this.dom, {
            ...this._getCommonOptions,
            gap: +this.sliderGap,
            padding: +this.sliderPadding,
            perPage: +this.sliderPerPage,
            breakpoints: {
                480: {
                    perPage: +this.breakpoint480
                },
                768: {
                    perPage: +this.breakpoint768
                },
                991: {
                    perPage: +this.breakpoint991
                },
                1279: {
                    perPage: +this.breakpoint1279
                }
            }
        }).mount();
    }
    get _getCommonOptions() {
        return {
            rewind: true,
            arrows: this.moDataList?.length > 1,
            type: 'slide',
            direction: this.direction,
            pagination: false
        };
    }
    get direction() {
        return BarsaApi.LoginFormData.IsRtl ? 'rtl' : 'ltr';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SplideSliderDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: SplideSliderDirective, isStandalone: false, selector: "[splideSlider]", inputs: { moDataList: "moDataList", type: "type", breakpoint991: "breakpoint991", breakpoint768: "breakpoint768", breakpoint480: "breakpoint480", breakpoint1279: "breakpoint1279", sliderPerPage: "sliderPerPage", sliderGap: "sliderGap", sliderPadding: "sliderPadding", width: "width" }, host: { properties: { "style.width": "this._width" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SplideSliderDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[splideSlider]',
                    standalone: false
                }]
        }], propDecorators: { _width: [{
                type: HostBinding,
                args: ['style.width']
            }], moDataList: [{
                type: Input
            }], type: [{
                type: Input
            }], breakpoint991: [{
                type: Input
            }], breakpoint768: [{
                type: Input
            }], breakpoint480: [{
                type: Input
            }], breakpoint1279: [{
                type: Input
            }], sliderPerPage: [{
                type: Input
            }], sliderGap: [{
                type: Input
            }], sliderPadding: [{
                type: Input
            }], width: [{
                type: Input
            }] } });

class DynamicRootVariableDirective extends BaseDirective {
    ngOnInit() {
        super.ngOnInit();
        this._addDynamicFormStyles(this.cssVariableName, this.cssVariableValue);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { cssVariableName, cssVariableValue } = changes;
        if (cssVariableName && !cssVariableName.firstChange) {
            this._removeDynamicFormStyles();
            this._addDynamicFormStyles(cssVariableName.currentValue, this.cssVariableValue);
        }
        else if (cssVariableValue && !cssVariableValue.firstChange) {
            this._removeDynamicFormStyles();
            this._addDynamicFormStyles(this.cssVariableName, cssVariableValue.currentValue);
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this._removeDynamicFormStyles();
    }
    refresh() {
        this._removeDynamicFormStyles();
        this._addDynamicFormStyles(this.cssVariableName, this.cssVariableValue);
    }
    _addDynamicFormStyles(cssVariableName, cssVariableValue) {
        if (this.disable) {
            return;
        }
        this._style = addDynamicVariableTo(cssVariableName, cssVariableValue);
    }
    _removeDynamicFormStyles() {
        removeDynamicStyle(this._style);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicRootVariableDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: DynamicRootVariableDirective, isStandalone: false, selector: "[cssRootVariable]", inputs: { cssVariableName: "cssVariableName", cssVariableValue: "cssVariableValue", disable: "disable" }, exportAs: ["cssRootVariable"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DynamicRootVariableDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[cssRootVariable]',
                    exportAs: 'cssRootVariable',
                    standalone: false
                }]
        }], propDecorators: { cssVariableName: [{
                type: Input
            }], cssVariableValue: [{
                type: Input
            }], disable: [{
                type: Input
            }] } });

class HorizontalResponsiveDirective extends BaseDirective {
    ngOnInit() {
        super.ngOnInit();
        this._addDynamicFormStyles(this.hrResponsive);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { hrResponsive } = changes;
        if (hrResponsive && !hrResponsive.firstChange) {
            this._addDynamicFormStyles(hrResponsive.currentValue);
        }
    }
    _addDynamicFormStyles(hResponsive) {
        if (!hResponsive || !hResponsive?.IsActive) {
            return;
        }
        const { XxlColumns, XlColumns, LColumns, MdColumns, SmColumns } = hResponsive;
        const root = this._el.nativeElement;
        root.style.setProperty('--horizontal-display', 'grid');
        root.style.setProperty('--horizontal-grid-templateXxl', `repeat(${XxlColumns},1fr)`);
        root.style.setProperty('--horizontal-grid-templateXl', `repeat(${XlColumns},1fr)`);
        root.style.setProperty('--horizontal-grid-templateL', `repeat(${LColumns},1fr)`);
        root.style.setProperty('--horizontal-grid-templateMd', `repeat(${MdColumns},1fr)`);
        root.style.setProperty('--horizontal-grid-templateSm', `repeat(${SmColumns},1fr)`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HorizontalResponsiveDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: HorizontalResponsiveDirective, isStandalone: false, selector: "[hrResponsive]", inputs: { disable: "disable", config: "config", hrResponsive: "hrResponsive" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HorizontalResponsiveDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[hrResponsive]',
                    standalone: false
                }]
        }], propDecorators: { disable: [{
                type: Input
            }], config: [{
                type: Input
            }], hrResponsive: [{
                type: Input
            }] } });

class MeasureFormTitleWidthDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.ismobile = getDeviceIsMobile();
    }
    ngAfterViewInit() {
        super.ngOnInit();
        this._addClass(this.mWidthTitle);
    }
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        changes.mWidthTitle && !changes.mWidthTitle.firstChange && this._addClass(changes.mWidthTitle.currentValue);
    }
    _addClass(title) {
        if (!this.ismobile && !this.enableMobile) {
            return;
        }
        this._renderer2.removeClass(this._el.nativeElement, 'title-auto');
        const x = measureText(title);
        const w = this._el.nativeElement.offsetWidth;
        x > w / 2
            ? this._renderer2.addClass(this._el.nativeElement, 'overflow-toolbar')
            : this._renderer2.addClass(this._el.nativeElement, 'title-auto');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MeasureFormTitleWidthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: MeasureFormTitleWidthDirective, isStandalone: false, selector: "[mWidthTitle]", inputs: { mWidthTitle: "mWidthTitle", enableMobile: "enableMobile" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MeasureFormTitleWidthDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[mWidthTitle]',
                    standalone: false
                }]
        }], propDecorators: { mWidthTitle: [{
                type: Input
            }], enableMobile: [{
                type: Input
            }] } });

class OverflowTextDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this._checkText$ = new Subject();
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        this._checkText$.pipe(takeUntil$1(this._onDestroy$), debounceTime$1(500)).subscribe(() => this._checkOverflow());
        const handleResize = (entries) => {
            if (entries.length) {
                this._checkText$.next();
            }
        };
        const resizeObserver = new ResizeObserver(handleResize);
        // Observe an element
        resizeObserver.observe(this._el.nativeElement);
        this.resizeObserver = resizeObserver;
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this.resizeObserver.disconnect();
    }
    isTextOverflowing(element) {
        return element.scrollWidth > element.clientWidth;
    }
    _checkOverflow() {
        if (this.isTextOverflowing(this._el.nativeElement)) {
            this._addOverflowTextClass();
        }
    }
    _addOverflowTextClass() {
        this._renderer2.removeClass(this._el.nativeElement, 'overflow-text-in');
        this._renderer2.addClass(this._el.nativeElement, 'overflow-text-in');
        this._renderer2.addClass(this._el.nativeElement.parentNode, 'child-has-overflow-text');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: OverflowTextDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: OverflowTextDirective, isStandalone: false, selector: "[overflowText]", exportAs: ["overflowText"], usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: OverflowTextDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[overflowText]',
                    standalone: false,
                    exportAs: 'overflowText'
                }]
        }] });

class ShortcutRegisterDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this._ulvMainService = inject(UlvMainService);
    }
    ngOnInit() {
        super.ngOnInit();
        this._initShortCuts();
    }
    _initShortCuts() {
        const shortcutList = this.shortcutRegister;
        if (!shortcutList) {
            return;
        }
        const moDataList = shortcutList;
        if (!moDataList?.length) {
            return;
        }
        const shortcuts = {};
        moDataList.forEach((curr) => {
            shortcuts[curr.CustomShortcutKey || curr.ShortcutKey$Caption] = { ...curr };
        });
        this._ulvMainService.setShortCuts(shortcuts);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ShortcutRegisterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ShortcutRegisterDirective, isStandalone: false, selector: "[shortcutRegister]", inputs: { shortcutRegister: "shortcutRegister" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ShortcutRegisterDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[shortcutRegister]',
                    standalone: false
                }]
        }], propDecorators: { shortcutRegister: [{
                type: Input
            }] } });

class ShortcutHandlerDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.shortCutCommand = new EventEmitter();
        this.onKeyEnter = (_) => {
            if (!this.shortcutHandler) {
                return;
            }
            const x = this.shortcutHandler[_.key];
            if (x) {
                this.shortCutCommand.emit(x);
            }
        };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ShortcutHandlerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ShortcutHandlerDirective, isStandalone: false, selector: "[shortcutHandler]", inputs: { shortcutHandler: "shortcutHandler" }, outputs: { shortCutCommand: "shortCutCommand" }, host: { listeners: { "keydown": "onKeyEnter($event)" } }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ShortcutHandlerDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[shortcutHandler]',
                    standalone: false
                }]
        }], propDecorators: { shortcutHandler: [{
                type: Input
            }], shortCutCommand: [{
                type: Output
            }], onKeyEnter: [{
                type: HostListener,
                args: ['keydown', ['$event']]
            }] } });

class BarsaReadonlyDirective extends BaseDirective {
    ngOnInit() {
        super.ngOnInit();
        const settings = this.barsaReadonly;
        const { DontShowRecalculateButton } = settings;
        if (DontShowRecalculateButton === true || typeof DontShowRecalculateButton === 'undefined') {
            this._renderer2.addClass(this._el.nativeElement, 'barsa-readonly');
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaReadonlyDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: BarsaReadonlyDirective, isStandalone: false, selector: "[barsaReadonly]", inputs: { barsaReadonly: "barsaReadonly" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaReadonlyDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[barsaReadonly]',
                    standalone: false
                }]
        }], propDecorators: { barsaReadonly: [{
                type: Input
            }] } });

class ResizeObserverDirective {
    constructor() {
        this.elResized = new EventEmitter();
        this.el = inject(ElementRef);
        this.zone = inject(NgZone);
    }
    ngOnInit() {
        this.observer = new ResizeObserver((entries) => {
            this.zone.run(() => {
                const entry = entries[0];
                this.elResized.emit(entry.contentRect);
            });
        });
        this.observer.observe(this.el.nativeElement);
    }
    ngOnDestroy() {
        this.observer.unobserve(this.el.nativeElement);
        this.observer.disconnect();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ResizeObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ResizeObserverDirective, isStandalone: false, selector: "[resizeObserver]", outputs: { elResized: "elResized" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ResizeObserverDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[resizeObserver]',
                    standalone: false
                }]
        }], propDecorators: { elResized: [{
                type: Output
            }] } });

class ColumnValueDirective extends BaseDirective {
    ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { columnValue } = changes;
        if (columnValue) {
            this._setInnerHtml(columnValue.currentValue);
        }
    }
    _setInnerHtml(value) {
        if (typeof value !== 'undefined') {
            const formattedValue = `\u202B${value}\u202C`;
            this._renderer2.setProperty(this._el.nativeElement, 'textContent', formattedValue);
        }
        else {
            this._renderer2.setProperty(this._el.nativeElement, 'textContent', '');
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnValueDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ColumnValueDirective, isStandalone: false, selector: "[columnValue]", inputs: { columnValue: "columnValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ColumnValueDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[columnValue]',
                    standalone: false
                }]
        }], propDecorators: { columnValue: [{
                type: Input
            }] } });

class ScrollToSelectedDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.scrollToSelected = false;
    }
    ngAfterViewInit() {
        super.ngAfterViewInit();
        this._scrollIntoView(this.scrollToSelected);
    }
    ngOnChanges(changes) {
        const { scrollToSelected } = changes;
        if (scrollToSelected && !scrollToSelected.firstChange) {
            this._scrollIntoView(scrollToSelected.currentValue);
        }
    }
    _scrollIntoView(scrollToSelected) {
        if (!scrollToSelected) {
            return;
        }
        this._el.nativeElement.scrollIntoView({
            behavior: 'auto',
            block: 'center'
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScrollToSelectedDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ScrollToSelectedDirective, isStandalone: false, selector: "[scrollToSelected]", inputs: { scrollToSelected: "scrollToSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScrollToSelectedDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[scrollToSelected]',
                    standalone: false
                }]
        }], propDecorators: { scrollToSelected: [{
                type: Input
            }] } });

class ScrollPersistDirective {
    constructor() {
        this.el = inject(ElementRef);
        this._inMemoryService = inject(InMemoryStorageService);
    }
    ngAfterViewInit() {
        this.observer = new IntersectionObserver((entries) => {
            const entry = entries[0];
            if (entry.isIntersecting) {
                const prevScroll = this._inMemoryService.getItem(this.key);
                if (prevScroll) {
                    this.el.nativeElement.scrollTop = +prevScroll;
                }
                this.observer.disconnect();
            }
        });
        this.observer.observe(this.el.nativeElement);
    }
    onScroll() {
        const scrollTop = this.el.nativeElement.scrollTop;
        this._inMemoryService.setItem(this.key, scrollTop);
    }
    ngOnDestroy() {
        if (this.observer) {
            this.observer.disconnect();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScrollPersistDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ScrollPersistDirective, isStandalone: false, selector: "[scrollPersist]", inputs: { key: ["scrollPersist", "key"] }, host: { listeners: { "scroll": "onScroll()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ScrollPersistDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[scrollPersist]',
                    standalone: false
                }]
        }], propDecorators: { key: [{
                type: Input,
                args: ['scrollPersist']
            }], onScroll: [{
                type: HostListener,
                args: ['scroll']
            }] } });

class TooltipDirective {
    constructor() {
        this.bnrcTooltip = input.required();
        this.hostRef = inject(ElementRef);
        this.renderer = inject(Renderer2);
        this.document = inject(DOCUMENT);
        this.tooltipEl = null;
    }
    ngOnDestroy() {
        this.removeTooltip();
    }
    onMouseEnter() {
        const { dir } = this.document.body;
        const isRtl = dir === 'rtl';
        this.tooltipEl = this.renderer.createElement('div');
        this.renderer.appendChild(document.body, this.tooltipEl);
        this.renderer.addClass(this.tooltipEl, 'bnrc-tooltip');
        this.tooltipEl.textContent = this.bnrcTooltip();
        const hostPosistion = this.hostRef.nativeElement.getBoundingClientRect();
        const tooltipPosistion = this.tooltipEl.getBoundingClientRect();
        const top = hostPosistion.top + hostPosistion.height / 2 - 12;
        let left = 0;
        if (isRtl) {
            left = hostPosistion.left - tooltipPosistion.width - 12;
        }
        else {
            left = hostPosistion.left + hostPosistion.width + 12;
        }
        this.renderer.setStyle(this.tooltipEl, 'top', `${top}px`);
        this.renderer.setStyle(this.tooltipEl, 'left', `${left}px`);
    }
    onMouseLeave() {
        this.removeTooltip();
    }
    removeTooltip() {
        if (this.tooltipEl) {
            this.renderer.removeChild(document.body, this.tooltipEl);
            this.tooltipEl = null;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.6", type: TooltipDirective, isStandalone: false, selector: "[bnrcTooltip]", inputs: { bnrcTooltip: { classPropertyName: "bnrcTooltip", publicName: "bnrcTooltip", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TooltipDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[bnrcTooltip]',
                    standalone: false
                }]
        }], propDecorators: { onMouseEnter: [{
                type: HostListener,
                args: ['mouseenter']
            }], onMouseLeave: [{
                type: HostListener,
                args: ['mouseleave']
            }] } });

class SimplebarDirective extends BaseDirective {
    async ngAfterViewInit() {
        if (typeof window === 'undefined') {
            return;
        } // برای SSR
        // CSS را فقط یکبار ایمپورت کن
        if (!window._simplebarCssLoaded) {
            const linkEl = this._renderer2.createElement('link');
            linkEl.rel = 'stylesheet';
            linkEl.href = 'assets/simplebar/simplebar.min.css'; // مسیر فایل CSS
            this._renderer2.appendChild(document.head, linkEl);
            window._simplebarCssLoaded = true;
        }
        // JS را lazy-load کن
        const SimpleBar = (await import('simplebar')).default;
        new SimpleBar(this._el.nativeElement, { autoHide: true });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SimplebarDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: SimplebarDirective, isStandalone: false, selector: "[simplebar]", usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SimplebarDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[simplebar]',
                    standalone: false
                }]
        }] });

class LeafletLongPressDirective {
    constructor() {
        this.longPressDuration = 600; // زمان نگه داشتن (ms)
        this.longPress = new EventEmitter(); // latlng رو به بیرون می‌ده
        this.sub = new Subscription();
    }
    ngOnInit() { }
    ngOnChanges(changes) {
        const { map } = changes;
        if (map && map.currentValue) {
            this._initMap();
        }
    }
    _initMap() {
        if (!this.map) {
            console.error('LeafletLongPressDirective: No map instance provided.');
            return;
        }
        const container = this.map.getContainer();
        const mousedown$ = merge(fromEvent(container, 'mousedown'), fromEvent(container, 'touchstart', { passive: false }));
        const mouseup$ = merge(fromEvent(container, 'mouseup'), fromEvent(container, 'touchend'));
        const move$ = merge(fromEvent(container, 'mousemove'), fromEvent(container, 'touchmove'));
        const cancelInteraction$ = merge(fromEvent(this.map, 'dragstart'), fromEvent(this.map, 'zoomstart'), fromEvent(this.map, 'movestart'));
        const longPress$ = mousedown$.pipe(switchMap$1((startEvent) => timer(this.longPressDuration).pipe(takeUntil(merge(mouseup$, move$, cancelInteraction$)), map(() => startEvent))), filter((e) => !!e));
        this.sub.add(longPress$.subscribe((startEvent) => {
            const originalEvent = startEvent instanceof MouseEvent ? startEvent : startEvent.touches?.[0] || startEvent;
            const latlng = this.map.mouseEventToLatLng(originalEvent);
            const point = this.map.mouseEventToContainerPoint(originalEvent);
            let markerData = null;
            let targetMarker = null;
            // پیدا کردن مارکری که این نقطه داخلش باشه
            this.map.eachLayer((layer) => {
                if (layer instanceof L.Marker) {
                    const iconEl = layer.getElement();
                    if (iconEl && iconEl.contains(originalEvent.target)) {
                        targetMarker = layer;
                        markerData = layer.options?.data ?? null;
                    }
                }
            });
            this.longPress.emit({
                latlng, // مختصات جغرافیایی
                point, // مختصات پیکسلی داخل کانتینر
                x: point.x,
                y: point.y,
                marker: targetMarker || null,
                data: markerData
            });
        }));
        // جلوگیری از contextmenu پیش‌فرض موبایل (اختیاری)
        container.addEventListener('contextmenu', (evt) => evt.preventDefault());
    }
    ngOnDestroy() {
        this.sub.unsubscribe();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LeafletLongPressDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: LeafletLongPressDirective, isStandalone: false, selector: "[leafletLongPress]", inputs: { map: ["leafletLongPress", "map"], longPressDuration: "longPressDuration" }, outputs: { longPress: "longPress" }, usesOnChanges: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LeafletLongPressDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[leafletLongPress]',
                    standalone: false
                }]
        }], propDecorators: { map: [{
                type: Input,
                args: ['leafletLongPress']
            }], longPressDuration: [{
                type: Input
            }], longPress: [{
                type: Output
            }] } });

class ResizeHandlerDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.$resize = new Subject();
    }
    ngOnInit() {
        super.ngOnInit();
        this._handleResize();
        this.$resize
            .asObservable()
            .pipe(takeUntil$1(this._onDestroy$), debounceTime$1(50))
            .subscribe(() => this._resize());
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this._ro.disconnect();
    }
    _resize() {
        if (typeof this.fnResize === 'function') {
            this.fnResize();
        }
    }
    _handleResize() {
        fromEvent(window, 'resize')
            .pipe(takeUntil$1(this._onDestroy$))
            .subscribe(() => {
            this.$resize.next();
        });
        // اگر container تغییر اندازه پیدا کرد (مثلاً parent تغییر کنه)
        try {
            this._ro = new ResizeObserver(() => {
                requestAnimationFrame(() => {
                    this.$resize.next();
                });
            });
            if (this._el?.nativeElement) {
                this._ro.observe(this._el.nativeElement);
            }
        }
        catch {
            // مرورگرهای خیلی قدیمی ممکنه ResizeObserver نداشته باشند
            // در آنصورت rely به window resize می‌کنیم
            // no-op
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ResizeHandlerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ResizeHandlerDirective, isStandalone: false, selector: "[resizeHandler]", inputs: { fnResize: "fnResize" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ResizeHandlerDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[resizeHandler]',
                    standalone: false
                }]
        }], propDecorators: { fnResize: [{
                type: Input
            }] } });

class SafeBottomDirective extends BaseDirective {
    constructor() {
        super(...arguments);
        this.isMobile = getDeviceIsMobile();
    }
    ngOnInit() {
        super.ngOnInit();
        if (!this.isMobile) {
            return;
        }
        let cls = this.disableBottom ? '' : 'safe-bottom-area-env';
        this.applyTop && (cls += 'safe-top-area-env');
        let clsNonStandlalone = this.disableBottom ? '' : 'safe-bottom-padding';
        this.applyTop && (clsNonStandlalone += 'safe-top-padding');
        const isStandAlone = !document.body.classList.contains('noStandalone');
        if (isStandAlone) {
            this._renderer2.addClass(this._el.nativeElement, cls);
        }
        else {
            this._renderer2.addClass(this._el.nativeElement, clsNonStandlalone);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SafeBottomDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: SafeBottomDirective, isStandalone: false, selector: "[safe-area]", inputs: { applyTop: "applyTop", disableBottom: "disableBottom" }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SafeBottomDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[safe-area]',
                    standalone: false
                }]
        }], propDecorators: { applyTop: [{
                type: Input
            }], disableBottom: [{
                type: Input
            }] } });

class PortalDynamicPageResolver {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this.portalService = inject(PortalService);
    }
    resolve(route
    // state: RouterStateSnapshot
    ) {
        // const url = decodeURI(route['_routerState'].url);
        // let url2=route.routeConfig?.path;
        // if(route.params.path)
        //   url2=route.params.path;
        // if(route.url.length==0)
        //   return of(null);
        // if(route.routeConfig?.path=='')
        // {
        //    url2 = url.split('/').find((c) => c && !c.startsWith('(')) ?? '';
        // }
        // else if(url2=='**'){
        //   url2=route.url[0].path;
        // }
        // url2 = '/' + url2;
        // const url=route.params.path;
        const _route = route;
        let pageData = route.data?.pageData;
        // if (!pageData && url) {
        //   pageData = this.portalService.pages.find((c) => c.Route == '/' + url);
        // }
        const urlSegments = _route._urlSegment.segments;
        const lastUrlSegment = urlSegments[urlSegments.length - 1];
        if (urlSegments.length === 1) {
            pageData = this.portalService.pages.find((c) => c.ParentRoute === '/' + lastUrlSegment.path && (c.IsDefaultRoute || c.IsDefaultRoute === 'True'));
        }
        else {
            pageData = this.portalService.pages.find((c) => c.Route === '/' + lastUrlSegment.path);
        }
        // }
        return this.portalService.resolveData(pageData);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalDynamicPageResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalDynamicPageResolver, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalDynamicPageResolver, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class PortalFormPageResolver {
    constructor() { }
    resolve(route
    // state: RouterStateSnapshot
    ) {
        const breadcrumb = route.params.bc; // means breadCrumb
        return breadcrumb;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalFormPageResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalFormPageResolver, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalFormPageResolver, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class PortalReportPageResolver {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this.portalService = inject(PortalService);
    }
    resolve(route
    // state: RouterStateSnapshot
    ) {
        // const url = decodeURI(route['_routerState'].url);
        // let url2=route.routeConfig?.path;
        // if(route.routeConfig?.path=='')
        // {
        //    url2 = url.split('/').find((c) => c && !c.startsWith('(')) ?? '';
        // }
        // if(url2=='**'){
        //   url2=route.url[0].path;
        // }
        // url2 = '/' + url2;
        const caption = route.params.id.split('__')[1];
        return this.portalService.resolveData(route.data.pageData).pipe(map((pageData) => {
            if (pageData) {
                pageData.BreadCrumb = caption;
            }
            return pageData;
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalReportPageResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalReportPageResolver, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PortalReportPageResolver, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class TileGroupBreadcrumResolver {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        this._localStorage = inject(LocalStorageService);
    }
    resolve(_route
    // state: RouterStateSnapshot
    ) {
        // const url = decodeURI(route['_routerState'].url);
        // let url2=route.routeConfig?.path;
        // if(route.routeConfig?.path=='')
        // {
        //    url2 = url.split('/').find((c) => c && !c.startsWith('(')) ?? '';
        // }
        // if(url2=='**'){
        //   url2=route.url[0].path;
        // }
        // url2 = '/' + url2;
        return this._localStorage.getItem('ActiveTile');
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TileGroupBreadcrumResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TileGroupBreadcrumResolver, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TileGroupBreadcrumResolver, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class LoginSettingsResolver {
    constructor() { }
    resolve(_route) {
        return fetch(`/assets/app-settings.json?x=${BarsaApi.LoginFormData.ChangeKeyVersion}`).then(function (res) {
            return res.text().then((c) => BarsaApi.Ext.decode(BarsaApi.Common.Util.ReplaceArabicCharchter(c))?.LoginSettings);
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LoginSettingsResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LoginSettingsResolver, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LoginSettingsResolver, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [] });

class EntitySettingsStore {
    constructor() {
        this.settingsService = inject(BaseSettingsService);
        this.subjects = new Map();
    }
    // ---------------------------------------------------
    // Subject
    // ---------------------------------------------------
    // ---------------------------------------------------
    // Observable
    // ---------------------------------------------------
    select$(entityId) {
        return this.getSubject(entityId).asObservable();
    }
    // ---------------------------------------------------
    // Snapshot
    // ---------------------------------------------------
    getSnapshot(entityId) {
        return this.getSubject(entityId).value;
    }
    // ---------------------------------------------------
    // Load
    // ---------------------------------------------------
    load(entityId) {
        const key = this.buildKey(entityId);
        const subject = this.getSubject(entityId);
        return this.settingsService.getSetting(key).pipe(tap$1((config) => {
            subject.next(config);
        }));
    }
    // ---------------------------------------------------
    // Save
    // ---------------------------------------------------
    save(entityId, partial) {
        const key = this.buildKey(entityId);
        const subject = this.getSubject(entityId);
        const current = subject.value ?? {};
        const updated = {
            ...current,
            ...partial
        };
        return this.settingsService.saveSetting(key, updated).pipe(tap$1(() => {
            subject.next(updated);
        }));
    }
    // ---------------------------------------------------
    // Replace
    // ---------------------------------------------------
    replace(entityId, value) {
        const key = this.buildKey(entityId);
        const subject = this.getSubject(entityId);
        return this.settingsService.saveSetting(key, value).pipe(tap$1(() => {
            subject.next(value);
        }));
    }
    // ---------------------------------------------------
    // Reset
    // ---------------------------------------------------
    reset(entityId) {
        const key = this.buildKey(entityId);
        const subject = this.getSubject(entityId);
        subject.next(null);
        return this.settingsService.removeSetting(key);
    }
    // ---------------------------------------------------
    // Cleanup
    // ---------------------------------------------------
    destroy(entityId) {
        const subject = this.subjects.get(entityId);
        if (subject) {
            subject.complete();
            this.subjects.delete(entityId);
        }
    }
    getSubject(entityId) {
        if (!this.subjects.has(entityId)) {
            this.subjects.set(entityId, new BehaviorSubject(null));
        }
        return this.subjects.get(entityId);
    }
    // ---------------------------------------------------
    // Utils
    // ---------------------------------------------------
    buildKey(entityId) {
        return `${this.keyPrefix}${entityId}`;
    }
}

class CalendarSettingsStore extends EntitySettingsStore {
    constructor() {
        super(...arguments);
        this.keyPrefix = 'cal_cfg_';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CalendarSettingsStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CalendarSettingsStore, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CalendarSettingsStore, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }] });

class FormNewComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this._router = inject(Router);
        this._activatedRoute = inject(ActivatedRoute);
        this._back$ = new Subject();
    }
    ngOnInit() {
        super.ngOnInit();
        const moId = this.settings.ResolveMoId || (this.settings.DisableGenerateId ? '0' : getUniqueId(4));
        const typeDefId = this.settings?.MetaTypeDef?.Id;
        const viewId = this.settings?.MetaView?.Id;
        this.params = { moId, typeDefId, viewId };
        this._back$
            .asObservable()
            .pipe(debounceTime$1(100))
            .subscribe(() => this._navigateBack());
    }
    onFormClose() {
        this._back$.next();
    }
    _navigateBack() {
        const pathPattern = this._activatedRoute.snapshot.routeConfig?.path || '';
        const segmentsCount = pathPattern.split('/').filter((segment) => segment.length > 0).length;
        const backSteps = '../'.repeat(segmentsCount);
        // const path = this._activatedRoute.snapshot.routeConfig?.path;
        this._router.navigate([backSteps], {
            relativeTo: this._activatedRoute,
            replaceUrl: true
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormNewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FormNewComponent, isStandalone: false, selector: "bnrc-form-new", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '<bnrc-form [params]="params"     (formClose)="onFormClose()"></bnrc-form>', isInline: true, dependencies: [{ kind: "component", type: FormComponent, selector: "bnrc-form", inputs: ["params", "customFormPanelUi", "formPanelCtrl", "UlvMainCtrlr", "formPanelCtrlId", "saveOnChange", "inlineEditInReport"], outputs: ["titleChanged", "moChanged", "formClose", "uiComponent", "formRendered", "bruleAction", "beforeTransition", "afterTransition"] }, { kind: "directive", type: FormCloseDirective, selector: "[formClose]", inputs: ["isMobile"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FormNewComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-form-new',
                    template: '<bnrc-form [params]="params"     (formClose)="onFormClose()"></bnrc-form>',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { settings: [{
                type: Input
            }] } });

class ReportContainerComponent extends BaseComponent {
    constructor() {
        super();
        this._activatedRoute = inject(ActivatedRoute);
        this.portalService = inject(PortalService);
        this.injector = inject(Injector);
        this.vcr = inject(ViewContainerRef);
        this._loadingSource = new Subject();
        this.loading$ = this._loadingSource.asObservable().pipe(takeUntil(this._onDestroy$), debounceTime(200));
    }
    ngOnInit() {
        super.ngOnInit();
        let ulvParam;
        if (!this.settings.RelatedReport) {
            const id = this._activatedRoute.snapshot.params['id'];
            this.settings.RelatedReport = {
                Id: id,
                $Caption: ''
            };
        }
        else {
            if (this.settings.DataOnly) {
                ulvParam = {
                    Flags: {
                        Data: 'True',
                        Extra: 'False',
                        Search: 'False',
                        View: 'False'
                        // General:"False", // ulvmainctrl does not craete ui control raise error
                    }
                };
                ulvParam.ReportId = this.settings.RelatedReport.Id;
                ulvParam.UsageEnum = 'SystemContainer';
            }
        }
        this._loadingSource.next(true);
        this.portalService
            .renderUlvMainUi({
            Id: null,
            ReportId: this.settings.RelatedReport.Id,
            UlvParams: ulvParam
        }, this.vcr, this.injector, this.settings.IsReportPage)
            .pipe(takeUntil(this._onDestroy$), catchError((err) => throwError(err)), finalize(() => this._loadingSource.next(false)))
            .subscribe();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: ReportContainerComponent, isStandalone: false, selector: "bnrc-report-container", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: "@if ((loading$ | async)!!) {\r\n<bsu-mask></bsu-mask>\r\n}\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportContainerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-report-container', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "@if ((loading$ | async)!!) {\r\n<bsu-mask></bsu-mask>\r\n}\r\n", styles: [":host{display:block}\n"] }]
        }], ctorParameters: () => [], propDecorators: { settings: [{
                type: Input
            }] } });

class FieldUiComponent extends BaseComponent {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        const el = inject(ElementRef);
        super();
        this.width = '100%';
        this._formPanelService = inject(FormPanelService);
        this._portalService = inject(PortalService);
        this._injector = inject(Injector);
        this._cdr = inject(ChangeDetectorRef);
        this._customFieldChange$ = new Subject();
        el.nativeElement.id = this.uniquId = `_${getUniqueId(4)}`;
    }
    async ngOnInit() {
        super.ngOnInit();
        if (this.customField.originalXtype === 'Ui.CheckBox') {
            // this.width = 'auto';
        }
        // if (this.isSearchPanel) {
        //   this.width = '320px';
        // }
        this.inserFieldToContainer();
    }
    async ngOnChanges(changes) {
        super.ngOnChanges(changes);
        const { customField } = changes;
        if (this._component) {
            if (customField && !customField.firstChange) {
                this._customFieldChange$.next();
                this._setContext(this._component.instance, customField.currentValue);
            }
            else {
                Object.keys(changes).forEach((key) => {
                    if (!changes[key].firstChange) {
                        this._component.instance[key] = changes[key].currentValue;
                    }
                });
                this._component.instance.ngOnChanges(changes);
            }
        }
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        if (this._component) {
            this._component.destroy();
        }
    }
    async inserFieldToContainer() {
        const customField = this.customField;
        if (!customField) {
            console.error('item does not exist.');
            return;
        }
        let customUiSetting = BarsaApi.Common.Util.TryGetValue(customField.Setting, 'CustomUi', null);
        if (customField._innerControl) {
            customUiSetting = null;
        }
        if (this.componentUi) {
            customUiSetting = this.componentUi;
        }
        const { moduleName, modulePath, componentName, selector } = getComponentDefined(customField, customUiSetting);
        this._portalService
            .getComponent(moduleName, modulePath, componentName, selector, this._injector)
            .pipe(takeUntil(this._onDestroy$), tap((component) => {
            const componentInstance = component.instance;
            componentInstance.id = `_${getUniqueId(4)}`;
            componentInstance.layoutInfo = this.layoutInfo;
            componentInstance.inlineEdit = this.inlineEdit;
            componentInstance.cellEdit = this.cellEdit;
            componentInstance.formContainer = this._formPanelService.formContainerDom;
            if (customUiSetting) {
                componentInstance.parameters = customUiSetting.Parameters;
                if (!componentInstance.parameters) {
                    componentInstance.parameters = customUiSetting.Settings;
                }
            }
            this._setContext(componentInstance, customField);
            componentInstance.focusControl = this.focusControl;
            this._component = component;
            this.vcr.insert(component.hostView);
            this._cdr.detectChanges();
        }))
            .subscribe();
    }
    _setContext(componentInstance, customField) {
        componentInstance.context = customField;
        componentInstance.value = customField.value;
        componentInstance.disable = customField.disable;
        componentInstance.readonly = customField.readonly;
        componentInstance.formHeight = this.formHeight;
        customField.controlUi = componentInstance;
        if (componentInstance.valueChange) {
            componentInstance.valueChange
                .pipe(takeUntil(this._onDestroy$.pipe(mergeWith$1(this._customFieldChange$)))
            // distinctUntilChanged((oldVal, newVal) => customField.value != newVal)
            )
                .subscribe((value) => {
                customField.value = value;
                customField.caption = componentInstance.caption;
                customField.fireEvent('change', value);
            });
        }
        if (componentInstance.formmatedValue) {
            componentInstance.formmatedValue
                .pipe(takeUntil(this._onDestroy$.pipe(mergeWith$1(this._customFieldChange$)))
            // distinctUntilChanged((oldVal, newVal) => customField.value != newVal)
            )
                .subscribe((formmatedValue) => {
                customField.formmatedValue = formmatedValue; // this event call from number base
            });
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldUiComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: FieldUiComponent, isStandalone: false, selector: "bnrc-field-ui", inputs: { isSearchPanel: "isSearchPanel", customField: "customField", componentUi: "componentUi", layoutInfo: "layoutInfo", inlineEdit: "inlineEdit", focusControl: "focusControl", cellEdit: "cellEdit", formHeight: "formHeight" }, host: { properties: { "style.width": "this.width" } }, viewQueries: [{ propertyName: "vcr", first: true, predicate: ["placeholder"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-container #placeholder></ng-container>', isInline: true, styles: [":host{display:block;width:100%;height:auto;box-sizing:border-box}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldUiComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-field-ui', template: '<ng-container #placeholder></ng-container>', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block;width:100%;height:auto;box-sizing:border-box}\n"] }]
        }], ctorParameters: () => [], propDecorators: { isSearchPanel: [{
                type: Input
            }], customField: [{
                type: Input
            }], componentUi: [{
                type: Input
            }], layoutInfo: [{
                type: Input
            }], inlineEdit: [{
                type: Input
            }], focusControl: [{
                type: Input
            }], cellEdit: [{
                type: Input
            }], formHeight: [{
                type: Input
            }], width: [{
                type: HostBinding,
                args: ['style.width']
            }], vcr: [{
                type: ViewChild,
                args: ['placeholder', { read: ViewContainerRef, static: true }]
            }] } });

const children = [
    {
        path: 'popup',
        loadChildren: () => Promise.resolve().then(function () { return barsaSapUiFormPage_module; }).then((c) => c.BarsaSapUiFormPageModule)
    },
    {
        path: 'formfieldshow',
        loadChildren: () => Promise.resolve().then(function () { return barsaSapUiFormPage_module; }).then((c) => c.BarsaSapUiFormPageModule)
    }
];
const routes$1 = [
    {
        path: '',
        component: EmptyPageWithRouterAndRouterOutletComponent,
        children: [
            {
                path: 'show',
                outlet: 'main',
                component: FormPageComponent,
                data: { breadcrumb: (data) => `${data.breadcrumb}` }, // dynamic
                resolve: { breadcrumb: PortalFormPageResolver },
                children: [...children]
            },
            {
                path: 'fieldshow',
                outlet: 'main',
                component: FormFieldReportPageComponent,
                data: { breadcrumb: (data) => `${data.breadcrumb}` }, // dynamic
                children: [...children]
            }
        ]
    }
];
class BarsaSapUiFormPageRoutingModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaSapUiFormPageRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: BarsaSapUiFormPageRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaSapUiFormPageRoutingModule, imports: [RouterModule.forChild(routes$1), RouterModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaSapUiFormPageRoutingModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [RouterModule.forChild(routes$1)],
                    exports: [RouterModule]
                }]
        }] });

class BaseModule {
    constructor(dcm, componentFactoryResolver, moduleName) {
        this.dcm = dcm;
        this.componentFactoryResolver = componentFactoryResolver;
        this.moduleName = moduleName;
        this.selectorToFactoryMap = {};
        this.isInitialize = false;
        dcm?.addModuleWithComponents(moduleName, this);
    }
    getComponentFactory(componentName) {
        if (!this.isInitialize) {
            // lazy initialisation
            this.populateRegistry();
        }
        return this.selectorToFactoryMap[componentName];
    }
    populateRegistry() {
        this.selectorToFactoryMap = {};
        this.isInitialize = true;
        if (Array.isArray(this.dynamicComponents) && this.dynamicComponents.length > 0) {
            this.dynamicComponents.forEach((compType) => {
                const componentFactory = this.componentFactoryResolver.resolveComponentFactory(compType);
                this.selectorToFactoryMap[componentFactory.selector] = componentFactory;
            });
        }
    }
}

const components$1 = [];
class BarsaSapUiFormPageModule extends BaseModule {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        const dcm = inject(DynamicComponentService);
        const cfr = inject(ComponentFactoryResolver);
        super(dcm, cfr, 'BarsaSapUiFormPageModule');
        this.dynamicComponents = [...components$1];
        this.dcm = dcm;
        this.cfr = cfr;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaSapUiFormPageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: BarsaSapUiFormPageModule, imports: [CommonModule, FormsModule, BarsaSapUiFormPageRoutingModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaSapUiFormPageModule, imports: [CommonModule, FormsModule, BarsaSapUiFormPageRoutingModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaSapUiFormPageModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CommonModule, FormsModule, BarsaSapUiFormPageRoutingModule],
                    declarations: [...components$1],
                    exports: [...components$1],
                    schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA]
                }]
        }], ctorParameters: () => [] });

var barsaSapUiFormPage_module = /*#__PURE__*/Object.freeze({
    __proto__: null,
    BarsaSapUiFormPageModule: BarsaSapUiFormPageModule
});

class ReportNavigatorComponent extends BaseComponent {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        super();
        this.isMobile = getDeviceIsDesktop();
        this._activatedRoute = inject(ActivatedRoute);
        this._portalService = inject(PortalService);
        this._applicationCtrlService = inject(ApplicationCtrlrService);
        this._injector = inject(Injector);
        this._cdr = inject(ChangeDetectorRef);
        this._loadingSource = new BehaviorSubject(false);
        this._routingService = inject(RoutingService, { optional: true, skipSelf: true });
        this._runtimeNavCache = inject(RuntimeNavStateCacheService);
        this.loading$ = this._loadingSource.asObservable().pipe(takeUntil(this._onDestroy$), debounceTime(200));
    }
    ngOnInit() {
        super.ngOnInit();
        this._activatedRoute.params
            .pipe(takeUntil(this._onDestroy$), tap(() => this._setLoading(true)), map((params) => this._extractIds(params)), 
        // tap((c) => (c.isReportPage ? (this.minheight = 'auto') : '100vh')),
        tap((c) => (c.ReportId = !c.ReportId ? c.ReportId2 : c.ReportId)), tap((_c) => this.containerRef.clear()), tap((navItem) => this._applicationCtrlService.selectNavGroupItem(navItem.Id)), tap((navItem) => this._applicationCtrlService.selectedReportId(navItem.ReportId)), tap((navItem) => this._applicationCtrlService.selectReportCaption(navItem.ReportId2)), tap((navItem) => (this._navItemParams = navItem)), switchMap$1((navItem) => from(this._finalizeNavItemFromCache(navItem)).pipe(switchMap$1((resolved) => this._portalService
            .renderUlvMainUi(resolved, this.containerRef, this._injector, resolved.isReportPage)
            .pipe(catchError((_err) => 
        // this._location.back();
        // return throwError(() => new Error(err));
        of(true)))))), tap((ulv) => this._setActiveReport(ulv)), finalize(() => {
            this._setLoading(false);
        }))
            .subscribe(() => {
            this._setLoading(false);
        });
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        // this._applicationCtrlService.selectNavGroupItem('');
        this._setActiveReport(null);
    }
    _setActiveReport(ulv) {
        this._ulvMainCtrlr = ulv;
        const x = BarsaApi.Ul.UlvMainCtrlr.EventEnum.SelectionChange;
        if (ulv && typeof ulv === 'object') {
            ulv.on({
                scope: this,
                [x]: this._onSelectionAdapter_SelectionChange
            });
        }
        this._ulvMainCtrlr = ulv;
        BarsaApi.Bw.App.GetActiveReport = () => {
            if (ulv === null) {
                return ulv;
            }
            return BarsaApi.Bw._wrap(ulv);
        };
    }
    _extractIds(params) {
        const lastText = params.id.split('__').length > 3 ? params.id.split('__')[3] : '';
        const navIdOrFieldDefId = params.id.split('__')[0];
        const reportId2OrLevelReportId = params.id.split('__').length > 1 ? params.id.split('__')[1] : '';
        const reportIdOrMoId = params.id.split('__').length > 2 ? params.id.split('__')[2] : '';
        const typeDefFromUrl = lastText.startsWith('in') ? lastText.replace('in', '') : '';
        const cacheKey = lastText.startsWith('in') && typeDefFromUrl && reportIdOrMoId
            ? buildRuntimeNavStateCacheKey(reportId2OrLevelReportId, reportIdOrMoId, typeDefFromUrl)
            : undefined;
        return {
            Id: navIdOrFieldDefId,
            ReportId: reportIdOrMoId,
            ReportId2: reportId2OrLevelReportId,
            isReportPage: lastText === '' || this._masterDetailsPage(lastText),
            cacheKey,
            OtherData: !lastText.startsWith('in')
                ? undefined
                : {
                    FieldId: navIdOrFieldDefId,
                    IsInsideViewResult: true,
                    LevelReportId: reportId2OrLevelReportId,
                    Mo: {
                        Id: reportIdOrMoId,
                        $Caption: '',
                        $TypeDefId: typeDefFromUrl,
                        $LevelReportId: reportId2OrLevelReportId
                    }
                }
        };
    }
    _masterDetailsPage(lastText) {
        return (lastText.startsWith('in') || lastText.startsWith('ulv')) && this.isMobile;
    }
    _setLoading(val) {
        this._loadingSource.next(val);
        this._cdr.detectChanges();
    }
    _onSelectionAdapter_SelectionChange() {
        const routing = this._routingService;
        if (!routing?.masterDetails || !this._ulvMainCtrlr) {
            return;
        }
        const fieldId = this._navItemParams.ReportId2;
        const mo = this._ulvMainCtrlr.GetSelectedMetaObject();
        if (!mo) {
            return;
        }
        const moId = `${mo.Id}`;
        const levelReportId = mo.$LevelReportId || '';
        const typeDefId = `${mo.$TypeDefId}`;
        const cacheKey = buildRuntimeNavStateCacheKey(levelReportId, moId, typeDefId);
        const envelope = {
            version: 1,
            sessionId: '',
            createdAt: Date.now(),
            schema: RUNTIME_NAV_STATE_SCHEMA_V1,
            serializationMode: 'dto',
            payload: {
                OtherData: {
                    FieldId: fieldId,
                    IsInsideViewResult: true,
                    LevelReportId: levelReportId,
                    Mo: mo
                }
            }
        };
        void this._runtimeNavCache.save(cacheKey, envelope).finally(() => {
            routing.navigate(['details', `${fieldId}__${levelReportId}__${moId}__in${mo.$TypeDefId}`], true, null, null);
        });
    }
    /**
     * URL parse → cache get → merge/hydrate → finalized navItem (before renderUlvMainUi).
     */
    async _finalizeNavItemFromCache(nav) {
        if (!nav.cacheKey || !nav.OtherData) {
            return nav;
        }
        const env = await this._runtimeNavCache.get(nav.cacheKey);
        return this._applyCachedEnvelope(nav, env);
    }
    _applyCachedEnvelope(nav, env) {
        if (!env?.payload || !nav.OtherData) {
            return nav;
        }
        if (env.schema !== RUNTIME_NAV_STATE_SCHEMA_V1 || env.version !== 1) {
            return nav;
        }
        if (env.expiresAt != null && Date.now() > env.expiresAt) {
            return nav;
        }
        const p = env.payload;
        if (env.serializationMode === 'dto' || env.serializationMode === 'hydrated') {
            const mergedOther = p.OtherData != null
                ? {
                    ...nav.OtherData,
                    ...p.OtherData,
                    Mo: p.OtherData.Mo ?? nav.OtherData.Mo
                }
                : nav.OtherData;
            return {
                ...nav,
                OtherData: mergedOther,
                RuntimeState: p.RuntimeState ?? nav.RuntimeState,
                Context: p.Context ?? nav.Context
            };
        }
        return nav;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportNavigatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ReportNavigatorComponent, isStandalone: false, selector: "bnrc-report-navigator", viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["containerRef"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `<ng-container #containerRef></ng-container>`, isInline: true, styles: [":host{display:block;width:100%;background:var(--sapBaseColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportNavigatorComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-report-navigator', template: `<ng-container #containerRef></ng-container>`, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block;width:100%;background:var(--sapBaseColor)}\n"] }]
        }], ctorParameters: () => [], propDecorators: { containerRef: [{
                type: ViewChild,
                args: ['containerRef', { static: true, read: ViewContainerRef }]
            }] } });

class ReportEmptyPageComponent extends PageWithFormHandlerBaseComponent {
    constructor() {
        super(...arguments);
        this._injecotr = inject(Injector);
    }
    ngOnInit() {
        this.containerRef.insert(this.blockTemplate.createEmbeddedView(this, this._injecotr));
        super.ngOnInit();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportEmptyPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ReportEmptyPageComponent, isStandalone: false, selector: "bnrc-report-empty-page", providers: [RoutingService, ContainerService], viewQueries: [{ propertyName: "blockTemplate", first: true, predicate: ["block"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
        <ng-template #block>
            <bnrc-report-navigator></bnrc-report-navigator>
        </ng-template>
        <ng-container #containerRef></ng-container>
        <router-outlet></router-outlet>
    `, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: ReportNavigatorComponent, selector: "bnrc-report-navigator" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ReportEmptyPageComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-report-empty-page', template: `
        <ng-template #block>
            <bnrc-report-navigator></bnrc-report-navigator>
        </ng-template>
        <ng-container #containerRef></ng-container>
        <router-outlet></router-outlet>
    `, providers: [RoutingService, ContainerService], changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, styles: [":host{display:block}\n"] }]
        }], propDecorators: { blockTemplate: [{
                type: ViewChild,
                args: ['block', { static: true }]
            }] } });

class BaseController {
    /**
     *
     */
    constructor(view) {
        this.view = view;
    }
}
class FieldBaseController extends BaseController {
    init(_params) {
    }
}

class ViewBase extends BaseComponent {
    constructor() {
        super(...arguments);
        this.errorMessage = signal('');
        this.errorCode = signal(-1);
        this.injector = inject(Injector);
    }
    /**
     *
     */
    ngOnInit() {
        this.controller.init();
    }
    showError(message, code) {
        this.errorMessage.set(message);
        this.errorCode.set(code);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ViewBase, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ViewBase, isStandalone: false, selector: "bnrc-view-base", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ViewBase, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-view-base',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }] });

class ButtonLoadingComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ButtonLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: ButtonLoadingComponent, isStandalone: false, selector: "bnrc-button-loading", inputs: { valid: "valid", loading: "loading", text: "text", transparent: "transparent" }, ngImport: i0, template: "<!-- <button class=\"button\" [disabled]=\"loading\">\r\n    <i [class.!tw-hidden]=\"!loading\" class=\"fa fa-circle-o-notch fa-spin\"></i\r\n    >{{ (loading ? 'Wait' : text) | bbbTranslate }}\r\n</button> -->\r\n<button\r\n    type=\"button\"\r\n    class=\"tw-bg-(--primaryColor) tw-bg-blue-500 tw-w-full hover:tw-bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded dark:tw-bg-blue-700 dark:hover:tw-bg-blue-900\"\r\n    [disabled]=\"loading || !valid\"\r\n    [class.transparent]=\"transparent\"\r\n    [class.!tw-bg-gray-200]=\"!valid\"\r\n>\r\n    @if(loading && valid){\r\n    <div role=\"status\" class=\"tw-w-full tw-flex tw-justify-center\">\r\n        <svg\r\n            class=\"tw-mr-3 tw--ml-1 tw-size-5 tw-animate-spin tw-text-white\"\r\n            xmlns=\"http://www.w3.org/2000/svg\"\r\n            fill=\"none\"\r\n            viewBox=\"0 0 24 24\"\r\n        >\r\n            <circle class=\"tw-opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"4\"></circle>\r\n            <path\r\n                class=\"tw-opacity-75\"\r\n                fill=\"currentColor\"\r\n                d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\r\n            ></path>\r\n        </svg>\r\n        <span class=\"tw-sr-only\">{{ 'Loading' | bbbTranslate }}...</span>\r\n    </div>\r\n    }@else{\r\n    <span class=\"button__text\">{{ text | bbbTranslate }}</span>\r\n    }\r\n</button>\r\n", styles: [":host{display:block;width:100%}.button{width:100%;position:relative;padding:8px 16px;background:var(--button-loading);border:none;outline:none;cursor:pointer}.button .button__text{font:700 1rem IranYekanDigits,B-Font;color:var(--button-loading-text-color);transition:all .2s}.button.transparent{background:transparent;border:1px solid var(--button-loading)}.button.transparent .button__text{color:var(--button-loading)}.button.transparent .button:active{background:var(--button-loading-transparent-active)}.button[disabled],.button[disabled]:active{background-color:gray}.button:active{background:var(--button-loading-active)}.button--loading .button__text{visibility:hidden;opacity:0}.button--loading:after{content:\"\";position:absolute;width:16px;height:16px;inset:0;margin:auto;border:4px solid transparent;border-top-color:var(--button-loading-border-top-color);border-radius:50%;animation:button-loading-spinner 1s ease infinite}.transparent.button--loading:after{border-top-color:var(--button-loading-transparent-border-top-color)}@keyframes button-loading-spinner{0%{transform:rotate(0)}to{transform:rotate(1turn)}}\n"], dependencies: [{ kind: "pipe", type: BbbTranslatePipe, name: "bbbTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ButtonLoadingComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-button-loading', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<!-- <button class=\"button\" [disabled]=\"loading\">\r\n    <i [class.!tw-hidden]=\"!loading\" class=\"fa fa-circle-o-notch fa-spin\"></i\r\n    >{{ (loading ? 'Wait' : text) | bbbTranslate }}\r\n</button> -->\r\n<button\r\n    type=\"button\"\r\n    class=\"tw-bg-(--primaryColor) tw-bg-blue-500 tw-w-full hover:tw-bg-blue-700 tw-text-white tw-font-bold tw-py-2 tw-px-4 tw-rounded dark:tw-bg-blue-700 dark:hover:tw-bg-blue-900\"\r\n    [disabled]=\"loading || !valid\"\r\n    [class.transparent]=\"transparent\"\r\n    [class.!tw-bg-gray-200]=\"!valid\"\r\n>\r\n    @if(loading && valid){\r\n    <div role=\"status\" class=\"tw-w-full tw-flex tw-justify-center\">\r\n        <svg\r\n            class=\"tw-mr-3 tw--ml-1 tw-size-5 tw-animate-spin tw-text-white\"\r\n            xmlns=\"http://www.w3.org/2000/svg\"\r\n            fill=\"none\"\r\n            viewBox=\"0 0 24 24\"\r\n        >\r\n            <circle class=\"tw-opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"4\"></circle>\r\n            <path\r\n                class=\"tw-opacity-75\"\r\n                fill=\"currentColor\"\r\n                d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\r\n            ></path>\r\n        </svg>\r\n        <span class=\"tw-sr-only\">{{ 'Loading' | bbbTranslate }}...</span>\r\n    </div>\r\n    }@else{\r\n    <span class=\"button__text\">{{ text | bbbTranslate }}</span>\r\n    }\r\n</button>\r\n", styles: [":host{display:block;width:100%}.button{width:100%;position:relative;padding:8px 16px;background:var(--button-loading);border:none;outline:none;cursor:pointer}.button .button__text{font:700 1rem IranYekanDigits,B-Font;color:var(--button-loading-text-color);transition:all .2s}.button.transparent{background:transparent;border:1px solid var(--button-loading)}.button.transparent .button__text{color:var(--button-loading)}.button.transparent .button:active{background:var(--button-loading-transparent-active)}.button[disabled],.button[disabled]:active{background-color:gray}.button:active{background:var(--button-loading-active)}.button--loading .button__text{visibility:hidden;opacity:0}.button--loading:after{content:\"\";position:absolute;width:16px;height:16px;inset:0;margin:auto;border:4px solid transparent;border-top-color:var(--button-loading-border-top-color);border-radius:50%;animation:button-loading-spinner 1s ease infinite}.transparent.button--loading:after{border-top-color:var(--button-loading-transparent-border-top-color)}@keyframes button-loading-spinner{0%{transform:rotate(0)}to{transform:rotate(1turn)}}\n"] }]
        }], propDecorators: { valid: [{
                type: Input
            }], loading: [{
                type: Input
            }], text: [{
                type: Input
            }], transparent: [{
                type: Input
            }] } });

class BaseUlvSettingComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this.mobile = isMobile();
    }
    ngOnInit() {
        super.ngOnInit();
        this.originalSetting = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.View.GridSetting', null);
        this.allColumns = GetAllColumnsSorted(this.context);
        this.sortSettings = BarsaApi.Common.Util.TryGetValue(this.context, 'Setting.View.GridSetting.SortSettingList', []);
    }
    onCancelSettings() {
        this.close(null);
    }
    onOkClick() {
        const setting = this.getSettings();
        this.close(setting);
    }
    onClose() {
        this.close(null);
    }
    getSettings() {
        return getGridSettings(this.context);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseUlvSettingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: BaseUlvSettingComponent, isStandalone: false, selector: "bnrc-base-ulv-setting", host: { properties: { "class.mobile": "this.mobile" } }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BaseUlvSettingComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'bnrc-base-ulv-setting',
                    template: '',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    standalone: false
                }]
        }], propDecorators: { mobile: [{
                type: HostBinding,
                args: ['class.mobile']
            }] } });

// دیکشنری برای نگهداری کامپوننت‌های Detach شده
const routeStorage = {};
const REUSE_PROPERTY = 'ReuseRoute';
class CustomRouteReuseStrategy {
    // تصمیم می‌گیرد که آیا یک روَت باید Detach و ذخیره شود یا نه.
    // ما فقط روَت‌هایی را که در data مشخص شده‌اند، Detach می‌کنیم.
    shouldDetach(route) {
        // برای روَت‌های اصلی که می‌خواهید حفظ شوند
        const isReuse = !!BarsaApi.Common.Util.TryGetValue(route, `data.pageData.${REUSE_PROPERTY}`);
        return isReuse;
    }
    // کامپوننت Detach شده را ذخیره می‌کند.
    store(route, handle) {
        const isReuse = !!BarsaApi.Common.Util.TryGetValue(route, `data.pageData.${REUSE_PROPERTY}`);
        if (route.routeConfig && isReuse) {
            const keyPath = this._getKeyOfPath(route);
            routeStorage[keyPath] = handle;
        }
    }
    // تصمیم می‌گیرد که آیا کامپوننت ذخیره شده باید بازیابی (Attach) شود یا نه.
    shouldAttach(route) {
        // اگر روَت در حافظه ذخیره شده و قرار بوده حفظ شود
        const keyPath = this._getKeyOfPath(route);
        return !!route.routeConfig && !!routeStorage[keyPath];
    }
    // کامپوننت ذخیره شده را بازیابی می‌کند.
    retrieve(route) {
        const isReuse = !!BarsaApi.Common.Util.TryGetValue(route, `data.pageData.${REUSE_PROPERTY}`);
        if (!route.routeConfig || !isReuse) {
            return null;
        }
        const keyPath = this._getKeyOfPath(route);
        return routeStorage[keyPath] || null;
    }
    // مهم‌ترین بخش: تصمیم می‌گیرد که آیا روَت فعلی باید برای روَت آینده بازاستفاده شود یا نه.
    // اگر از یک روَت به روَت دیگری برویم (مثل 'Page1' به 'Page2')، این باید 'false' باشد تا بتواند Detach شود.
    // اما اگر پارامترها و Query Params یکسان باشند، شاید بخواهید 'true' باشد.
    // برای حالت شما (نویگیشن بین روَت‌های اصلی)، معمولاً 'false' است مگر اینکه روَت‌ها کاملاً یکسان باشند.
    shouldReuseRoute(future, curr) {
        // این کار باعث می‌شود روَت‌های خواهر (sibling) به عنوان روَت‌های جدید در نظر گرفته شوند
        // تا بتوانند Detach و Attach شوند.
        return future.routeConfig === curr.routeConfig;
    }
    _getKeyOfPath(route) {
        const x = BarsaApi.Common.Util.TryGetValue(route, `data.pageData.ParentRoute`);
        const y = BarsaApi.Common.Util.TryGetValue(route, `data.pageData.Route`);
        const keyPath = `${x}${y}`;
        return keyPath;
    }
}

class RootPageComponent extends BaseComponent {
    constructor() {
        super(...arguments);
        this._pageContent = true;
        this.viewContainerRef = inject(ViewContainerRef);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RootPageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: RootPageComponent, isStandalone: false, selector: "bnrc-root-page", host: { properties: { "class.page-content": "this._pageContent" } }, providers: [RoutingService], usesInheritance: true, ngImport: i0, template: `<router-outlet></router-outlet><router-outlet name="main"></router-outlet>`, isInline: true, styles: [":host{position:relative;display:block}\n"], dependencies: [{ kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RootPageComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-root-page', template: `<router-outlet></router-outlet><router-outlet name="main"></router-outlet>`, changeDetection: ChangeDetectionStrategy.OnPush, providers: [RoutingService], standalone: false, styles: [":host{position:relative;display:block}\n"] }]
        }], propDecorators: { _pageContent: [{
                type: HostBinding,
                args: ['class.page-content']
            }] } });

class ResizableDirective {
    /**
     *
     */
    constructor() {
        this.resizableComplete = new EventEmitter();
        this.documentRef = inject(DOCUMENT);
        this.elementRef = inject(ElementRef);
        this.resizable = fromEvent(this.elementRef.nativeElement, 'mousedown').pipe(tap((e) => e.preventDefault()), switchMap$1(() => {
            const elDom = this.elementRef.nativeElement;
            const { width, right, left } = elDom.closest('th').getBoundingClientRect();
            return fromEvent(this.documentRef, 'mousemove').pipe(map(({ clientX }) => (this.rtl ? width + left - clientX : width + clientX - right)), distinctUntilChanged(), takeUntil(fromEvent(this.documentRef, 'mouseup').pipe(tap((_c) => this.resizableComplete.emit()))));
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ResizableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: ResizableDirective, isStandalone: false, selector: "[resizable]", inputs: { rtl: "rtl" }, outputs: { resizableComplete: "resizableComplete", resizable: "resizable" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ResizableDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[resizable]',
                    standalone: false
                }]
        }], ctorParameters: () => [], propDecorators: { rtl: [{
                type: Input
            }], resizableComplete: [{
                type: Output
            }], resizable: [{
                type: Output
            }] } });

class ResizableComponent {
    constructor() {
        this.widthChange = new EventEmitter();
        this.widthChanging = new EventEmitter();
        this._el = inject(ElementRef);
        this._renderer2 = inject(Renderer2);
    }
    onResize(width) {
        this._renderer2.setStyle(this._el.nativeElement, 'width', width + 'px');
        this.widthChanging.emit(width);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ResizableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ResizableComponent, isStandalone: false, selector: "th[resizable]", inputs: { disableResize: "disableResize", rtl: "rtl" }, outputs: { widthChange: "widthChange", widthChanging: "widthChanging" }, ngImport: i0, template: "<div class=\"wrapper\" [style.justify-content]=\"disableResize ? 'center' : 'flex-end'\">\r\n    <div class=\"content tw-flex\">\r\n        <ng-content></ng-content>\r\n    </div>\r\n    <div\r\n        [style.pointer-events]=\"disableResize ? 'none' : 'auto'\"\r\n        class=\"bar\"\r\n        [class.rtl]=\"rtl\"\r\n        (resizable)=\"onResize($event)\"\r\n        [rtl]=\"rtl\"\r\n        (resizableComplete)=\"widthChange.emit()\"\r\n    ></div>\r\n</div>\r\n", styles: [".wrapper{display:flex}.content{flex:1;min-width:0}.bar{position:absolute;z-index:2;top:0;bottom:0;width:2px;margin:0 -.5rem 0 .5rem;justify-self:flex-start;border-left:2px solid transparent;border-right:2px solid transparent;background:#8a2be2;cursor:col-resize;opacity:0;transition:opacity .3s}.bar.rtl{margin:0 0 0 -.5rem}.bar:hover,.bar:active{opacity:1}\n"], dependencies: [{ kind: "directive", type: ResizableDirective, selector: "[resizable]", inputs: ["rtl"], outputs: ["resizableComplete", "resizable"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ResizableComponent, decorators: [{
            type: Component,
            args: [{ selector: 'th[resizable]', standalone: false, template: "<div class=\"wrapper\" [style.justify-content]=\"disableResize ? 'center' : 'flex-end'\">\r\n    <div class=\"content tw-flex\">\r\n        <ng-content></ng-content>\r\n    </div>\r\n    <div\r\n        [style.pointer-events]=\"disableResize ? 'none' : 'auto'\"\r\n        class=\"bar\"\r\n        [class.rtl]=\"rtl\"\r\n        (resizable)=\"onResize($event)\"\r\n        [rtl]=\"rtl\"\r\n        (resizableComplete)=\"widthChange.emit()\"\r\n    ></div>\r\n</div>\r\n", styles: [".wrapper{display:flex}.content{flex:1;min-width:0}.bar{position:absolute;z-index:2;top:0;bottom:0;width:2px;margin:0 -.5rem 0 .5rem;justify-self:flex-start;border-left:2px solid transparent;border-right:2px solid transparent;background:#8a2be2;cursor:col-resize;opacity:0;transition:opacity .3s}.bar.rtl{margin:0 0 0 -.5rem}.bar:hover,.bar:active{opacity:1}\n"] }]
        }], propDecorators: { disableResize: [{
                type: Input
            }], rtl: [{
                type: Input
            }], widthChange: [{
                type: Output
            }], widthChanging: [{
                type: Output
            }] } });

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

/** Default CSS viewport wrapper class for report bodies (table, calendar, �) */
const REPORT_GRID_VIEWPORT_CLASS = 'report-grid-wrapper';
const DEFAULT_REPORT_LAYOUT_POLICY = Object.freeze({
    layout: 'inline',
    scroll: 'inherit'
});
/** Per-selector defaults (extend in app code if needed). Keys match `UiReportViewBase.UiComponent.Selector`. */
const REPORT_TYPE_DEFAULT_POLICIES = Object.freeze({
    'bsu-ui-calendar': { layout: 'fill', scroll: 'self' }
});
function scrollLayoutModeToContextEnvironment(mode) {
    switch (mode) {
        case 'nested':
            return { scrollContainerDepth: 1, shell: 'page' };
        case 'isolated':
            return { scrollContainerDepth: 0, shell: 'page', viewportIsolation: true };
        default:
            return { scrollContainerDepth: 0, shell: 'page' };
    }
}
function contextDefaultsFromEnvironment(env) {
    if (env.scrollContainerDepth > 0) {
        return { scroll: 'inherit', layout: 'inline' };
    }
    return {};
}
function mergePolicyLayers(...layers) {
    let layout;
    let scroll;
    for (const layer of layers) {
        if (!layer) {
            continue;
        }
        if (layer.layout !== undefined) {
            layout = layer.layout;
        }
        if (layer.scroll !== undefined) {
            scroll = layer.scroll;
        }
    }
    return {
        layout: layout ?? DEFAULT_REPORT_LAYOUT_POLICY.layout,
        scroll: scroll ?? DEFAULT_REPORT_LAYOUT_POLICY.scroll
    };
}
/**
 * Final scroll arbitration (pure). Call after merge so registry/explicit `self` wins over nested inherit defaults.
 */
function resolveFinalScroll(merged, env) {
    if (merged.scroll === 'self') {
        return 'self';
    }
    if (env.scrollContainerDepth > 0) {
        return 'inherit';
    }
    return 'self';
}
/**
 * Pure, framework-agnostic policy resolution. Later layers in `extraPartials` override earlier ones.
 * Order: DEFAULT, contextDefaults(env), registryDefault, ...extraPartials (each partial last-wins on its own keys).
 */
function resolveReportLayoutPolicy(env, registryDefault, ...extraPartials) {
    const merged = mergePolicyLayers({ layout: DEFAULT_REPORT_LAYOUT_POLICY.layout, scroll: DEFAULT_REPORT_LAYOUT_POLICY.scroll }, contextDefaultsFromEnvironment(env), registryDefault, ...extraPartials);
    const scroll = resolveFinalScroll(merged, env);
    return Object.freeze({
        layout: merged.layout,
        scroll
    });
}
function getReportTypeDefaultPolicy(selector) {
    if (!selector) {
        return undefined;
    }
    return REPORT_TYPE_DEFAULT_POLICIES[selector];
}
/** Optional metadata path on view settings (low-code / future designer) */
function extractLayoutPolicyFromView(view) {
    const s = view?.UiComponent?.Settings;
    const raw = s?.['ReportLayoutPolicy'];
    return raw;
}

class NoInternetComponent extends BaseComponent {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        const _networkStatusService = inject(NetworkStatusService);
        super();
        _networkStatusService.networkStatus$.subscribe((status) => {
            if (status) {
                window.location.reload();
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NoInternetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: NoInternetComponent, isStandalone: false, selector: "bnrc-not-internet", usesInheritance: true, ngImport: i0, template: "<h1>\u26A0</h1>\r\n<h2>No connection to the internet</h2>\r\n<p>This Display has a connection to your network but no connection to the internet.</p>\r\n<p class=\"desc\">The connection to the outside world is needed for updates and keeping the time.</p>\r\n", styles: [":host{background:#191919 -webkit-linear-gradient(top,#000 0%,#191919 100%) no-repeat;background:#191919 linear-gradient(to bottom,#000,#191919) no-repeat;text-align:center}:host h1,:host h2{font-weight:400}:host h1{margin:0 auto;padding:.15em;font-size:10em;text-shadow:0 2px 2px #000}:host h2{margin-bottom:2em}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: NoInternetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-not-internet', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<h1>\u26A0</h1>\r\n<h2>No connection to the internet</h2>\r\n<p>This Display has a connection to your network but no connection to the internet.</p>\r\n<p class=\"desc\">The connection to the outside world is needed for updates and keeping the time.</p>\r\n", styles: [":host{background:#191919 -webkit-linear-gradient(top,#000 0%,#191919 100%) no-repeat;background:#191919 linear-gradient(to bottom,#000,#191919) no-repeat;text-align:center}:host h1,:host h2{font-weight:400}:host h1{margin:0 auto;padding:.15em;font-size:10em;text-shadow:0 2px 2px #000}:host h2{margin-bottom:2em}\n"] }]
        }], ctorParameters: () => [] });

class ServerConnectionErrorComponent extends BaseComponent {
    onReload() {
        window.location.reload();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ServerConnectionErrorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: ServerConnectionErrorComponent, isStandalone: false, selector: "bnrc-server-connection-error", usesInheritance: true, ngImport: i0, template: "<div class=\"container\">\r\n    <span></span>\r\n    <div class=\"middle\">\r\n        <h1>502</h1>\r\n        <p>\u0627\u0631\u062A\u0628\u0627\u0637 \u0628\u0627 \u0633\u0631\u0648\u0631 \u062F\u06CC\u062A\u0627 \u0642\u0637\u0639 \u0645\u06CC \u0628\u0627\u0634\u062F.</p>\r\n    </div>\r\n    <div>\r\n        <button class=\"fd-button fd-button--transparent\" (click)=\"onReload()\">Reload</button>\r\n    </div>\r\n</div>\r\n", styles: [":host{direction:rtl}:host .container{height:100%;text-align:center;display:flex;flex-direction:column}:host span{height:100%;vertical-align:middle;display:inline-block}:host .middle{vertical-align:middle;margin:0;display:inline-block}:host h1{font-size:25em}:host p{margin:-70px 0 0;padding:0;font-size:2em}:host a{color:#ccc}@media only screen and (max-width: 767px){:host h1{font-size:13em}:host p{font-size:1.5em;margin-top:-50px}}@media only screen and (max-width: 400px){:host h1{font-size:9em}:host p{font-size:1em;margin-top:-30px}}:host button{margin-top:5rem;border:1px solid #ccc;padding:5px;max-width:120px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ServerConnectionErrorComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bnrc-server-connection-error', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"container\">\r\n    <span></span>\r\n    <div class=\"middle\">\r\n        <h1>502</h1>\r\n        <p>\u0627\u0631\u062A\u0628\u0627\u0637 \u0628\u0627 \u0633\u0631\u0648\u0631 \u062F\u06CC\u062A\u0627 \u0642\u0637\u0639 \u0645\u06CC \u0628\u0627\u0634\u062F.</p>\r\n    </div>\r\n    <div>\r\n        <button class=\"fd-button fd-button--transparent\" (click)=\"onReload()\">Reload</button>\r\n    </div>\r\n</div>\r\n", styles: [":host{direction:rtl}:host .container{height:100%;text-align:center;display:flex;flex-direction:column}:host span{height:100%;vertical-align:middle;display:inline-block}:host .middle{vertical-align:middle;margin:0;display:inline-block}:host h1{font-size:25em}:host p{margin:-70px 0 0;padding:0;font-size:2em}:host a{color:#ccc}@media only screen and (max-width: 767px){:host h1{font-size:13em}:host p{font-size:1.5em;margin-top:-50px}}@media only screen and (max-width: 400px){:host h1{font-size:9em}:host p{font-size:1em;margin-top:-30px}}:host button{margin-top:5rem;border:1px solid #ccc;padding:5px;max-width:120px}\n"] }]
        }] });

const routesDefault = [
    {
        path: 'login',
        component: EmptyPageComponent,
        data: { pageData: { Route: '/login', Module: 'BarsaLoginPage' } },
        resolve: { pageData: PortalPageResolver },
        canActivate: [RedirectHomeGuard],
        children: [formRoutes(true)]
    },
    {
        path: 'resetpassword',
        component: EmptyPageComponent,
        data: {
            pageData: { Route: '/resetpassword', Module: 'BarsaResetPasswordPage' }
        },
        resolve: { pageData: PortalPageResolver },
        canActivate: [RedirectHomeGuard],
        children: [formRoutes(true)]
    },
    {
        path: 'changepassword',
        component: EmptyPageComponent,
        data: {
            pageData: { Route: '/changepassword', Module: 'BarsaChangePasswordPage' }
        },
        resolve: { pageData: PortalPageResolver },
        canActivate: [AuthGuard],
        children: [formRoutes(true)]
    },
    {
        path: 'recoverpassword',
        component: EmptyPageComponent,
        data: {
            pageData: {
                Route: '/recoverpassword',
                Module: 'BarsaRecoverPasswordPage'
            }
        },
        resolve: { pageData: PortalPageResolver },
        canActivate: [RedirectHomeGuard],
        children: [formRoutes(true)]
    },
    {
        path: 'server-connection-error',
        component: ServerConnectionErrorComponent
    },
    {
        path: 'no-internet',
        component: NoInternetComponent
    },
    {
        path: 'signup',
        component: EmptyPageComponent,
        data: {
            pageData: { Route: '/signup', Module: 'BarsaUserRegisterPage' }
        },
        resolve: { pageData: PortalPageResolver },
        canActivate: [RedirectHomeGuard],
        children: [formRoutes(true)]
    },
    {
        path: 'landingpage',
        component: EmptyPageComponent,
        data: {
            pageData: {
                HasAuthorize: false,
                Module: 'BarsaLandingPage',
                Route: '/landingpage'
            }
        },
        resolve: { pageData: PortalPageResolver },
        children: [
            formRoutes(true),
            {
                path: '',
                redirectTo: 'query',
                pathMatch: 'full'
            },
            {
                path: 'query',
                component: EmptyPageComponent,
                data: {
                    pageData: {
                        HasAuthorize: true,
                        Module: 'BarsaQueryPage',
                        Route: '/query'
                    }
                },
                resolve: { pageData: PortalPageResolver },
                children: [formRoutes(true)]
            }
        ]
    }
];
const commonRoutes = [
    {
        path: 'search',
        component: EmptyPageComponent,
        data: {
            pageData: {
                HasAuthorize: false,
                Module: 'BarsaSearchPage',
                Route: '/search'
            }
        },
        resolve: { pageData: PortalPageResolver },
        children: [formRoutes()]
    },
    {
        path: 'report/:id',
        component: EmptyPageComponent,
        resolve: { pageData: PortalReportPageResolver },
        data: {
            pageData: {
                HasAuthorize: false,
                Route: '/report',
                Module: 'BarsaReportPage'
            }
        },
        children: [formRoutes(true)]
    },
    {
        path: 'appgroupsidebar',
        component: EmptyPageComponent,
        canActivate: [AuthGuard],
        data: {
            pageData: {
                Module: 'BarsaNovinRayCore',
                HasAuthorize: true,
                Route: '/appgroupsidebar/:id'
            }
        },
        resolve: { pageData: PortalPageResolver, breadcrumb: TileGroupBreadcrumResolver },
        children: [
            formRoutes(),
            {
                path: 'report/:id',
                component: EmptyPageComponent,
                resolve: { pageData: PortalReportPageResolver },
                data: {
                    pageData: {
                        HasAuthorize: false,
                        Route: '/report',
                        Module: 'BarsaReportPage'
                    }
                },
                children: [formRoutes(true)]
            }
        ]
    },
    {
        path: 'appgroup',
        component: PortalPageComponent,
        canActivate: [AuthGuard],
        data: {
            pageData: {
                Module: 'BarsaNovinRayCore',
                HasAuthorize: true,
                Route: '/appgroup'
            }
        },
        resolve: { pageData: PortalPageResolver, breadcrumb: TileGroupBreadcrumResolver },
        children: [
            formRoutes(),
            {
                path: 'report/:id',
                component: EmptyPageComponent,
                resolve: { pageData: PortalReportPageResolver },
                data: {
                    pageData: {
                        HasAuthorize: false,
                        Route: '/report',
                        Module: 'BarsaReportPage'
                    }
                },
                children: [formRoutes(true)]
            }
        ]
    }
];
const mainRoutes = [
    {
        path: 'home',
        component: PortalPageComponent,
        canActivate: [AuthGuard],
        data: {
            pageData: {
                Module: 'BarsaHomePage',
                HasAuthorize: true,
                Route: '/home'
            }
        },
        resolve: { pageData: PortalPageResolver },
        children: [
            // {
            //     path: '',
            //     component: EmptyPageComponent,
            //     data: {
            //         pageData: {
            //             HasAuthorize: false,
            //             Module: 'BarsaUserWorkspaceModule',
            //             Route: '/myworkspace'
            //         }
            //     },
            //     resolve: { pageData: PortalPageResolver },
            //     children: [formRoutes()]
            // },
            // {
            //     path: 'myworkspace-edit',
            //     component: EmptyPageComponent,
            //     data: {
            //         pageData: {
            //             Module: 'BarsaUserWorkspaceModule',
            //             HasAuthorize: true,
            //             Route: '/myworkspace-edit'
            //         }
            //     },
            //     resolve: { pageData: PortalPageResolver, breadcrumb: TileGroupBreadcrumResolver },
            //     children: [formRoutes()]
            // },
            {
                path: '',
                component: EmptyPageComponent,
                data: {
                    pageData: {
                        HasAuthorize: false,
                        Module: 'BarsaLaunchPadPage',
                        Route: '/launchpad'
                    }
                },
                resolve: { pageData: PortalPageResolver },
                children: [
                    formRoutes(),
                    {
                        path: 'appgroupdialog/:id',
                        outlet: 'dialog',
                        component: EmptyPageComponent,
                        data: {
                            pageData: {
                                Module: 'BarsaHomePage',
                                HasAuthorize: true,
                                Route: '/appgroupdialog/:id'
                            }
                        },
                        resolve: { pageData: PortalPageResolver, breadcrumb: TileGroupBreadcrumResolver }
                    }
                ]
            },
            {
                path: 'appfinder',
                component: EmptyPageComponent,
                resolve: { pageData: PortalPageResolver },
                data: {
                    pageData: {
                        HasAuthorize: true,
                        Route: '/appfinder',
                        Module: 'BarsaAppFinderPage'
                    }
                },
                children: [{ path: '', component: EmptyPageComponent }, formRoutes()]
            },
            ...commonRoutes
        ]
    },
    {
        path: 'chat',
        component: PortalPageComponent,
        data: {
            pageData: {
                HasAuthorize: true,
                Route: '/chat',
                Module: 'BarsaAppFinderPage'
            }
        },
        resolve: { pageData: PortalPageResolver }
    }
];
const routesServiceDesk = [
    {
        path: 'servicedesk',
        component: PortalPageComponent,
        canActivate: [AuthGuard],
        data: {
            pageData: {
                Module: 'BarsaDeskHelpPage',
                HasAuthorize: false,
                Route: '/servicedesk'
            }
        },
        resolve: { pageData: PortalPageResolver },
        children: [
            formRoutes(true),
            ...commonRoutes,
            {
                path: 'appgroupdialog/:id',
                outlet: 'dialog',
                component: EmptyPageComponent,
                data: {
                    pageData: {
                        Module: 'BarsaHomePage',
                        HasAuthorize: false,
                        Route: '/appgroupdialog/:id'
                    }
                },
                resolve: { pageData: PortalPageResolver, breadcrumb: TileGroupBreadcrumResolver }
            }
        ]
    }
];
// const isServiceDesk = BarsaApi.LoginFormData.IsServiceDesk; // eslint-disable-line
// const routesHome = isServiceDesk ? routesServiceDesk : mainRoutes;
const routes = [...routesDefault, ...mainRoutes, ...routesServiceDesk];
// export const routesServiceDesk2 = [...routesDefault, ...routesServiceDesk];
class BarsaNovinRayCoreRoutingModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaNovinRayCoreRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: BarsaNovinRayCoreRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaNovinRayCoreRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaNovinRayCoreRoutingModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [RouterModule.forChild(routes)],
                    exports: [RouterModule]
                }]
        }] });

class GlobalErrorHandler {
    constructor() { }
    handleError(error) {
        // if (environment.production)
        {
            console.group();
            console.error('global error handler error', error);
            console.error('global error handler stack', BarsaApi.Common.Util.TryGetValue(error, 'stack', ''));
            console.groupEnd();
            if (error.Execute) {
                error.Execute();
            }
        }
        // IMPORTANT: Rethrow the error otherwise it gets swallowed
        // throw error;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GlobalErrorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GlobalErrorHandler }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GlobalErrorHandler, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

const components = [
    FormComponent,
    FieldUiComponent,
    NotFoundComponent,
    RootPageComponent,
    RootPortalComponent,
    ReportContainerComponent,
    FormNewComponent,
    ModalRootComponent,
    PortalPageComponent,
    PortalPageSidebarComponent,
    EmptyPageWithRouterAndRouterOutletComponent,
    DynamicItemComponent,
    CardDynamicItemComponent,
    DynamicFormComponent,
    DynamicUlvToolbarComponent,
    DynamicUlvPagingComponent,
    BaseDynamicComponent,
    DynamicFormToolbaritemComponent,
    DynamicLayoutComponent,
    EmptyPageComponent,
    ReportEmptyPageComponent,
    MasterDetailsPageComponent,
    FormPageComponent,
    FormFieldReportPageComponent,
    ButtonLoadingComponent,
    UnlimitSessionComponent,
    PushBannerComponent,
    ReportNavigatorComponent,
    SplitterComponent
];
const directives = [
    PlaceHolderDirective,
    NumbersOnlyInputDirective,
    RenderUlvViewerDirective,
    RenderUlvPaginDirective,
    AnchorScrollDirective,
    ItemsRendererDirective,
    UlvCommandDirective,
    DynamicCommandDirective,
    WorfkflowwChoiceCommandDirective,
    ImageLazyDirective,
    UntilInViewDirective,
    IntersectionObserverDirective,
    EllipsifyDirective,
    TableResizerDirective,
    ColumnResizerDirective,
    AttrRtlDirective,
    CopyDirective,
    EllapsisTextDirective,
    FillEmptySpaceDirective,
    FormCloseDirective,
    MobileDirective,
    BodyClickDirective,
    CountDownDirective,
    RouteFormChangeDirective,
    DynamicStyleDirective,
    NowraptextDirective,
    LabelmandatoryDirective,
    AbsoluteDivBodyDirective,
    LoadExternalFilesDirective,
    StopPropagationDirective,
    PreventDefaultDirective,
    RenderUlvDirective,
    PrintFilesDirective,
    SaveImageDirective,
    WebOtpDirective,
    SplideSliderDirective,
    DynamicRootVariableDirective,
    HorizontalResponsiveDirective,
    MeasureFormTitleWidthDirective,
    OverflowTextDirective,
    ShortcutRegisterDirective,
    ShortcutHandlerDirective,
    BarsaReadonlyDirective,
    ResizeObserverDirective,
    ColumnValueDirective,
    ScrollToSelectedDirective,
    ScrollPersistDirective,
    TooltipDirective,
    SimplebarDirective,
    LeafletLongPressDirective,
    ResizeHandlerDirective,
    SafeBottomDirective
];
const stores = [CalendarSettingsStore];
const services = [
    PortalService,
    UploadService,
    ApiService,
    LogService,
    BarsaDialogService,
    UiService,
    LayoutService,
    TabpageService,
    DynamicComponentService,
    BreadcrumbService,
    AuthGuard,
    NetworkStatusService,
    AudioRecordingService,
    VideoRecordingService,
    RedirectHomeGuard,
    PromptUpdateService,
    NotificationService,
    ServiceWorkerNotificationService,
    SaveScrollPositionService,
    LocalStorageService,
    InMemoryStorageService,
    IndexedDbService,
    BbbTranslatePipe,
    BarsaStorageService,
    ServiceWorkerCommuncationService,
    ApplicationCtrlrService,
    PushNotificationService
];
const pipes = [
    NumeralPipe,
    CanUploadFilePipe,
    RemoveNewlinePipe,
    ConvertToStylePipe,
    FilterPipe,
    FilterTabPipe,
    FilterStringPipe,
    FioriIconPipe,
    SortPipe,
    GroupByPipe,
    MultipleGroupByPipe,
    MoValuePipe,
    MoReportValuePipe,
    HeaderFacetValuePipe,
    PictureFieldSourcePipe,
    TlbButtonsPipe,
    SeperatorFixPipe,
    MoReportValueConcatPipe,
    ContextMenuPipe,
    BbbTranslatePipe,
    BarsaIconDictPipe,
    FileInfoCountPipe,
    ControlUiPipe,
    VisibleValuePipe,
    FilterToolbarControlPipe,
    ListCountPipe,
    TotalSummaryPipe,
    MergeFieldsToColumnsPipe,
    FindColumnByDbNamePipe,
    FilterColumnsByDetailsPipe,
    MoInfoUlvMoListPipe,
    MoInfoUlvPagingPipe,
    ReversePipe,
    ColumnCustomUiPipe,
    SanitizeTextPipe,
    ColumnCustomComponentPipe,
    ColumnIconPipe,
    ColumnValuePipe,
    RowNumberPipe,
    ComboRowImagePipe,
    IsExpandedNodePipe,
    ThImageOrIconePipe,
    FindPreviewColumnPipe,
    ReplacePipe,
    FilterWorkflowInMobilePipe,
    HideColumnsInmobilePipe,
    StringToNumberPipe,
    ColumnValueOfParametersPipe,
    HideAcceptCancelButtonsPipe,
    FilterInlineActionListPipe,
    IsImagePipe,
    ToolbarSettingsPipe,
    CardMediaSizePipe,
    LabelStarTrimPipe,
    SplitPipe,
    DynamicDarkColorPipe,
    ChunkArrayPipe,
    MapToChatMessagePipe,
    PicturesByGroupIdPipe,
    ScopedCssPipe,
    ReportActionListPipe,
    GetCssVariableValuePipe
];
const functionL1 = async function () {
    if (BarsaApi.LoginFormData.Culture === 'fa-IR') {
        return Promise.resolve();
    }
    return fetch(`/Localization/Translation/data_${BarsaApi.LoginFormData.Culture}.json`)
        .then(function (res) {
        return res.json();
    })
        .then(function (res) {
        if (BBB) {
            // eslint-disable
            BBB = { ...BarsaApi.BBB, ...res };
        }
    });
};
const functionL2 = function (portalService, applicationCtrlrService, titleService) {
    portalService.loadUserPortalSetting();
    portalService.loadPortalDataSync();
    if (portalService.portalData?.Title) {
        titleService.setTitle(portalService.portalData?.Title);
    }
    if (BarsaApi.LoginFormData.IsAnonymous && !BarsaApi.LoginFormData.IsServiceDesk) {
        return portalService.loadSystem(BarsaApi.LoginFormData.PortalSystemId); // login form need just portal system
    }
    else {
        return new Promise((resolve, _reject) => {
            const m = window.location.hash.match(/application\/([^/?#]+)/i);
            const systemId = m?.[1] || ''; // "344344343"
            applicationCtrlrService.systemChange(systemId);
            applicationCtrlrService.initialize(resolve);
        }); // load all systems if user is logged in
    }
};
class BarsaNovinRayCoreModule extends BaseModule {
    /** Inserted by Angular inject() migration for backwards compatibility */
    constructor() {
        const dcm = inject(DynamicComponentService);
        const componentFactoryResolver = inject(ComponentFactoryResolver);
        super(dcm, componentFactoryResolver, 'BarsaNovinRayCoreModule');
        this.dynamicComponents = [...components];
        this.dcm = dcm;
        this.componentFactoryResolver = componentFactoryResolver;
    }
    static forRoot() {
        return {
            ngModule: BarsaNovinRayCoreModule,
            providers: [
                provideAppInitializer(() => {
                    const initializerFn = ((portalService, applicationCtrlrService, titleService, promptUpdateService, barsaStorageService, swCommunication, _, router) => () => {
                        const inLocalMode = isInLocalMode();
                        return portalService
                            .loadServerStartupData()
                            .then(() => Promise.all([
                            functionL1(),
                            functionL2(portalService, applicationCtrlrService, titleService)
                        ]).finally(() => {
                            promptUpdateService.checkForUpdate();
                            barsaStorageService.init();
                            swCommunication.init();
                        }))
                            .catch((_) => {
                            if (!inLocalMode && !navigator.onLine) {
                                console.error('internet is not connected.');
                                router.navigate(['no-internet']);
                            }
                            else {
                                router.navigate(['server-connection-error']);
                            }
                            return Promise.resolve();
                        });
                    })(inject(PortalService), inject(ApplicationCtrlrService), inject(Title), inject(PromptUpdateService), inject(BarsaStorageService), inject(ServiceWorkerCommuncationService), inject(NetworkStatusService), inject(Router));
                    return initializerFn();
                }),
                {
                    provide: ErrorHandler,
                    useClass: GlobalErrorHandler
                },
                provideAppInitializer(() => {
                    const initializerFn = ((notificationService) => () => {
                        BarsaApi.Ul.NotificationManager.on({
                            ShowPopup: notificationService.addNotification.bind(notificationService),
                            PublishEvent: notificationService.handleTopic.bind(notificationService)
                        });
                    })(inject(NotificationService));
                    return initializerFn();
                }),
                {
                    provide: RouteReuseStrategy,
                    useClass: CustomRouteReuseStrategy
                },
                {
                    provide: TEMPLATE_ENGINE,
                    useClass: SimpleTemplateEngine
                },
                ...pipes,
                ...services,
                ...stores
            ]
        };
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaNovinRayCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: BarsaNovinRayCoreModule, declarations: [FormComponent,
            FieldUiComponent,
            NotFoundComponent,
            RootPageComponent,
            RootPortalComponent,
            ReportContainerComponent,
            FormNewComponent,
            ModalRootComponent,
            PortalPageComponent,
            PortalPageSidebarComponent,
            EmptyPageWithRouterAndRouterOutletComponent,
            DynamicItemComponent,
            CardDynamicItemComponent,
            DynamicFormComponent,
            DynamicUlvToolbarComponent,
            DynamicUlvPagingComponent,
            BaseDynamicComponent,
            DynamicFormToolbaritemComponent,
            DynamicLayoutComponent,
            EmptyPageComponent,
            ReportEmptyPageComponent,
            MasterDetailsPageComponent,
            FormPageComponent,
            FormFieldReportPageComponent,
            ButtonLoadingComponent,
            UnlimitSessionComponent,
            PushBannerComponent,
            ReportNavigatorComponent,
            SplitterComponent, NumeralPipe,
            CanUploadFilePipe,
            RemoveNewlinePipe,
            ConvertToStylePipe,
            FilterPipe,
            FilterTabPipe,
            FilterStringPipe,
            FioriIconPipe,
            SortPipe,
            GroupByPipe,
            MultipleGroupByPipe,
            MoValuePipe,
            MoReportValuePipe,
            HeaderFacetValuePipe,
            PictureFieldSourcePipe,
            TlbButtonsPipe,
            SeperatorFixPipe,
            MoReportValueConcatPipe,
            ContextMenuPipe,
            BbbTranslatePipe,
            BarsaIconDictPipe,
            FileInfoCountPipe,
            ControlUiPipe,
            VisibleValuePipe,
            FilterToolbarControlPipe,
            ListCountPipe,
            TotalSummaryPipe,
            MergeFieldsToColumnsPipe,
            FindColumnByDbNamePipe,
            FilterColumnsByDetailsPipe,
            MoInfoUlvMoListPipe,
            MoInfoUlvPagingPipe,
            ReversePipe,
            ColumnCustomUiPipe,
            SanitizeTextPipe,
            ColumnCustomComponentPipe,
            ColumnIconPipe,
            ColumnValuePipe,
            RowNumberPipe,
            ComboRowImagePipe,
            IsExpandedNodePipe,
            ThImageOrIconePipe,
            FindPreviewColumnPipe,
            ReplacePipe,
            FilterWorkflowInMobilePipe,
            HideColumnsInmobilePipe,
            StringToNumberPipe,
            ColumnValueOfParametersPipe,
            HideAcceptCancelButtonsPipe,
            FilterInlineActionListPipe,
            IsImagePipe,
            ToolbarSettingsPipe,
            CardMediaSizePipe,
            LabelStarTrimPipe,
            SplitPipe,
            DynamicDarkColorPipe,
            ChunkArrayPipe,
            MapToChatMessagePipe,
            PicturesByGroupIdPipe,
            ScopedCssPipe,
            ReportActionListPipe,
            GetCssVariableValuePipe, PlaceHolderDirective,
            NumbersOnlyInputDirective,
            RenderUlvViewerDirective,
            RenderUlvPaginDirective,
            AnchorScrollDirective,
            ItemsRendererDirective,
            UlvCommandDirective,
            DynamicCommandDirective,
            WorfkflowwChoiceCommandDirective,
            ImageLazyDirective,
            UntilInViewDirective,
            IntersectionObserverDirective,
            EllipsifyDirective,
            TableResizerDirective,
            ColumnResizerDirective,
            AttrRtlDirective,
            CopyDirective,
            EllapsisTextDirective,
            FillEmptySpaceDirective,
            FormCloseDirective,
            MobileDirective,
            BodyClickDirective,
            CountDownDirective,
            RouteFormChangeDirective,
            DynamicStyleDirective,
            NowraptextDirective,
            LabelmandatoryDirective,
            AbsoluteDivBodyDirective,
            LoadExternalFilesDirective,
            StopPropagationDirective,
            PreventDefaultDirective,
            RenderUlvDirective,
            PrintFilesDirective,
            SaveImageDirective,
            WebOtpDirective,
            SplideSliderDirective,
            DynamicRootVariableDirective,
            HorizontalResponsiveDirective,
            MeasureFormTitleWidthDirective,
            OverflowTextDirective,
            ShortcutRegisterDirective,
            ShortcutHandlerDirective,
            BarsaReadonlyDirective,
            ResizeObserverDirective,
            ColumnValueDirective,
            ScrollToSelectedDirective,
            ScrollPersistDirective,
            TooltipDirective,
            SimplebarDirective,
            LeafletLongPressDirective,
            ResizeHandlerDirective,
            SafeBottomDirective], imports: [CommonModule,
            BarsaNovinRayCoreRoutingModule,
            BarsaSapUiFormPageModule,
            ResizableModule,
            FormsModule,
            ReactiveFormsModule], exports: [FormComponent,
            FieldUiComponent,
            NotFoundComponent,
            RootPageComponent,
            RootPortalComponent,
            ReportContainerComponent,
            FormNewComponent,
            ModalRootComponent,
            PortalPageComponent,
            PortalPageSidebarComponent,
            EmptyPageWithRouterAndRouterOutletComponent,
            DynamicItemComponent,
            CardDynamicItemComponent,
            DynamicFormComponent,
            DynamicUlvToolbarComponent,
            DynamicUlvPagingComponent,
            BaseDynamicComponent,
            DynamicFormToolbaritemComponent,
            DynamicLayoutComponent,
            EmptyPageComponent,
            ReportEmptyPageComponent,
            MasterDetailsPageComponent,
            FormPageComponent,
            FormFieldReportPageComponent,
            ButtonLoadingComponent,
            UnlimitSessionComponent,
            PushBannerComponent,
            ReportNavigatorComponent,
            SplitterComponent, NumeralPipe,
            CanUploadFilePipe,
            RemoveNewlinePipe,
            ConvertToStylePipe,
            FilterPipe,
            FilterTabPipe,
            FilterStringPipe,
            FioriIconPipe,
            SortPipe,
            GroupByPipe,
            MultipleGroupByPipe,
            MoValuePipe,
            MoReportValuePipe,
            HeaderFacetValuePipe,
            PictureFieldSourcePipe,
            TlbButtonsPipe,
            SeperatorFixPipe,
            MoReportValueConcatPipe,
            ContextMenuPipe,
            BbbTranslatePipe,
            BarsaIconDictPipe,
            FileInfoCountPipe,
            ControlUiPipe,
            VisibleValuePipe,
            FilterToolbarControlPipe,
            ListCountPipe,
            TotalSummaryPipe,
            MergeFieldsToColumnsPipe,
            FindColumnByDbNamePipe,
            FilterColumnsByDetailsPipe,
            MoInfoUlvMoListPipe,
            MoInfoUlvPagingPipe,
            ReversePipe,
            ColumnCustomUiPipe,
            SanitizeTextPipe,
            ColumnCustomComponentPipe,
            ColumnIconPipe,
            ColumnValuePipe,
            RowNumberPipe,
            ComboRowImagePipe,
            IsExpandedNodePipe,
            ThImageOrIconePipe,
            FindPreviewColumnPipe,
            ReplacePipe,
            FilterWorkflowInMobilePipe,
            HideColumnsInmobilePipe,
            StringToNumberPipe,
            ColumnValueOfParametersPipe,
            HideAcceptCancelButtonsPipe,
            FilterInlineActionListPipe,
            IsImagePipe,
            ToolbarSettingsPipe,
            CardMediaSizePipe,
            LabelStarTrimPipe,
            SplitPipe,
            DynamicDarkColorPipe,
            ChunkArrayPipe,
            MapToChatMessagePipe,
            PicturesByGroupIdPipe,
            ScopedCssPipe,
            ReportActionListPipe,
            GetCssVariableValuePipe, PlaceHolderDirective,
            NumbersOnlyInputDirective,
            RenderUlvViewerDirective,
            RenderUlvPaginDirective,
            AnchorScrollDirective,
            ItemsRendererDirective,
            UlvCommandDirective,
            DynamicCommandDirective,
            WorfkflowwChoiceCommandDirective,
            ImageLazyDirective,
            UntilInViewDirective,
            IntersectionObserverDirective,
            EllipsifyDirective,
            TableResizerDirective,
            ColumnResizerDirective,
            AttrRtlDirective,
            CopyDirective,
            EllapsisTextDirective,
            FillEmptySpaceDirective,
            FormCloseDirective,
            MobileDirective,
            BodyClickDirective,
            CountDownDirective,
            RouteFormChangeDirective,
            DynamicStyleDirective,
            NowraptextDirective,
            LabelmandatoryDirective,
            AbsoluteDivBodyDirective,
            LoadExternalFilesDirective,
            StopPropagationDirective,
            PreventDefaultDirective,
            RenderUlvDirective,
            PrintFilesDirective,
            SaveImageDirective,
            WebOtpDirective,
            SplideSliderDirective,
            DynamicRootVariableDirective,
            HorizontalResponsiveDirective,
            MeasureFormTitleWidthDirective,
            OverflowTextDirective,
            ShortcutRegisterDirective,
            ShortcutHandlerDirective,
            BarsaReadonlyDirective,
            ResizeObserverDirective,
            ColumnValueDirective,
            ScrollToSelectedDirective,
            ScrollPersistDirective,
            TooltipDirective,
            SimplebarDirective,
            LeafletLongPressDirective,
            ResizeHandlerDirective,
            SafeBottomDirective] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaNovinRayCoreModule, providers: [provideHttpClient(withInterceptorsFromDi())], imports: [CommonModule,
            BarsaNovinRayCoreRoutingModule,
            BarsaSapUiFormPageModule,
            ResizableModule,
            FormsModule,
            ReactiveFormsModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: BarsaNovinRayCoreModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [...components, ...pipes, ...directives],
                    exports: [...components, ...pipes, ...directives],
                    schemas: [NO_ERRORS_SCHEMA],
                    imports: [
                        CommonModule,
                        BarsaNovinRayCoreRoutingModule,
                        BarsaSapUiFormPageModule,
                        ResizableModule,
                        FormsModule,
                        ReactiveFormsModule
                    ],
                    providers: [provideHttpClient(withInterceptorsFromDi())]
                }]
        }], ctorParameters: () => [] });

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

export { StopPropagationDirective as $, AnchorScrollDirective as A, BaseModule as B, CardDynamicItemComponent as C, DynamicComponentService as D, EmptyPageWithRouterAndRouterOutletComponent as E, FieldDirective as F, ItemsRendererDirective as G, NumbersOnlyInputDirective as H, ImageLazyDirective as I, PlaceHolderDirective as J, RenderUlvViewerDirective as K, RenderUlvPaginDirective as L, MasterDetailsPageComponent as M, NotFoundComponent as N, UntilInViewDirective as O, PortalPageComponent as P, CopyDirective as Q, ReportEmptyPageComponent as R, EllapsisTextDirective as S, TableResizerDirective as T, UlvCommandDirective as U, FillEmptySpaceDirective as V, WorfkflowwChoiceCommandDirective as W, FormCloseDirective as X, MobileDirective as Y, BodyClickDirective as Z, PreventDefaultDirective as _, EmptyPageComponent as a, ColumnCustomComponentPipe as a$, CountDownDirective as a0, RouteFormChangeDirective as a1, DynamicStyleDirective as a2, NowraptextDirective as a3, LabelmandatoryDirective as a4, AbsoluteDivBodyDirective as a5, LoadExternalFilesDirective as a6, RenderUlvDirective as a7, PrintFilesDirective as a8, SaveImageDirective as a9, RemoveNewlinePipe as aA, MoValuePipe as aB, FilterPipe as aC, FilterTabPipe as aD, MoReportValueConcatPipe as aE, FilterStringPipe as aF, SortPipe as aG, BbbTranslatePipe as aH, BarsaIconDictPipe as aI, FileInfoCountPipe as aJ, ControlUiPipe as aK, VisibleValuePipe as aL, FilterToolbarControlPipe as aM, MultipleGroupByPipe as aN, PictureFieldSourcePipe as aO, FioriIconPipe as aP, CanUploadFilePipe as aQ, ListCountPipe as aR, TotalSummaryPipe as aS, MergeFieldsToColumnsPipe as aT, FindColumnByDbNamePipe as aU, FilterColumnsByDetailsPipe as aV, MoInfoUlvMoListPipe as aW, ReversePipe as aX, ColumnCustomUiPipe as aY, SanitizeTextPipe as aZ, MoInfoUlvPagingPipe as a_, WebOtpDirective as aa, SplideSliderDirective as ab, DynamicRootVariableDirective as ac, HorizontalResponsiveDirective as ad, MeasureFormTitleWidthDirective as ae, OverflowTextDirective as af, ShortcutRegisterDirective as ag, ShortcutHandlerDirective as ah, BarsaReadonlyDirective as ai, ResizeObserverDirective as aj, ColumnValueDirective as ak, ScrollToSelectedDirective as al, ScrollPersistDirective as am, TooltipDirective as an, SimplebarDirective as ao, LeafletLongPressDirective as ap, ResizeHandlerDirective as aq, SafeBottomDirective as ar, MoReportValuePipe as as, NumeralPipe as at, GroupByPipe as au, ContextMenuPipe as av, HeaderFacetValuePipe as aw, SeperatorFixPipe as ax, ConvertToStylePipe as ay, TlbButtonsPipe as az, PortalPageSidebarComponent as b, RUNTIME_NAV_STATE_SCHEMA_V1 as b$, ColumnValuePipe as b0, ColumnIconPipe as b1, RowNumberPipe as b2, ComboRowImagePipe as b3, IsExpandedNodePipe as b4, ThImageOrIconePipe as b5, FindPreviewColumnPipe as b6, ReplacePipe as b7, FilterWorkflowInMobilePipe as b8, HideColumnsInmobilePipe as b9, LogService as bA, PortalService as bB, UiService as bC, UlvMainService as bD, UploadService as bE, NetworkStatusService as bF, AudioRecordingService as bG, VideoRecordingService as bH, LocalStorageService as bI, IndexedDbService as bJ, BarsaStorageService as bK, PromptUpdateService as bL, NotificationService as bM, ServiceWorkerNotificationService as bN, ColumnService as bO, ServiceWorkerCommuncationService as bP, SaveScrollPositionService as bQ, RoutingService as bR, GroupByService as bS, LayoutMainContentService as bT, TabpageService as bU, InMemoryStorageService as bV, ScrollLayoutContextHolder as bW, ShellbarHeightService as bX, ApplicationCtrlrService as bY, PushCheckService as bZ, IdbService as b_, StringToNumberPipe as ba, ColumnValueOfParametersPipe as bb, HideAcceptCancelButtonsPipe as bc, FilterInlineActionListPipe as bd, IsImagePipe as be, ToolbarSettingsPipe as bf, CardMediaSizePipe as bg, LabelStarTrimPipe as bh, SplitPipe as bi, DynamicDarkColorPipe as bj, ChunkArrayPipe as bk, MapToChatMessagePipe as bl, PicturesByGroupIdPipe as bm, ScopedCssPipe as bn, ReportActionListPipe as bo, GetCssVariableValuePipe as bp, ApiService as bq, BreadcrumbService as br, CustomInjector as bs, DialogParams as bt, BarsaDialogService as bu, FormPanelService as bv, FormService as bw, ContainerService as bx, HorizontalLayoutService as by, LayoutService as bz, BaseDynamicComponent as c, MetaobjectDataModel as c$, buildRuntimeNavStateCacheKey as c0, RuntimeNavStateCacheService as c1, PushNotificationService as c2, CardViewService as c3, BaseSettingsService as c4, SimpleTemplateEngine as c5, TEMPLATE_ENGINE as c6, PortalDynamicPageResolver as c7, PortalFormPageResolver as c8, PortalPageResolver as c9, NOTIFICATAION_POPUP_SERVER as cA, TOAST_SERVICE as cB, NOTIFICATION_WEBWORKER_FACTORY as cC, GeneralControlInfoModel as cD, StringControlInfoModel as cE, RichStringControlInfoModel as cF, NumberControlInfoModel as cG, FilePictureInfoModel as cH, FileControlInfoModel as cI, CommandControlInfoModel as cJ, IconControlInfoModel as cK, PictureFileControlInfoModel as cL, GaugeControlInfoModel as cM, RelationListControlInfoModel as cN, HistoryControlInfoModel as cO, RabetehAkseTakiListiControlInfoModel as cP, RelatedReportControlInfoModel as cQ, CodeEditorControlInfoModel as cR, EnumControlInfoModel as cS, RowDataOption as cT, DateTimeControlInfoModel as cU, BoolControlInfoModel as cV, CalculateControlInfoModel as cW, SubformControlInfoModel as cX, LinearListControlInfoModel as cY, ListRelationModel as cZ, SingleRelationControlInfoModel as c_, PortalReportPageResolver as ca, TileGroupBreadcrumResolver as cb, LoginSettingsResolver as cc, ReportBreadcrumbResolver as cd, DateService as ce, DateHijriService as cf, DateMiladiService as cg, DateShamsiService as ch, EntitySettingsStore as ci, CalendarSettingsStore as cj, FormNewComponent as ck, ReportContainerComponent as cl, FormComponent as cm, FieldUiComponent as cn, BarsaSapUiFormPageModule as co, ReportNavigatorComponent as cp, BaseController as cq, FieldBaseController as cr, ViewBase as cs, ModalRootComponent as ct, ButtonLoadingComponent as cu, UnlimitSessionComponent as cv, SplitterComponent as cw, APP_VERSION as cx, DIALOG_SERVICE as cy, FORM_DIALOG_COMPONENT as cz, DynamicFormComponent as d, getLabelWidth as d$, MoForReportModelBase as d0, MoForReportModel as d1, ReportBaseInfo as d2, FormToolbarButton as d3, ReportExtraInfo as d4, MetaobjectRelationModel as d5, FieldInfoTypeEnum as d6, BaseReportModel as d7, DefaultCommandsAccessValue as d8, CustomCommand as d9, PageBaseComponent as dA, NumberBaseComponent as dB, FilesValidationHelper as dC, BarsaApi as dD, ReportViewBaseComponent as dE, FormPropsBaseComponent as dF, LinearListHelper as dG, PageWithFormHandlerBaseComponent as dH, FormPageBaseComponent as dI, FormPageComponent as dJ, BaseColumnPropsComponent as dK, TilePropsComponent as dL, FormFieldReportPageComponent as dM, ColumnRendererBase as dN, ColumnRendererViewBase as dO, BaseUlvSettingComponent as dP, TableHeaderWidthMode as dQ, setTableThWidth as dR, calculateColumnContent as dS, calculateColumnWidth as dT, setColumnWidthByMaxMoContentWidth as dU, calculateMoDataListContentWidthByColumnName as dV, calculateFreeColumnSize as dW, calculateColumnWidthFitToContainer as dX, calcContextMenuWidth as dY, RotateImage as dZ, isInLocalMode as d_, ReportModel as da, ReportListModel as db, ReportFormModel as dc, ReportCalendarModel as dd, ReportTreeModel as de, ReportViewColumn as df, DefaultGridSetting as dg, GridSetting as dh, ColSetting as di, SortSetting as dj, ReportField as dk, DateRanges as dl, SortDirection as dm, SelectionMode as dn, UlvHeightSizeType as dp, FieldBaseComponent as dq, FieldViewBase as dr, FormBaseComponent as ds, FormToolbarBaseComponent as dt, SystemBaseComponent as du, ReportBaseComponent as dv, ReportItemBaseComponent as dw, ApplicationBaseComponent as dx, LayoutItemBaseComponent as dy, LayoutPanelBaseComponent as dz, DynamicItemComponent as e, availablePrefixes as e$, getColumnValueOfMoDataList as e0, throwIfAlreadyLoaded as e1, measureText2 as e2, measureText as e3, measureTextBy as e4, genrateInlineMoId as e5, enumValueToStringSize as e6, isVersionBiggerThan as e7, compareVersions as e8, scrollToElement as e9, getIcon as eA, isImage as eB, GetAllColumnsSorted as eC, GetVisibleValue as eD, GroupBy as eE, FindGroup as eF, FillAllLayoutControls as eG, FindToolbarItem as eH, FindLayoutSettingFromLayout94 as eI, GetAllHorizontalFromLayout94 as eJ, getGridSettings as eK, getResetGridSettings as eL, GetDefaultMoObjectInfo as eM, getLayout94ObjectInfo as eN, getFormSettings as eO, createFormPanelMetaConditions as eP, getNewMoGridEditor as eQ, createGridEditorFormPanel as eR, getLayoutControl as eS, getControlList as eT, shallowEqual as eU, toNumber as eV, InputNumber as eW, AffixRespondEvents as eX, isTargetWindow as eY, getTargetRect as eZ, getFieldValue as e_, executeUlvCommandHandler as ea, getUniqueId as eb, getDateService as ec, getAllItemsPerChildren as ed, setOneDepthLevel as ee, isFirefox as ef, getImagePath as eg, checkPermission as eh, fixUnclosedParentheses as ei, isFunction as ej, DeviceWidth as ek, getHeaderValue as el, elementInViewport2 as em, PreventDefaulEvent as en, stopPropagation as eo, getParentHeight as ep, getComponentDefined as eq, isSafari as er, isFF as es, getDeviceIsPhone as et, getDeviceIsDesktop as eu, getDeviceIsTablet as ev, getDeviceIsMobile as ew, getControlSizeMode as ex, formatBytes as ey, getValidExtension as ez, formRoutes as f, requestAnimationFramePolyfill as f0, ExecuteDynamicCommand as f1, ExecuteWorkflowChoiceDef as f2, getRequestAnimationFrame as f3, cancelRequestAnimationFrame as f4, easeInOutCubic as f5, WordMimeType as f6, ImageMimeType as f7, PdfMimeType as f8, AllFilesMimeType as f9, IntersectionStatus as fA, fromIntersectionObserver as fB, CustomRouteReuseStrategy as fC, AuthGuard as fD, RedirectHomeGuard as fE, RootPageComponent as fF, ResizableComponent as fG, ResizableDirective as fH, ResizableModule as fI, PushBannerComponent as fJ, REPORT_GRID_VIEWPORT_CLASS as fK, DEFAULT_REPORT_LAYOUT_POLICY as fL, REPORT_TYPE_DEFAULT_POLICIES as fM, scrollLayoutModeToContextEnvironment as fN, contextDefaultsFromEnvironment as fO, resolveFinalScroll as fP, resolveReportLayoutPolicy as fQ, getReportTypeDefaultPolicy as fR, extractLayoutPolicyFromView as fS, BarsaNovinRayCoreModule as fT, VideoMimeType as fa, AudioMimeType as fb, MimeTypes as fc, GetContentType as fd, GetViewableExtensions as fe, ChangeLayoutInfoCustomUi as ff, mobile_regex as fg, number_only as fh, forbiddenValidator as fi, GetImgTags as fj, ImagetoPrint as fk, PrintImage as fl, SaveImageToFile as fm, validateAllFormFields as fn, getFocusableTagNames as fo, addCssVariableToRoot as fp, flattenTree as fq, IsDarkMode as fr, nullOrUndefinedString as fs, fromEntries as ft, bodyClick as fu, removeDynamicStyle as fv, addDynamicVariableTo as fw, AddDynamicFormStyles as fx, RemoveDynamicFormStyles as fy, ContainerComponent as fz, BaseViewPropsComponent as g, BaseViewContentPropsComponent as h, BaseViewItemPropsComponent as i, RowState as j, BaseItemContentPropsComponent as k, CardBaseItemContentPropsComponent as l, BaseFormToolbaritemPropsComponent as m, DynamicFormToolbaritemComponent as n, DynamicLayoutComponent as o, DynamicUlvToolbarComponent as p, DynamicUlvPagingComponent as q, reportRoutes as r, RootPortalComponent as s, BaseComponent as t, AttrRtlDirective as u, BaseDirective as v, ColumnResizerDirective as w, DynamicCommandDirective as x, EllipsifyDirective as y, IntersectionObserverDirective as z };
//# sourceMappingURL=barsa-novin-ray-core-barsa-novin-ray-core-D50KRKKo.mjs.map