(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["scenario-rdt-settings-scenario-rdt-settings-module"],{

/***/ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.html":
/*!***********************************************************************************************************************************************************!*\
  !*** ./node_modules/raw-loader/dist/cjs.js!./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.html ***!
  \***********************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("<div class=\"rdt-box\"  *ngIf=\"selectedGrpInfo == 'ALL'\">\n    <p  >Select an RDT group in order to set the RDT configuration.</p>\n</div>\n<div *ngIf=\"selectedGrpInfo != 'ALL'\" class=\"w-100-p my-24\">\n    <p-checkbox label=\"Run virtual user as real device user\" [(ngModel)]=\"chkRBU\"\n        [disabled]=\"enableDisKeywordList.G_RBU\" binary=\"true\"></p-checkbox>\n</div>\n\n<div *ngIf=\"chkRBU == true && selectedGrpInfo != 'ALL'\" class=\"w-100-p\">\n    <div class=\"w-100-p ml-5 my-16\">\n        <p-selectButton class=\"radio-selectButton\" (onChange)=\"getRDTDeviceData(false)\" [options]=\"rdtTypeOptions\" [(ngModel)]=\"Script\"></p-selectButton>\n    </div>\n    <div *ngIf=\"Script == 'Local' \" class=\"w-100-p my-16\">\n        <div class=\"w-100-p p-grid p-align-center my-16\">\n            <div class=\"p-col-2 p-col-nogutter\">Select operating system</div>\n            <div class=\"p-col-10 p-col-nogutter\">\n                <p-selectButton class=\"radio-selectButton\" [options]=\"operatingSystemTypeOptions\"\n                    [(ngModel)]=\"operatingSystemTypeOptionValue\"></p-selectButton>\n            </div>\n        </div>\n\n        <div *ngIf=\"operatingSystemTypeOptionValue == platformAndroid\" class=\"w-100-p p-grid p-align-center my-16\">\n            <div class=\"p-col-1  p-col-nogutter\">Enter IP address</div>\n            <div class=\"p-col-2 ml-25 p-col-nogutter\">\n                <input class=\"w-100-p\" type=\"text\" pInputText placeholder=\"{{brodCastAddress}}\" minlength=\"7\"\n                    maxlength=\"15\" required\n                    pattern=\"^((\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$\"\n                    [(ngModel)]=\"ip\" />\n            </div>\n            <div class=\"p-col-1 pl-10 p-col-nogutter\">Port</div>\n            <div class=\"p-col-2 p-col-nogutter\">\n                <input class=\"w-100-p\" pInputText type=\"text\" placeholder=\"5555\" minlength=\"1\" maxlength=\"5\" required\n                    pattern=\"^(\\d{1,5})$\" (keypress)=\"validatePort($event)\" [(ngModel)]=\"port\" />\n            </div>\n            <div class=\"p-col-4 pl-25 p-col-nogutter\">\n                <button pButton type=\"button\" (click)=\"getAndroidDeviceInfo()\" label=\"Add\"\n                    class=\"btn-primary-outline\"></button>\n            </div>\n            <div class=\"my-16 w-100-p\">\n                <p-table [value]=\"allllist\" [resizableColumns]=\"true\" [scrollable]='true' scrollHeight=\"146px\" [(selection)]=\"selectedDevice\"\n                    *ngIf=\"Script==='Local' && operatingSystemTypeOptionValue == platformAndroid\">\n                    <ng-template pTemplate=\"colgroup\" let-columns>\n                        <colgroup>\n                            <col class=\"p-col-1\">\n                            <col class=\"p-col-3\">\n                            <col class=\"p-col-2\">\n                            <col class=\"p-col-2\">\n                            <col class=\"p-col-3\">\n                            <col class=\"p-col-1\">\n                        </colgroup>\n                    </ng-template>\n                    <ng-template pTemplate=\"header\" let-columns>\n                        <tr>\n                            <th pResizableColumn>\n                                <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n                            </th>\n                            <th pResizableColumn>Device Id</th>\n                            <th pResizableColumn>Name</th>\n                            <th pResizableColumn>Version</th>\n                            <th pResizableColumn>Proxy port</th>\n                            <th pResizableColumn>Action</th>\n                        </tr>\n                    </ng-template>\n                    <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n                        <tr [pSelectableRow]=\"rowData\">\n                            <td class=\"text-center\">\n                                <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n                            </td>\n                            <td class=\"text-right\">\n                                {{rowData.Device_id}}\n                            </td>\n                            <td>\n                                {{rowData.Device_Model}}\n                            </td>\n                            <td class=\"text-right\">\n                                {{rowData.Device_Version}}\n                            </td>\n                            <td>\n                                <input type=\"text\" class=\"w-100-p\" (keypress)=\"validatePort($event)\" pInputText\n                                    [(ngModel)]=\"rowData.proxyPort\">\n                            </td>\n                            <td class=\"text-center\">\n                                <i class=\"icons8 icons8-more\"></i>\n                            </td>\n                        </tr>\n                    </ng-template>\n                    <ng-template pTemplate=\"emptymessage\" let-columns>\n                        <tr>\n                            <td class=\"text-center\" [attr.colspan]=\"6\">\n                                No Records Found\n                            </td>\n                        </tr>\n                    </ng-template>\n                </p-table>\n            </div>\n        </div>\n\n        <div *ngIf=\"operatingSystemTypeOptionValue == platformIOS\" class=\"w-100-p p-grid p-align-center my-16\">\n            <div class=\"p-grid p-align-center w-100-p p-justify-between\">\n                <div class=\"p-col-11 p-col-nogutter p-grid p-align-center p-justify-between\">\n                    <div class=\"p-col-1 p-col-nogutter\">Device Id</div>\n                    <div class=\"p-col-2 p-col-nogutter\">\n                        <input class=\"w-100-p\" type=\"text\" pInputText\n                            placeholder=\"ca9cb33448eadacb94f769a3a57891a978f74910\" [(ngModel)]='deviceId'\n                            required ngModel />\n                    </div>\n                    <div class=\"p-col-1 pl-10 p-col-nogutter\">Version</div>\n                    <div class=\"p-col-1 p-col-nogutter\">\n                        <input class=\"w-100-p\" type=\"text\" placeholder=\"2.3\" pInputText\n                            [(ngModel)]='deviceVersion' required ngModel />\n                    </div>\n                    <div class=\"p-col-1 pl-10 p-col-nogutter\">Proxy port</div>\n                    <div class=\"p-col-1 p-col-nogutter\">\n                        <input class=\"w-100-p\" type=\"text\" placeholder=\"5555\" minlength=\"1\" maxlength=\"5\"\n                            pattern=\"^(\\d{1,})$\" (keypress)=\"validatePort($event)\" pInputText\n                            [(ngModel)]='proxy' autofocus required ngModel />\n                    </div>\n                    <div class=\"p-col-1  pl-10  p-col-nogutter\">Hub Address</div>\n                    <div class=\"p-col-2 p-col-nogutter\">\n                        <input class=\"w-100-p\" type=\"text\" placeholder=\"{{brodCastAddress}}:5000\"\n                            (onInput)=\"validateIpAndPort(ip,port)\" pInputText [(ngModel)]='hubUrl' autofocus\n                            required ngModel />\n                    </div>\n                </div>\n                <div class=\"p-col-1 text-right  pl-10  p-col-nogutter\">\n                    <button pButton type=\"button\" label=\"Add\" (click)=\"addDeviceDetail()\"\n                        class=\" btn-primary-outline\"></button>\n                </div>\n            </div>\n\n            <div class=\"my-16 w-100-p\">\n                    <cav-table *ngIf=\"Script==='Local' && operatingSystemTypeOptionValue == platformIOS\" [value]=\"iosTabledata\" [headerRelativePath]=\"iosHeaderRelativePath\" [selection]=\"selectedDevice\"\n                        [scrollable]=\"true\" scrollHeight=\"146px\" (clickButtonEvent)=\"clickButtonEvent($event)\">\n                    </cav-table>\n            </div>\n\n        </div>\n\n        <div class=\"my-24 pt-24 pb-8 px-24  border-3 mr-5\" style=\"border-style:solid ; border-width:'1px' \"\n            *ngIf=\"Script==='Local'\">\n            <div class=\"w-100-p p-grid  p-align-center\">\n                <div class=\"font-16 font-weight-600 \">PERFORMANCE TOOL SETTINGS</div>\n            </div>\n            <div class=\"my-16\">\n                <p-checkbox label=\"Enable performance tool (Supported only for Chrome Browser)\"\n                    [(ngModel)]=\"G_RBU_CAPTURE_PERFORMANCE_TRACE.jsProfiler\"\n                    [disabled]=\"(!chkRBU || enableDisKeywordList.G_RBU_CAPTURE_PERFORMANCE_TRACE)\" binary=\"true\">\n                </p-checkbox>\n            </div>\n        </div>\n    </div>\n\n\n    <div *ngIf=\"Script == 'Cloud' \" class=\" w-100-p my-16\">\n        <div class=\"p-col-4 p-col-nogutter my-8 p-align-center p-grid\">\n            <div class=\"p-col-4 p-col-nogutter pl-0\"> Type </div>\n            <div class=\"p-col-8 p-col-nogutter\">\n                <p-dropdown (onChange)=\"getRDTDeviceData(false)\" [options]=\"lstRDTScriptType\" name=\"rdtScriptType\"\n                    [(ngModel)]=\"groupData.rdtScriptType\" [style]=\"{ 'min-width' : '100%' }\"\n                    dropdownIcon=\"icons8 icons8-expand-arrow\"></p-dropdown>\n            </div>\n        </div>\n\n        <div class=\"my-24 pt-24 pb-8 px-24 p-grid border-3 mr-5 borderTabClass \">\n            <div class=\"font-16 font-weight-600 w-100-p mb-8 \">DEVICE CONFIGURATION</div>\n            <div class=\"p-col-4 p-col-nogutter my-8 p-align-center p-grid\">\n                <div class=\"p-col-4 p-col-nogutter pl-0\">Device type </div>\n                <div class=\"p-col-8 p-col-nogutter\">\n                    <p-dropdown (onChange)=\"changeOSValue()\" [options]=\"lstOptRdtUrl\" name=\"lstRdtUrl\"\n                        [(ngModel)]=\"groupData.rdtURLType\" [style]=\"{ 'min-width' : '100%' }\"\n                        dropdownIcon=\"icons8 icons8-expand-arrow\"></p-dropdown>\n                </div>\n            </div>\n            <div class=\"p-col-4 p-col-nogutter my-8 p-align-center p-grid\">\n                <div class=\"p-col-4 p-col-nogutter pl-10\">OS</div>\n                <div class=\"p-col-8 p-col-nogutter\">\n                    <p-dropdown (onChange)=\"changeBrowserValue()\" [options]=\"lstOptOS\" [(ngModel)]=\"rdtDeviceObj.osType\"\n                        [style]=\"{ 'min-width' : '100%' }\" dropdownIcon=\"icons8 icons8-expand-arrow\"></p-dropdown>\n                </div>\n            </div>\n            <div class=\"p-col-4 p-col-nogutter my-8 p-align-center p-grid\">\n                <div class=\"p-col-4 pl-10 p-col-nogutter \">Device Name</div>\n                <div class=\"p-col-8 p-col-nogutter\">\n                    <p-dropdown (onChange)=\"changeVersionValue() \" [options]=\"lstOptBrowser\" [filter]=\"true\"\n                        [(ngModel)]=\"rdtDeviceObj.browserType\" [style]=\"{ 'min-width' : '100%' }\"\n                        dropdownIcon=\"icons8 icons8-expand-arrow\"></p-dropdown>\n                </div>\n            </div>\n            <div class=\"p-col-4 p-col-nogutter my-8 p-align-center p-grid\">\n                <div class=\"p-col-4 p-col-nogutter pl-0\">Version</div>\n                <div class=\"p-col-8 p-col-nogutter\">\n                    <p-dropdown [options]=\"lstOptVersion\" (onChange)=\"setRdtInUserProfile()\" [filter]=\"true\"\n                        [(ngModel)]=\"rdtDeviceObj.version\" name=\"lstVersion\" [style]=\"{ 'min-width' : '100%' }\"\n                        dropdownIcon=\"icons8 icons8-expand-arrow\"></p-dropdown>\n                </div>\n            </div>\n            <div class=\"p-col-4 p-col-nogutter my-8 p-align-center p-grid\">\n                <div class=\"p-col-4 p-col-nogutter pl-10\">Network</div>\n                <div class=\"p-col-8 p-col-nogutter\">\n                    <p-dropdown [options]=\"lstNetworktype\" name=\"lstNetworktype\" [(ngModel)]=\"rdtDeviceObj.networktype\"\n                        (onChange)=\"setRdtInUserProfile()\" [style]=\"{ 'min-width' : '100%' }\"\n                        dropdownIcon=\"icons8 icons8-expand-arrow\"></p-dropdown>\n                </div>\n            </div>\n            <div class=\"p-col-4 my-8 text-right p-col-nogutter\">\n                <button pButton type=\"button\" (click)=\"addDeviceCloudTable()\" label=\"Add Device Configuration\"></button>\n            </div>\n\n            <div class=\"my-8 w-100-p\">\n                <cav-table [value]=\"cloudDeviceList\" [headerRelativePath]=\"cloudHeaderRelativePath\" [selection]=\"selectedDevice\"\n                        [scrollable]=\"true\" scrollHeight=\"146px\" (clickButtonEvent)=\"clickButtonEvent($event)\">\n                </cav-table>\n            </div>\n        </div>\n    </div>\n</div>");

/***/ }),

/***/ "./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.scss":
/*!*********************************************************************************************************************!*\
  !*** ./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.scss ***!
  \*********************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("app-scenario-rdt-settings .rdt-box {\n  text-align: center;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  margin-top: 128px;\n}\napp-scenario-rdt-settings .rdt-box p {\n  padding: 24px;\n  border: 1px solid var(--secondary-400);\n  background-color: var(--secondary-100);\n  border-radius: 6px;\n  font-weight: 500;\n  font-size: 14px;\n}\napp-scenario-rdt-settings .borderTabClass {\n  border-style: solid;\n  border-width: 1px;\n  background-color: var(--body-color);\n  border-radius: 3px;\n}");

/***/ }),

/***/ "./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.ts":
/*!*******************************************************************************************************************!*\
  !*** ./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.ts ***!
  \*******************************************************************************************************************/
/*! exports provided: ScenarioRdtSettingsComponent */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ScenarioRdtSettingsComponent", function() { return ScenarioRdtSettingsComponent; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js");
/* harmony import */ var primeng__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primeng */ "./node_modules/primeng/__ivy_ngcc__/fesm2015/primeng.js");
/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm2015/operators/index.js");
/* harmony import */ var src_app_core_session_session_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/core/session/session.service */ "./src/app/core/session/session.service.ts");
/* harmony import */ var src_app_shared_header_work_profile_services_work_profile_active_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! src/app/shared/header/work-profile/services/work-profile-active.service */ "./src/app/shared/header/work-profile/services/work-profile-active.service.ts");
/* harmony import */ var _commons_immutable_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../commons/immutable-array */ "./src/app/pages/scenario/commons/immutable-array.ts");
/* harmony import */ var _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../constants/scen-schedule-constants */ "./src/app/pages/scenario/constants/scen-schedule-constants.ts");
/* harmony import */ var _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../interface/scenario-state */ "./src/app/pages/scenario/interface/scenario-state.ts");
/* harmony import */ var _interface_sch_group_data__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../interface/sch-group-data */ "./src/app/pages/scenario/interface/sch-group-data.ts");
/* harmony import */ var _service_scen_keyword_definition_service__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../service/scen-keyword-definition.service */ "./src/app/pages/scenario/service/scen-keyword-definition.service.ts");
/* harmony import */ var _service_scenario_http_service__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../service/scenario-http.service */ "./src/app/pages/scenario/service/scenario-http.service.ts");
/* harmony import */ var _service_scenario_utils_service__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../service/scenario-utils.service */ "./src/app/pages/scenario/service/scenario-utils.service.ts");
/* harmony import */ var _service_sch_schedule_data_service__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../service/sch-schedule-data.service */ "./src/app/pages/scenario/service/sch-schedule-data.service.ts");
/* harmony import */ var _service_group_based_settings_data_service__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../service/group-based-settings-data.service */ "./src/app/pages/scenario/group-based-settings-main/service/group-based-settings-data.service.ts");
/* harmony import */ var _scenario_rdt_constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./scenario-rdt.constants */ "./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt.constants.ts");
/* harmony import */ var _interface_scenario_model__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../interface/scenario.model */ "./src/app/pages/scenario/interface/scenario.model.ts");
/* harmony import */ var _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../constants/scen-common-constants */ "./src/app/pages/scenario/constants/scen-common-constants.ts");


















let ScenarioRdtSettingsComponent = class ScenarioRdtSettingsComponent {
    constructor(keywordDefinition, dataService, confirmationService, scenarioUtilsService, scenarioHttpService, schData, session, activeWPService) {
        this.keywordDefinition = keywordDefinition;
        this.dataService = dataService;
        this.confirmationService = confirmationService;
        this.scenarioUtilsService = scenarioUtilsService;
        this.scenarioHttpService = scenarioHttpService;
        this.schData = schData;
        this.session = session;
        this.activeWPService = activeWPService;
        this.platformAndroid = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_ANDROID"];
        this.platformIOS = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"];
        this.enableDisKeywordList = {
            "G_RBU": false,
            "G_RBU_CAPTURE_PERFORMANCE_TRACE": false,
            "SGRP": false,
        };
        this.G_RBU_CAPTURE_PERFORMANCE_TRACE = {
            jsProfiler: false,
            timeout: 10000,
            isMemory: true,
            isScreenshot: false,
            isCapTraceTillNetwork: false
        };
        this.screenKeywordList = Object.keys(this.enableDisKeywordList);
        this.arrKeywordData = {}; //main obj of screen Keyword data.
        this.isGroupEnabled = ''; //set none if want to disable in that case where there is no groups
        this.flag = false;
        this.selectedGrpInfo = _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"];
        this.arrGrpList = [];
        /** Values for rbu setting */
        this.chkRBU = false;
        //   // Check enabler for enable light house
        this.chkLightHouse = false;
        this.lstBrowserType = 1;
        this.isRdtEnabled = false;
        this.operatingSystemTypeOptionValue = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_ANDROID"];
        this.chkHarSetting = false;
        this.chkSnapShot = true;
        this.tempDeviceList = {};
        this.isBrowserRDTEnabled = false;
        this.ip = "";
        this.port = "";
        this.allllist = [];
        this.userDeviceDataCloud = ''; //to store cloud device data to userDevicedata.seq
        this.proxyPortForCloud = ''; //user input for proxy port in cloud case
        this.isFirstTime = true;
        //  cloud device table list
        this.cloudDeviceList = [];
        this.lstNetworktype = [];
        this.lstOptRdtUrl = [];
        this.lstOptBrowser = [];
        this.lstOptVersion = [];
        // This used to display list of rdt script types
        this.lstRDTScriptType = [];
        this.lstOptUserAgent = [];
        this.iosTabledata = [];
        this.index = 0;
        this.Script = 'Local';
        this.rdtDeviceObj = new _scenario_rdt_constants__WEBPACK_IMPORTED_MODULE_15__["RDTDeviceObj"]();
        //mobileObj
        this.rdtMobileObj = new _scenario_rdt_constants__WEBPACK_IMPORTED_MODULE_15__["RDTMobileObj"]();
        //desktopObj
        this.rdtDesktopObj = new _scenario_rdt_constants__WEBPACK_IMPORTED_MODULE_15__["RDTDesktopObj"]();
        this.isFromSave = false;
        this.brodCastAddress = "";
        this.deviceId = "";
        this.deviceVersion = "";
        this.proxy = "";
        this.hubUrl = "";
        this.iosHeaderRelativePath = "scenario/scenarioProfile/scenario-rdt-local-ios.json";
        this.cloudHeaderRelativePath = "scenario/scenarioProfile/scenario-rdt-cloud.json";
        this.isUbuntuMode = true;
        this.saveData = this.scenarioUtilsService.$saveGroupbasedSetting.subscribe((res) => {
            if (!this.sendDeviceDetailToFile())
                return;
            this.validateAndSaveData();
        });
        /**
         * Subscribing to events like add group, delete group or switch group from group based top menu.
         */
        this.grpAddDelSub = this.dataService.addGrpObservable$.subscribe((res) => {
            let validation = true;
            if (res['from'] == 'addGrp') {
                validation = this.addGroup(res['grpName']);
                this.dataService.emitOnAddedGrpObservable({ validation, grpName: this.selectedGrpInfo, from: res['from'] });
            }
            if (res['from'] == 'deleteGrp') {
                validation = this.deleteSelectedGroup(res['grpName']);
                this.dataService.emitOnAddedGrpObservable({ validation, grpName: this.selectedGrpInfo, from: res['from'] });
            }
            if (res['from'] == 'grpInfo') {
                validation = this.openGroupInfo(res['grpName']);
                this.dataService.emitOnAddedGrpObservable({ validation, grpName: this.selectedGrpInfo, from: res['from'] });
            }
        });
        this.groupData = new _interface_sch_group_data__WEBPACK_IMPORTED_MODULE_9__["SchGroupData"]();
        this.groupData.scriptType = this.Script;
        this.getRDTDeviceData();
        this.scenarioHttpService.getIPStringConst(["BROADCAST_ADDREESS"]).subscribe((state) => {
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["GetIPStringConstLoadingState"]) {
                return;
            }
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["GetIPStringConstLoadedState"]) {
                this.brodCastAddress = state.data.BROADCAST_ADDREESS;
                return;
            }
        }, (state) => {
            console.log(state.error);
            return;
        });
    }
    canDeactivate() {
        //insert logic to check if there are pending changes here;
        //returning true will navigate without confirmation
        //returning false will show a confirm alert before navigating away
        try {
            if (this.validateAndSetKeywordArray() == false) {
                return false;
            }
        }
        catch (e) {
            console.log("can Deactivate in compponents", e);
        }
        return true;
    }
    setDataInConf() {
        return true;
    }
    ngOnInit() {
        this.operatingSystemTypeOptions = [
            { label: 'Android', value: _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_ANDROID"] },
            { label: 'IOS', value: _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"] }
        ];
        this.rdtTypeOptions = [
            { label: 'Local', value: 'Local' },
            { label: 'Cloud', value: 'Cloud' }
        ];
        this.lstRDTScriptType = this.createSelectItem(_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["RDT_SCRIPT_TYPE_ARR2"]);
        this.lstOptRdtUrl = this.createSelectItem(_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["RDT_URL_ARR"]);
        this.deviceList = [{ label: 'Mobile', value: 'Mobile' }, { label: 'Desktop', value: 'Desktop' }];
        //Need to fill arrGrpList before call for keyword from server or memory as arrGrpList is need in case of edit mode.
        this.addGroupTab();
        // this.dataService.setSelectedComponent(this.classname);
        this.arrKeywordData = this.keywordDefinition.chkAndGetKeywrdDataWithAdditionalKeys(this.screenKeywordList);
        if (this.keywordDefinition.isArrKeywordDataEmpty(this.arrKeywordData, this.screenKeywordList)) {
            this.keywordDefinition.setRequestKeywordListInBody(this.screenKeywordList, "");
            let obj = this.keywordDefinition.getRequestJsonParm();
            this.getKeywordData(obj);
            //error case
            if (this.arrKeywordData == null)
                this.arrKeywordData = {};
        }
        else
            this.fillDataInComp();
    }
    getKeywordData(obj) {
        this.scenarioHttpService.getDefaultKeywordData(obj).subscribe((state) => {
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["GetDefaultKeywordDataLoadingState"]) {
                return;
            }
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["GetDefaultKeywordDataLoadedState"]) {
                this.keywordDefinition.setArrKeywordData(this.arrKeywordData, state.data, this.keywordDefinition.mergeKeywordData);
                this.fillDataInComp();
                return;
            }
        }, (state) => {
            console.log(state.error);
            return;
        });
    }
    validateAndSaveData() {
        this.isFromSave = true;
        if (this.validateAndSetKeywordArray()) {
            this.scenarioUtilsService.saveComponentData(0, {});
        }
    }
    addGroupTab() {
        this.arrGrpList = this.dataService.getGroupNameList();
        if (this.arrGrpList.length == 0) {
            this.isGroupEnabled = 'none';
        }
        else {
            this.isGroupEnabled = '';
        }
    }
    addGroup(grpName) {
        if (this.validateAndSetKeywordArray() == false)
            return false;
        this.selectedGrpInfo = this.dataService.selectedGrp = grpName;
        this.flag = false;
        this.showGrpTab(grpName);
        this.copyKeywordFromDefault();
        this.setDataOnGrpAdd(grpName);
        return true;
    }
    setDataOnGrpAdd(grpName) {
        this.selectedGrpInfo = this.dataService.selectedGrp = grpName;
        this.flag = false;
        this.showGrpTab(grpName);
        this.copyKeywordFromDefault();
    }
    /**this function is used to add the Group Tab, selected by user */
    showGrpTab(groupLabel) {
        try {
            if (this.arrGrpList.indexOf(groupLabel) == -1)
                return;
            if (this.dataService.groupList && this.dataService.groupList.length != 0) {
                for (let i = 0; i < this.dataService.groupList.length; i++) {
                    if (this.dataService.groupList[i].label == groupLabel)
                        this.flag = true;
                }
                if (!this.flag) {
                    this.dataService.groupList.push({ label: groupLabel, value: groupLabel });
                    for (let j = 0; j < this.groupList.length; j++) {
                        if (this.groupList[j].label == groupLabel)
                            this.groupList.splice(j, 1);
                    }
                }
                this.flag = false;
            }
            else {
                this.dataService.groupList.push({ label: groupLabel, value: groupLabel });
                for (let j = 0; j < this.groupList.length; j++) {
                    if (this.groupList[j].label == groupLabel)
                        this.groupList.splice(j, 1);
                }
            }
        }
        catch (e) {
            console.log("Exception in showGrpTab method = ", e);
        }
    }
    deleteSelectedGroup(groupName) {
        if (confirm("Clear Real Browser User Settings for group '" + groupName + "' ? \n It will use default settings.")) {
            if (groupName != _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]) {
                for (let i = 0; i < this.dataService.groupList.length; i++) {
                    if (this.dataService.groupList[i].label == groupName) {
                        this.dataService.groupList.splice(i, 1);
                        i = i - 1;
                    }
                }
                if (this.validateAndSetKeywordArray() == false)
                    return false;
                this.copyKeywordFromDefault();
                this.flag = false;
                let rbuData = this.arrKeywordData["G_RBU"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA][groupName];
                if (rbuData != undefined) {
                    delete this.arrKeywordData["G_RBU"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA][groupName];
                }
                if (groupName == this.selectedGrpInfo)
                    this.openGroupInfo(_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"], true);
                else
                    this.openGroupInfo(this.selectedGrpInfo, true);
            }
        }
        return true;
    }
    fillDataInComp() {
        let keys = Object.keys(this.arrKeywordData);
        for (let i = 0; i < keys.length; i++) //keyword iteration
         {
            let strKeyword = keys[i];
            let keyObj = this.arrKeywordData[strKeyword];
            let dataObj = this.arrKeywordData[strKeyword][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA];
            this.enableDisKeywordList[strKeyword] = this.dataService.isCompEnable(this.dataService.getScenMode(), keyObj, strKeyword);
            if (dataObj == undefined) {
            }
            let grpKeys = Object.keys(dataObj);
            //no group present
            if (grpKeys.length == 0)
                continue;
            if (strKeyword == 'G_RBU') //screenKeywordList[0] means "G_RBU"
             {
                if (this.dataService.getRDTGrpList().length != 0) {
                    let rdtKeys = this.dataService.getRDTGrpList();
                    for (let p = 0; p < rdtKeys.length; p++) {
                        if (grpKeys.indexOf(rdtKeys[p]) == -1)
                            grpKeys = grpKeys.concat(rdtKeys[p]);
                    }
                }
                for (let ii = 0; ii < grpKeys.length; ii++) {
                    if (grpKeys[ii] != _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]) {
                        this.showGrpTab(grpKeys[ii]);
                    }
                    else //this is the default tab case at the time when user click from left tree 
                     {
                        let grpArr = dataObj[_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]];
                        this.setRbuData(grpArr);
                    }
                }
            }
            else if (strKeyword == 'G_RBU_CAPTURE_PERFORMANCE_TRACE') {
                for (let ii = 0; ii < grpKeys.length; ii++) {
                    if (grpKeys[ii] != _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]) {
                        this.showGrpTab(grpKeys[ii]);
                        if (dataObj[grpKeys[ii]][0] == '1') {
                            this.G_RBU_CAPTURE_PERFORMANCE_TRACE.jsProfiler = true;
                        }
                    }
                    else //this is the default tab case at the time when user click from left tree 
                     {
                        let grpArr = dataObj[_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]];
                        this.setJSProfileData(grpArr);
                        if (dataObj[grpKeys[ii]][0] == '1') {
                            this.G_RBU_CAPTURE_PERFORMANCE_TRACE.jsProfiler = true;
                        }
                    }
                }
            }
            else if (strKeyword == 'SGRP') {
                for (let ii = 0; ii < grpKeys.length; ii++) {
                    if (grpKeys[ii] != _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]) {
                    }
                    else //this is the default tab case at the time when user click from left tree 
                     {
                        let grpArr = dataObj[_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]];
                    }
                }
            }
        }
        //Need to open the RDT group info, by default.
        this.openRdtGroupFirst();
        this.dataService.upDateGroupMenuIcon();
    }
    openRdtGroupFirst() {
        try {
            if (this.dataService.getRDTGrpList().length != 0) {
                let tmpObj = this.arrKeywordData["G_RBU"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA];
                let rdtKeys = this.dataService.getRDTGrpList();
                for (let i = 0; i < rdtKeys.length; i++) {
                    if (tmpObj[rdtKeys[i]] == null) {
                        tmpObj[rdtKeys[i]] = this.dataService.getRDTRbuGrp()[rdtKeys[i]];
                    }
                }
                if (rdtKeys.length > 0) {
                    this.openGroupInfo(rdtKeys[0]);
                }
            }
        }
        catch (e) {
            console.log('openRdtGroupFirst | error is = ', e);
        }
    }
    /**
   * this function is called, when user clicks on any group tab
   */
    openGroupInfo(groupName, isValidate) {
        if (isValidate == undefined) {
            if (this.validateAndSetKeywordArray() == false)
                return false;
        }
        this.selectedGrpInfo = this.dataService.selectedGrp = groupName;
        if (this.selectedGrpInfo == 'ALL')
            return true;
        // For visual RDT_NATIVE groups, render device table directly from group-level RDT config.
        const loadedFromRdtNativeConfig = this.loadDevicesFromVisualRdtNativeGroup();
        let scenarioGrpWiseDevice = this.dataService.getGroupNameList(true);
        scenarioGrpWiseDevice.forEach(element => {
            if (element['grpName'] == this.selectedGrpInfo) {
                let profile = element['userProfile'].toString();
                let deviceInfo = profile.split(':');
                if (profile.startsWith('C:')) {
                    this.Script = 'Cloud';
                    this.groupData.rdtURLType = element['rdtURLType'];
                    this.groupData.userProfile = profile;
                    if (deviceInfo[1] == 'MobileWeb') {
                        this.groupData.rdtScriptType = "Mobile Web";
                        this.lstOptRdtUrl = this.createSelectItem(_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["RDT_URL_ARR"]);
                    }
                    else {
                        this.groupData.rdtScriptType = "Native App";
                        this.lstOptRdtUrl = [{ label: 'Mobile', value: '10' }];
                    }
                }
                else if (!loadedFromRdtNativeConfig)
                    this.Script = 'Local';
            }
        });
        if (!loadedFromRdtNativeConfig) {
            let allGroupData = this.dataService.getGroupData();
            let scriptName = allGroupData[this.selectedGrpInfo]['scriptName'];
            let username = this.session.session.cctx.u;
            this.scenarioHttpService.getDeviceDetails(scriptName, username).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["timeout"])(2000)).subscribe((state) => {
                if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["readDeviceDetailsLoadingState"]) {
                    return false;
                }
                if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["readDeviceDetailsLoadedState"]) {
                    let res = state.data;
                    if (res["status"] == "success" && res['device_list'].length != 0) {
                        let devices = res['device_list'];
                        this.fillDeviceDetail(devices);
                        if (this.cloudDeviceList.length > 0) {
                            this.Script = 'Cloud';
                            this.getRDTDeviceData();
                        }
                        if (this.iosTabledata.length > 0) {
                            this.Script = 'Local';
                            this.operatingSystemTypeOptionValue = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"];
                            this.index = 1;
                        }
                        else
                            this.index = 0;
                    }
                    return false;
                }
            }, (state) => {
                console.log(state.error);
                return false;
            });
        }
        if (this.Script == 'Cloud') {
            this.getRDTDeviceData();
        }
        else {
            if (this.isFirstTime) {
                this.fillLocalDeviceToTable();
                this.isFirstTime = false;
            }
        }
        /** this is to fill the auto fetch table data */
        try {
            let rbuObj = this.arrKeywordData["G_RBU"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA];
            let rbuArr = rbuObj[groupName];
            this.setRbuData(rbuArr);
        }
        catch (e) {
            let grpRdtArr = this.dataService.getRDTGrpList();
            let list = this.dataService.getGroupData();
            if (groupName == 'ALL') {
                this.isRdtEnabled = false;
                this.isBrowserRDTEnabled = false;
                if (this.lstOptUserAgent[1].value !== 1) {
                    this.lstOptUserAgent[1] = { label: "As per user profile", value: 1 };
                    this.lstOptUserAgent[2] = { label: "Use custom string", value: 2 };
                }
            }
            else {
                if (list[groupName].profileName.startsWith("Ubuntu")) {
                    this.isBrowserRDTEnabled = true;
                    this.isRdtEnabled = false;
                    if (this.lstOptUserAgent[1].value == 1) {
                        this.lstOptUserAgent.splice(1, 1);
                    }
                }
                else {
                    if (grpRdtArr.indexOf(groupName) != -1) {
                        this.isBrowserRDTEnabled = false;
                        this.isRdtEnabled = true;
                    }
                    else {
                        this.isRdtEnabled = false;
                        this.isBrowserRDTEnabled = false;
                        if (this.lstOptUserAgent[1].value !== 1) {
                            this.lstOptUserAgent[1] = { label: "As per user profile", value: 1 };
                            this.lstOptUserAgent[2] = { label: "Use custom string", value: 2 };
                        }
                    }
                }
            }
            let rbuJSProfilerObj = this.arrKeywordData["G_RBU_CAPTURE_PERFORMANCE_TRACE"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA];
            let rbuJSProfilerArr = rbuJSProfilerObj[groupName];
            this.setJSProfileData(rbuJSProfilerArr);
        }
        return true;
    }
    // Uses group-level RDT_NATIVE array as the source-of-truth for visual mobile native groups.
    loadDevicesFromVisualRdtNativeGroup() {
        var _a;
        const targetGroup = (_a = this.schData.groupDataList) === null || _a === void 0 ? void 0 : _a.find(g => g.grpName === this.selectedGrpInfo);
        if (!targetGroup || targetGroup.grpType !== _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["GROUP_TYPE"].RDT_NATIVE) {
            return false;
        }
        const rdtConfig = targetGroup[_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["GROUP_TYPE"].RDT_NATIVE];
        if (!Array.isArray(rdtConfig) || rdtConfig.length === 0) {
            return false;
        }
        this.fillDeviceDetail(rdtConfig);
        if (this.cloudDeviceList.length > 0) {
            this.Script = 'Cloud';
        }
        else if (this.iosTabledata.length > 0) {
            this.Script = 'Local';
            this.operatingSystemTypeOptionValue = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"];
            this.index = 1;
        }
        else {
            this.index = 0;
        }
        return true;
    }
    fillLocalDeviceToTable() {
        if (!(this.Script == 'Local'))
            return;
        this.scenarioHttpService.getAndroidDeviceInfo1().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["timeout"])(20000)).subscribe((state) => {
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["getAndroidDeviceInfoLoadingState"]) {
                return;
            }
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["getAndroidDeviceInfoLoadedState"]) {
                if (!(state.data['Status'] == 'Error')) {
                    this.allllist = state.data['Data'];
                    this.scenarioUtilsService.successMessage('Connected Devices Found');
                }
                return;
            }
        }, (state) => {
            console.log(state.error);
        });
    }
    getRDTDeviceData(isUpdate) {
        if (this.groupData.rdtScriptType == 'Native App' && Object.keys(this.schData.$rdtNativeAppDeviceData).length > 0) {
            this.changeScriptTypeValue();
            try {
                if (isUpdate != false)
                    this.updateUiOnGroupChange();
            }
            catch (error) {
                console.log("error is : ", error);
            }
            return;
        }
        else if ((this.groupData.rdtScriptType == 'Mobile Web' || this.groupData.rdtScriptType == 'URL') && Object.keys(this.schData.$rdtDeviceData).length > 0) {
            this.changeScriptTypeValue();
            try {
                if (isUpdate != false)
                    this.updateUiOnGroupChange();
            }
            catch (error) {
                console.log("error is : ", error);
            }
            return;
        }
        this.scenarioHttpService.getRDTDeviceData(this.groupData.rdtScriptType).subscribe((state) => {
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["GetRdtDeviceDataLoadingState"]) {
                return;
            }
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["GetRdtDeviceDataLoadedState"]) {
                let status = "";
                let res = state.data;
                if (this.groupData.rdtScriptType == 'Native App') {
                    this.schData.$rdtNativeAppDeviceData = res;
                    status = this.schData.$rdtNativeAppDeviceData['status'];
                }
                else {
                    this.schData.$rdtDeviceData = res;
                    status = this.schData.$rdtDeviceData['status'];
                }
                this.lstNetworktype = this.getNetworkList(res);
                if (status != '' && status != 'Success') {
                    this.scenarioUtilsService.errorMessage(status);
                    if (res['Mobile']) {
                        delete res['Mobile'];
                    }
                    if (this.groupData.rdtScriptType == 'Native App') {
                        this.schData.$rdtNativeAppDeviceData = res;
                    }
                    else {
                        this.schData.$rdtDeviceData = res;
                    }
                    this.lstOptRdtUrl = [{ label: 'Desktop', value: '11' }];
                    if (this.groupData) {
                        this.groupData.rdtURLType = '11';
                    }
                }
                try {
                    this.changeScriptTypeValue();
                    if (this.isUpdate != false)
                        this.updateUiOnGroupChange();
                }
                catch (error) {
                    console.log("error is : ", error);
                }
                return;
            }
        }, (state) => {
            console.log(state.error);
        });
    }
    getNetworkList(res) {
        let keys = Object.keys(res['networkType']);
        keys = keys.sort();
        this.lstNetworktype = [];
        let networkArr = [];
        for (let i = 0; i < keys.length; i++) {
            console.log("network -->", keys[i]);
            networkArr.push({ label: keys[i], value: keys[i] });
            this.rdtDeviceObj.networktype = keys[i];
        }
        return networkArr;
    }
    // The below method will be called when user changes the RDT script type
    changeScriptTypeValue(isEdit) {
        let res;
        if (this.groupData.rdtScriptType == 'Native App') {
            this.lstOptRdtUrl = [{ label: 'Mobile', value: '10' }];
            this.groupData.rdtURLType = '10';
            res = this.schData.$rdtNativeAppDeviceData;
        }
        else {
            this.lstOptRdtUrl = this.createSelectItem(_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["RDT_URL_ARR"]);
            this.groupData.rdtURLType = '10';
            res = this.schData.$rdtDeviceData;
        }
        this.lstNetworktype = this.getNetworkList(res);
        this.changeOSValue(isEdit);
    }
    changeOSValue(isEdit) {
        try {
            if (this.checkRDTDeviceAvailability() == false)
                return;
            let desktopDataObj = {};
            if (this.groupData)
                if (this.groupData.rdtURLType == '10') { //means mobile
                    if (this.groupData.rdtScriptType == 'Native App') {
                        desktopDataObj = this.schData.$rdtNativeAppDeviceData['Mobile'];
                    }
                    else {
                        desktopDataObj = this.schData.$rdtDeviceData['Mobile'];
                    }
                }
                else {
                    if (this.groupData.rdtScriptType == 'Native App') {
                        desktopDataObj = this.schData.$rdtNativeAppDeviceData['Desktop'];
                    }
                    else {
                        desktopDataObj = this.schData.$rdtDeviceData['Desktop'];
                    }
                }
            //Desktop cases
            let osDevices = Object.keys(desktopDataObj);
            this.lstOptOS = this.dataService.createSelectItem(osDevices);
            if (isEdit == undefined) {
                this.rdtDeviceObj.osType = osDevices[0];
            }
            this.changeBrowserValue(isEdit);
        }
        catch (e) {
            console.log(e);
        }
    }
    checkRDTDeviceAvailability() {
        if (this.groupData.rdtScriptType == 'Native App' && Object.keys(this.schData.$rdtNativeAppDeviceData).length == 0) {
            this.scenarioUtilsService.errorMessage('No device data is available');
            return false;
        }
        else if ((this.groupData.rdtScriptType == 'Mobile Web' || this.groupData.rdtScriptType == 'URL') && Object.keys(this.schData.$rdtDeviceData).length == 0) {
            this.scenarioUtilsService.errorMessage('No device data is available');
            return false;
        }
        return true;
    }
    changeBrowserValue(isEdit) {
        try {
            if (this.rdtDeviceObj.osType == "Ubuntu") {
                this.isUbuntuMode = false;
            }
            else {
                this.isUbuntuMode = true;
            }
            let desktopDataObj = {};
            let browserList = [];
            if (this.groupData)
                if (this.groupData.rdtURLType == '10') { //means mobile
                    if (this.groupData.rdtScriptType == 'Native App') {
                        desktopDataObj = this.schData.$rdtNativeAppDeviceData['Mobile'];
                    }
                    else {
                        desktopDataObj = this.schData.$rdtDeviceData['Mobile'];
                    }
                }
                else {
                    if (this.groupData.rdtScriptType == 'Native App') {
                        desktopDataObj = this.schData.$rdtNativeAppDeviceData['Desktop'];
                    }
                    else {
                        desktopDataObj = this.schData.$rdtDeviceData['Desktop'];
                    }
                }
            this.tempDeviceList = desktopDataObj;
            //Desktop cases
            let osDevices = Object.keys(desktopDataObj);
            //first time this.rdtDeviceObj.osType is undefined so put this check too fill list first time
            if (!this.rdtDeviceObj.osType) {
                this.rdtDeviceObj.osType = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_ANDROID"];
            }
            for (let i = 0; i < osDevices.length; i++) {
                if (this.rdtDeviceObj.osType == osDevices[i]) {
                    let arryList = desktopDataObj[osDevices[i]];
                    for (let j = 0; j < arryList.length; j++) {
                        let browserName = arryList[j]['name'];
                        if (browserList.indexOf(browserName) == -1)
                            browserList.push(browserName);
                    }
                }
            }
            //to remove opera in case of any OS X as it is not supported in browser stack
            if (this.rdtDeviceObj.osType.startsWith('OS')) {
                let ind = browserList.indexOf('Opera');
                if (ind != -1) {
                    browserList.splice(ind, 1);
                }
            }
            this.lstOptBrowser = this.dataService.createSelectItem(browserList);
            if (isEdit == undefined) {
                this.rdtDeviceObj.browserType = browserList[0];
            }
            this.changeVersionValue(isEdit);
        }
        catch (e) {
            console.log(e);
        }
    }
    changeVersionValue(isEdit) {
        try {
            let desktopDataObj = {};
            let browserVersionList = [];
            let firstCase = false;
            if (this.groupData)
                if (this.groupData.rdtURLType == '10') { //means mobile
                    if (this.groupData.rdtScriptType == 'Native App') {
                        desktopDataObj = this.schData.$rdtNativeAppDeviceData['Mobile'];
                    }
                    else {
                        desktopDataObj = this.schData.$rdtDeviceData['Mobile'];
                    }
                }
                else {
                    if (this.groupData.rdtScriptType == 'Native App') {
                        desktopDataObj = this.schData.$rdtNativeAppDeviceData['Desktop'];
                    }
                    else {
                        desktopDataObj = this.schData.$rdtDeviceData['Desktop'];
                    }
                }
            //Desktop cases
            let osDevices = Object.keys(desktopDataObj);
            if (!this.rdtDeviceObj.browserType) {
                this.rdtDeviceObj.browserType = "Samsung Galaxy Note 4";
                firstCase = true;
            }
            for (let i = 0; i < osDevices.length; i++) {
                if (this.rdtDeviceObj.osType == osDevices[i]) {
                    let arryList = desktopDataObj[osDevices[i]];
                    for (let j = 0; j < arryList.length; j++) {
                        let browserName = arryList[j]['name'];
                        let browserVersion = arryList[j]['version'];
                        if (this.rdtDeviceObj.browserType == browserName) {
                            if (browserVersionList.indexOf(browserVersion) == -1)
                                browserVersionList.push(browserVersion);
                        }
                    }
                }
            }
            this.lstOptVersion = this.dataService.createSelectItem(browserVersionList);
            if (isEdit == undefined) {
                this.rdtDeviceObj.version = browserVersionList[0];
            }
            if (!this.rdtDeviceObj.version && firstCase) {
                this.rdtDeviceObj.version = browserVersionList[0];
                firstCase = false;
            }
            this.setRdtInUserProfile();
        }
        catch (e) {
            console.log(e);
        }
    }
    cloneGroup(group) {
        let groupObj = new _interface_sch_group_data__WEBPACK_IMPORTED_MODULE_9__["SchGroupData"]();
        for (let key in group) {
            groupObj[key] = group[key];
        }
        return groupObj;
    }
    setRdtInUserProfile() {
        try {
            let grpData = this.cloneGroup(this.groupData);
            if (this.Script === 'Cloud') {
                let osType = !(this.rdtDeviceObj.osType) ? '' : this.rdtDeviceObj.osType.replace(/ /g, "#");
                let browserType = !(this.rdtDeviceObj.browserType) ? '' : this.rdtDeviceObj.browserType.replace(/ /g, "#");
                let version = !(this.rdtDeviceObj.version) ? '' : this.rdtDeviceObj.version.replace(/ /g, "#");
                let type;
                let res;
                if (this.groupData.rdtScriptType == 'Mobile Web') {
                    type = 'MobileWeb';
                    res = this.schData.$rdtDeviceData;
                }
                else if (this.groupData.rdtScriptType == 'Native App') {
                    type = 'NativeApp';
                    res = this.schData.$rdtNativeAppDeviceData;
                }
                else {
                    type = this.groupData.rdtScriptType;
                    res = this.schData.$rdtDeviceData;
                }
                let network = this.rdtDeviceObj.networktype;
                this.profileCloud = 'C' + ':' + type.replace(" ", "") + ':' + osType + ':' + browserType + ':' + version + ':' + network;
                this.userDeviceDataCloud = osType + ',' + browserType.replace(/#/g, " ") + ',' + "true" + ',' + version + ','; //+ this.proxyPortForCloud; 
                grpData.userProfile = this.profileCloud;
                if (this.groupData)
                    this.groupData.userProfile = grpData.userProfile;
                this.setRDTDevieDataObj();
            }
        }
        catch (e) {
            console.log('setRdtInUserProfile | error = ', e);
        }
    }
    // add device to cloud table
    addDeviceCloudTable() {
        /*
          #browserName,device,realMobile,os_version,proxy_port,profiling
          Android, Samsung Galaxy S9, true,   8.0,                7991,           off
          type-    Device             skip        version             proxy port      skip
        */
        let temp = {
            os: !(this.rdtDeviceObj.osType) ? '' : this.rdtDeviceObj.osType,
            name: !(this.rdtDeviceObj.browserType) ? '' : this.rdtDeviceObj.browserType,
            real: true,
            version: !(this.rdtDeviceObj.version) ? '' : this.rdtDeviceObj.version,
            port: this.proxyPortForCloud,
            profilling: "off",
            network: this.rdtDeviceObj.networktype,
            index: this.cloudDeviceList.length + 1
        };
        let dataExist = false;
        for (let i = 0; i < this.cloudDeviceList.length; i++) {
            if (JSON.stringify(this.cloudDeviceList[i]) === JSON.stringify(temp))
                dataExist = true;
        }
        this.cloudDeviceList.push(temp);
        this.validateAndSetKeywordArray();
        this.selectedDevice = [...this.cloudDeviceList];
    }
    setRealMobile() {
        try {
            let desktopDataObj;
            if (this.groupData.rdtScriptType == 'Native App') {
                desktopDataObj = this.schData.$rdtNativeAppDeviceData['Mobile'];
            }
            else {
                desktopDataObj = this.schData.$rdtDeviceData['Mobile'];
            }
            if (desktopDataObj == null)
                return;
            //Desktop cases
            let osDevices = Object.keys(desktopDataObj);
            for (let i = 0; i < osDevices.length; i++) {
                if (this.rdtDeviceObj.osType == osDevices[i]) {
                    let arryList = desktopDataObj[osDevices[i]];
                    for (let j = 0; j < arryList.length; j++) {
                        let browserName = arryList[j]['name'];
                        let browserVersion = arryList[j]['version'];
                        if (this.rdtDeviceObj.browserType == browserName && this.rdtDeviceObj.version == browserVersion) {
                            this.rdtDeviceObj.real_mobile = arryList[j]['real_mobile'];
                        }
                    }
                }
            }
        }
        catch (e) {
            console.log('setRealMobile | error = ', e);
        }
    }
    getAndroidDeviceInfo() {
        if (this.ip == "" || this.port == "") {
            this.scenarioUtilsService.errorMessage('All fields are mandatory');
            return;
        }
        if (!this.validateIP(this.ip)) {
            this.scenarioUtilsService.errorMessage("Not a valid IP");
            return;
        }
        this.scenarioHttpService.addDeviceAdb(this.ip, this.port).subscribe((state) => {
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["addDeviceAdbLoadingState"]) {
                return;
            }
            if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["addDeviceAdbLoadedState"]) {
                let res = state.data;
                if (res['status'] == 'success') {
                    this.allllist.push(res);
                    this.dataService.successMessage(res['info']);
                }
                else {
                    if (res['status'] == 'erro')
                        this.allllist.push(res);
                    this.scenarioUtilsService.errorMessage(res['info']);
                }
                return;
            }
        }, (state) => {
            console.log(state.error);
        });
    }
    addDeviceDetail() {
        if (this.deviceId == "" || this.deviceVersion == "" || this.proxy == "" || this.hubUrl == "") {
            this.scenarioUtilsService.errorMessage('All fields are mandatory');
            return;
        }
        this.iosTabledata = _commons_immutable_array__WEBPACK_IMPORTED_MODULE_6__["ImmutableArray"].push(this.iosTabledata, { Device_id: this.deviceId, Device_Version: this.deviceVersion, proxyPort: this.proxy, hubUrl: this.hubUrl });
        this.resetdeviceDetails();
        this.selectedDevice = [...this.iosTabledata];
    }
    resetdeviceDetails() {
        this.deviceId = "";
        this.deviceVersion = "";
        this.proxy = "";
        this.hubUrl = "";
    }
    removeDeviceTable(index) {
        if (this.Script == 'Local') {
            for (let i = 0; i < this.iosTabledata.length; i++) {
                const element = this.iosTabledata[i];
                if (element.index == index)
                    this.iosTabledata.splice(i, 1);
            }
        }
        else {
            for (let i = 0; i < this.cloudDeviceList.length; i++) {
                const element = this.cloudDeviceList[i];
                if (element.index == index)
                    this.cloudDeviceList.splice(i, 1);
            }
        }
    }
    validateIP(event) {
        console.log("Ip event is : ", event);
        if (event.search(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) != -1) {
            var myArr = event.split(/\./);
            if (myArr[0] > 255 || myArr[1] > 255 || myArr[2] > 255 || myArr[3] > 255)
                return false;
            if (myArr[0] == 0 && myArr[1] == 0 && myArr[2] == 0 && myArr[3] == 0)
                return false;
            if (myArr[0] == 255 && myArr[1] == 255 && myArr[2] == 255 && myArr[3] == 255)
                return false;
            return true;
        }
        else {
            return false;
        }
    }
    validatePort(event) {
        if (event.charCode >= 48 && event.charCode <= 57) {
            return true;
        }
        return false;
    }
    validateIpAndPort(ip, port) {
        console.log("aaaaaaaaaa", ip);
        var pattern_ip = "^[0-9]*[.][0-9]*[.][0-9]*[.][0-9]";
        var pattern_port = "^[0-9]*";
        if (!ip.match(pattern_ip)) {
            this.scenarioUtilsService.errorMessage("please enter valid ip");
            return false;
        }
        if (!port.match(pattern_port)) {
            this.scenarioUtilsService.errorMessage("please enter valid port");
            return false;
        }
        return true;
    }
    setRDTDevieDataObj() {
        try {
            this.setRealMobile();
            //set Mobile Obj
            if (this.groupData)
                if (this.groupData.rdtURLType == '10') {
                    this.rdtMobileObj.realMobile = this.rdtDeviceObj.real_mobile;
                    this.rdtMobileObj.os_version = this.rdtDeviceObj.version;
                    this.rdtMobileObj.device = this.rdtDeviceObj.browserType;
                    this.rdtMobileObj.networktype = this.rdtDeviceObj.networktype;
                    if (this.rdtDeviceObj.osType == _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"]) {
                        if (this.rdtDeviceObj.browserType.startsWith('iPad')) {
                            this.rdtMobileObj.browserName = 'iPad';
                        }
                        else {
                            this.rdtMobileObj.browserName = 'iPhone';
                        }
                    }
                    else {
                        this.rdtMobileObj.browserName = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_ANDROID"];
                    }
                }
                else if (this.groupData && this.groupData.rdtURLType == '11') { //Desktop case
                    let osType = this.rdtDeviceObj.osType;
                    if (osType.startsWith('OS X')) {
                        let tmpArr = osType.split(' ');
                        this.rdtDesktopObj.os = 'OS X';
                        let versionArr = [];
                        this.arraycopy(tmpArr, 2, versionArr);
                        this.rdtDesktopObj.os_version = versionArr.toString();
                    }
                    else {
                        if (osType.startsWith('Ubuntu'))
                            this.rdtDesktopObj.os = 'Ubuntu';
                        else
                            this.rdtDesktopObj.os = 'Windows';
                        let tmpArr = osType.split(' ');
                        this.rdtDesktopObj.os_version = tmpArr[1];
                    }
                    this.rdtDesktopObj.browser_version = this.rdtDeviceObj.version;
                    this.rdtDesktopObj.browser = this.rdtDeviceObj.browserType;
                    this.rdtDesktopObj.networktype = this.rdtDeviceObj.networktype;
                }
        }
        catch (e) {
            console.log('setRDTDevieDataObj | error = ', e);
        }
    }
    arraycopy(src, srcPos, dest) {
        for (let i = srcPos; i < src.length; i++) {
            dest.push(src[i]);
        }
    }
    updateUiOnGroupChange() {
        let scenarioGrpWiseDevice = this.dataService.getGroupNameList(true);
        this.proxyPortForCloud = '';
        console.log("Grp wise device list : ", scenarioGrpWiseDevice);
        scenarioGrpWiseDevice.forEach(element => {
            if (element['grpName'] == this.selectedGrpInfo) {
                let profile = element['userProfile'].toString();
                if (profile.startsWith('C:')) {
                    this.Script = 'Cloud';
                    let deviceInfo = profile.split(':');
                    this.userDeviceDataCloud = deviceInfo[2].replace(/#/g, " ") + ',' + deviceInfo[3].replace(/#/g, " ") + ',' + "true" + ',' + deviceInfo[5] + ','; //+ this.proxyPortForCloud; 
                    console.log("Device list from profile ---- ", deviceInfo);
                    if (deviceInfo[1] == 'MobileWeb') {
                        this.groupData.rdtScriptType = "Mobile Web";
                        this.lstOptRdtUrl = this.createSelectItem(_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["RDT_URL_ARR"]);
                    }
                    else {
                        this.groupData.rdtScriptType = "Native App";
                        this.lstOptRdtUrl = [{ label: 'Mobile', value: '10' }];
                    }
                    this.groupData.rdtURLType = element['rdtURLType']; //Mobile Desktop
                    if (element['rdtURLType'] == '11')
                        this.tempDeviceList = this.schData.$rdtDeviceData['Desktop'];
                    if (this.tempDeviceList[deviceInfo[2].replace(/#/g, " ")] != undefined) {
                        let osDevices = Object.keys(this.tempDeviceList);
                        this.lstOptOS = this.dataService.createSelectItem(osDevices);
                        let deviceDetailList = this.tempDeviceList[deviceInfo[2].replace(/#/g, " ")];
                        let versionList = [];
                        let browserList = [];
                        this.lstOptVersion = [];
                        for (let index = 0; index < deviceDetailList.length; index++) {
                            if (browserList.indexOf(deviceDetailList[index]['name']) == -1)
                                browserList.push(deviceDetailList[index]['name']);
                            if (deviceDetailList[index]['name'] == deviceInfo[3].replace(/#/g, " "))
                                versionList.push(deviceDetailList[index]['version']);
                        }
                        this.lstOptBrowser = this.dataService.createSelectItem(browserList);
                        this.lstOptVersion = this.dataService.createSelectItem(versionList);
                        try {
                            this.proxyPortForCloud = deviceInfo[6];
                        }
                        catch (e) {
                            console.log("Unable to find proxy port in case of cloud -- ", e);
                        }
                    }
                    this.rdtDeviceObj.osType = deviceInfo[2].replace(/#/g, " "); //andro or ios
                    this.rdtDeviceObj.browserType = deviceInfo[3].replace(/#/g, " "); //devices name
                    this.rdtDeviceObj.version = deviceInfo[4]; //andro version
                    this.rdtDeviceObj.networktype = deviceInfo[5];
                }
            }
        });
    }
    createSelectItem(list) {
        let selectItemList;
        selectItemList = [];
        for (let index in list) {
            selectItemList.push({ label: index, value: list[index] });
        }
        return selectItemList;
    }
    copyKeywordFromDefault() {
        for (let i = 0; i < this.screenKeywordList.length; i++) {
            let grpArr = this.arrKeywordData[this.screenKeywordList[i]][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]];
            if (this.screenKeywordList[i] == "G_RBU")
                this.setRbuData(grpArr);
            else if (this.screenKeywordList[i] == "G_RBU_CAPTURE_PERFORMANCE_TRACE")
                this.setJSProfileData(grpArr);
        }
    }
    setRbuData(grpArr) {
        if (grpArr == undefined)
            grpArr = this.arrKeywordData["G_RBU"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]][0];
        else
            grpArr = grpArr[0];
        this.chkRBU = (grpArr[1] == undefined || grpArr[1] == "0" || grpArr[1] == null) ? false : true;
        this.chkSnapShot = (grpArr[2] == undefined || grpArr[2] == "1") ? true : false;
        this.lstBrowserType = (grpArr[5] == undefined) ? 1 : parseInt(grpArr[5]);
        this.chkLightHouse = (grpArr[6] == undefined || grpArr[6] != '1') ? false : true;
    }
    setJSProfileData(grpArr) {
        if (grpArr == undefined) {
            grpArr = this.arrKeywordData["G_RBU_CAPTURE_PERFORMANCE_TRACE"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]][0];
        }
        else
            grpArr = grpArr[0];
        this.G_RBU_CAPTURE_PERFORMANCE_TRACE.jsProfiler = grpArr[0] == 1 ? true : false;
        this.G_RBU_CAPTURE_PERFORMANCE_TRACE.timeout = grpArr[1] == "null" || grpArr[1] == undefined || grpArr[1] == "" ? 10 : (Number(grpArr[1]) / 1000) > 60 || (Number(grpArr[1]) / 1000) < 10 ? 10000 : Number(grpArr[1]) / 1000;
        this.G_RBU_CAPTURE_PERFORMANCE_TRACE.isMemory = grpArr[2] == 1 ? true : false;
        this.G_RBU_CAPTURE_PERFORMANCE_TRACE.isScreenshot = grpArr[3] == 1 ? true : false;
        this.G_RBU_CAPTURE_PERFORMANCE_TRACE.isCapTraceTillNetwork = grpArr[4] == 1 ? true : false;
    }
    validateAndSetKeywordArray() {
        if (this.validateAndSetEnableRbu() == false)
            return false;
        //All validation this.SUCCESS
        for (let i = 0; i < this.screenKeywordList.length; i++) {
            this.schData.saveKeywordData[this.screenKeywordList[i]] = this.arrKeywordData[this.screenKeywordList[i]].data;
        }
        return true;
    }
    sendDeviceDetailToFile() {
        var _a, _b;
        try {
            if (!this.updateProfileOnSGRP()) {
                return;
            }
            // If the current group is RDT_NATIVE in visual mode, attach devices to groupData instead of REST
            const targetGroup = (_a = this.schData.groupDataList) === null || _a === void 0 ? void 0 : _a.find(g => g.grpName === this.selectedGrpInfo);
            const isVisualMode = (targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.scriptMode) === 'visual';
            const isRdtNative = ((targetGroup === null || targetGroup === void 0 ? void 0 : targetGroup.grpType) === _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["GROUP_TYPE"].RDT_NATIVE) || (((_b = this.groupData) === null || _b === void 0 ? void 0 : _b.rdtScriptType) === 'Native App');
            if (isVisualMode && isRdtNative) {
                const rdtDevices = this.buildRdtNativeDevices();
                if (!rdtDevices || rdtDevices.length === 0) {
                    this.scenarioUtilsService.errorMessage("Please add at least 1 device");
                    return false;
                }
                if (targetGroup) {
                    // ensure type and attach device list to dynamic key
                    let rdtConfig = targetGroup[_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["GROUP_TYPE"].RDT_NATIVE];
                    if (rdtConfig && rdtConfig.length > 0) {
                        let appId = rdtConfig[0]['appId'];
                        if (appId != null && rdtDevices.length > 0) {
                            rdtDevices[0].appId = appId;
                        }
                    }
                    targetGroup[_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["GROUP_TYPE"].RDT_NATIVE] = rdtDevices;
                    // Auto-set primaryOS when the very first device is added to the group
                    if ((!rdtConfig || rdtConfig.length === 0) && rdtDevices.length > 0 && !targetGroup.primaryOS) {
                        const firstOs = (rdtDevices[0].os || '').toLowerCase();
                        targetGroup.primaryOS = firstOs === _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"].toLowerCase() ? _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"] : _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_ANDROID"];
                    }
                }
                this.dataService.successMessage("Changes saved successfully");
                this.selectedDevice = this.Script === 'Local' ? this.iosTabledata : this.cloudDeviceList;
                return true;
            }
            let projectSubScriptNameList = [];
            let deviceDataList = [];
            let arrGrpObj = this.dataService.getGroupNameList();
            let groupNameList = Object.keys(arrGrpObj);
            let jsProfOnOff = this.G_RBU_CAPTURE_PERFORMANCE_TRACE.jsProfiler ? "on" : "off";
            let allGroupData = this.dataService.getGroupData();
            let finalDataToBeSent;
            let localType;
            if (this.Script === 'Local' && this.chkRBU) {
                localType = this.operatingSystemTypeOptionValue == _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_ANDROID"] ? _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_ANDROID"] : _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"];
                console.log("Local type is -->", localType);
                if (this.selectedDevice == undefined || this.selectedDevice.length == 0) {
                    if (localType == _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"] && this.iosTabledata.length == 1) {
                        this.selectedDevice = this.iosTabledata;
                    }
                    else {
                        this.schData.loadingScen = false;
                        this.scenarioUtilsService.errorMessage("Please select at least 1 device");
                        return false;
                    }
                }
            }
            //for both
            if (groupNameList == undefined || groupNameList.length < 1) {
                this.scenarioUtilsService.errorMessage("No group is found!");
                return false;
            }
            // for both type
            if (!(this.selectedGrpInfo == '')) {
                if ((this.selectedGrpInfo == 'ALL')) {
                    //to do
                    let grplist = Object.keys(this.dataService.getGroupData());
                    for (let i = 0; i < groupNameList.length; i++) {
                        projectSubScriptNameList.push(allGroupData[grplist[i]]['scriptName']);
                    }
                }
                else {
                    projectSubScriptNameList.push(allGroupData[this.selectedGrpInfo]['scriptName']);
                }
                //for local 
                if (this.chkRBU)
                    if (this.Script === 'Local') {
                        for (let index = 0; index < this.selectedDevice.length; index++) {
                            let deviceData = this.selectedDevice[index];
                            if (localType == _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"]) {
                                if (!this.validateIos(deviceData))
                                    return false;
                            }
                            let prof = localType + "," + deviceData['Device_id'] + ',local,' + deviceData['Device_Version'] + "," + ",NA,NA," + deviceData['proxyPort'] + "," + jsProfOnOff + "" + "," + "NA";
                            deviceDataList.push(prof);
                        }
                    }
                    else {
                        if (this.selectedDevice == undefined || this.selectedDevice.length == 0) {
                            this.schData.loadingScen = false;
                            this.scenarioUtilsService.errorMessage("Please add at least 1 device");
                            return false;
                        }
                        let separator = ',';
                        for (let index = 0; index < this.selectedDevice.length; index++) {
                            const element = this.selectedDevice[index];
                            let prof = element.os + separator + element.name + separator + 'cloud' + separator + element.version + separator + "NA" + separator + "NA" + separator + (element.port != null && element.port != '' ? element.port : "NA") + separator + element.profilling + separator + (element.network == undefined ? "4G" : element.network);
                            deviceDataList.push(prof);
                        }
                    }
                let userLoginName = this.session.session.cctx.u;
                if (userLoginName == 'cavisson')
                    userLoginName = 'admin';
                let scriptPath = ["/workspace/" + userLoginName + "/" + this.activeWPService.profile + "/" + "cavisson/" + projectSubScriptNameList[0].split("/")[0] + "/" + projectSubScriptNameList[0].split("/")[1] + "/scripts/" + projectSubScriptNameList[0].split("/")[2]];
                finalDataToBeSent = { 'DeviceListDetail': deviceDataList, 'PathToScript': scriptPath };
            }
            this.scenarioHttpService.addDeviceDetailFile(finalDataToBeSent).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["timeout"])(20000)).subscribe((state) => {
                if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["addDeviceDetailFileLoadingState"]) {
                    return false;
                }
                if (state instanceof _interface_scenario_state__WEBPACK_IMPORTED_MODULE_8__["addDeviceDetailFileLoadedState"]) {
                    let res = state.data;
                    if (res['Status'] == "error")
                        this.scenarioUtilsService.errorMessage("Unable to save changes !");
                    else if (res['Status'] == 'success')
                        this.dataService.successMessage("Changes saved successfully");
                    else
                        this.scenarioUtilsService.errorMessage(res['Status']);
                    return false;
                }
            }, (state) => {
                console.log(state.error);
                return false;
            });
        }
        catch (error) {
            console.log("Exception occured at : ", error);
            this.scenarioUtilsService.errorMessage("Unable to save changes !");
        }
        this.selectedDevice = this.cloudDeviceList;
        return true;
    }
    buildRdtNativeDevices() {
        try {
            const devices = [];
            if (this.Script === 'Local') {
                // Currently support iOS local entries
                for (const d of (this.selectedDevice || [])) {
                    const devId = d.Device_id || d.deviceId || '';
                    const devVer = d.Device_Version || d.deviceVersion || '';
                    const proxy = Number(d.proxyPort || d.port || 0);
                    const hub = d.hubUrl || '';
                    const info = {
                        os: _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"],
                        os_version: devVer,
                        deviceName: devId,
                        network: '4G',
                        appId: hub,
                        env: _interface_scenario_model__WEBPACK_IMPORTED_MODULE_16__["RDTENV"].local,
                        browser: 'NA',
                        browser_version: 'NA',
                        proxyport: proxy,
                        profilingEnabled: 'off'
                    };
                    devices.push(info);
                }
            }
            else {
                // Cloud entries from cloudDeviceList shape
                for (const d of (this.selectedDevice || [])) {
                    const os = d.os || '';
                    const name = d.name || '';
                    const ver = d.version || '';
                    const net = d.network || '4G';
                    const port = Number(d.port || 0);
                    const profiling = d.profilling || 'off';
                    const info = {
                        os: os,
                        os_version: ver,
                        deviceName: name,
                        network: net,
                        appId: '',
                        env: _interface_scenario_model__WEBPACK_IMPORTED_MODULE_16__["RDTENV"].cloud,
                        browser: 'NA',
                        browser_version: 'NA',
                        proxyport: port,
                        profilingEnabled: profiling
                    };
                    devices.push(info);
                }
            }
            return devices;
        }
        catch (e) {
            console.log('buildRdtNativeDevices | error = ', e);
            return [];
        }
    }
    validateIos(deviceData) {
        if (deviceData.Device_id == "" || deviceData.Device_id == undefined || deviceData.Device_Version == "" || deviceData.Device_Version == undefined || deviceData.proxyPort == "" || deviceData.proxyPort == undefined || deviceData.hubUrl == "" || deviceData.hubUrl == undefined) {
            this.scenarioUtilsService.errorMessage("Please fill details first");
            return false;
        }
        let substr = ':';
        if (deviceData.hubUrl.indexOf(substr) !== -1) {
            let pieces = deviceData.hubUrl.split(':', 2);
            let ip = pieces[0];
            let port = pieces[1];
            if (ip == undefined || port == undefined || pieces.length > 2 || !this.validateIpAndPort(ip, port)) {
                this.schData.loadingScen = false;
                this.scenarioUtilsService.errorMessage("Invalid Hub Address");
                return false;
            }
            else
                return true;
        }
        else {
            this.schData.loadingScen = false;
            this.scenarioUtilsService.errorMessage("Invalid Hub Address");
            return false;
        }
    }
    validateAndSetEnableRbu() {
        let temObj = [];
        if (this.chkRBU) {
            temObj.push('ALL');
            temObj.push(1);
            if (this.chkSnapShot)
                temObj.push(1);
            else
                temObj.push(0);
            temObj.push(1);
            temObj.push(1);
            temObj.push(this.lstBrowserType);
            /** now validate other rbu keywords */
            if (this.validateSGRP() == false)
                return false;
            if (this.validateJSProfiler() == false)
                return false;
        }
        else {
            //clear keywords
            this.clearAllRbuKeywords();
        }
        this.setArrayWithKeyWordForScaler("G_RBU", temObj);
        return true;
    }
    validateSGRP() {
        return true;
    }
    clearAllRbuKeywords() {
        this.setArrayWithKeyWordForScaler("G_RBU_CAPTURE_PERFORMANCE_TRACE", []);
    }
    validateJSProfiler() {
        let temObj = [];
        if (this.G_RBU_CAPTURE_PERFORMANCE_TRACE.jsProfiler) {
            temObj.push(1);
        }
        this.setArrayWithKeyWordForScaler("G_RBU_CAPTURE_PERFORMANCE_TRACE", temObj);
        return true;
    }
    fillDeviceDetail(devices) {
        this.cloudDeviceList = [];
        this.iosTabledata = [];
        for (let index = 0; index < devices.length; index++) {
            const current = devices[index] || {};
            const hasRdtNativeShape = (current.os !== undefined && current.deviceName !== undefined && current.env !== undefined);
            let temp = {
                os: hasRdtNativeShape ? current.os : current['browserName'],
                name: hasRdtNativeShape ? current.deviceName : current['device'],
                real: hasRdtNativeShape ? current.env : current['realMobile'],
                version: current['os_version'],
                port: hasRdtNativeShape ? current['proxyport'] : current['proxy_port'],
                profilling: hasRdtNativeShape ? current['profilingEnabled'] : current['profiling'],
                network: current['network'],
                index: this.cloudDeviceList.length + 1
            };
            if (((temp.real || '') + '').toLowerCase() == 'cloud') {
                this.cloudDeviceList.push(temp);
            }
            else if (((temp.os || '') + '').toLowerCase() == _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_17__["PLATFORM_IOS"].toLowerCase() && ((temp.real || '') + '').toLowerCase() == 'local') {
                let strr = {
                    Device_id: hasRdtNativeShape ? current.deviceName : current.device,
                    Device_Version: current.os_version,
                    proxyPort: hasRdtNativeShape ? current.proxyport : current.proxy_port,
                    hubUrl: hasRdtNativeShape ? (current.appId || '') : current.hub_url,
                    index: this.iosTabledata.length + 1
                };
                this.iosTabledata.push(strr);
            }
        }
        // Keep all rendered rows selected by default so table reflects full group device config.
        this.selectedDevice = this.cloudDeviceList.length > 0 ? this.cloudDeviceList : this.iosTabledata;
    }
    setArrayWithKeyWordForScaler(keyword, temObj) {
        try {
            if (this.arrKeywordData == null)
                return;
            let dataObj = this.arrKeywordData[keyword][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA];
            if (dataObj != undefined)
                if (dataObj[this.selectedGrpInfo] != undefined) {
                    dataObj[this.selectedGrpInfo] = [];
                    dataObj[this.selectedGrpInfo].push(temObj);
                }
                else {
                    dataObj[this.selectedGrpInfo] = [temObj];
                }
        }
        catch (e) {
            console.log("excp = ", e);
        }
    }
    // This method is to replace the profile with the cloud profile
    updateProfileOnSGRP() {
        try {
            let isAllGrp = true;
            let arrGrpObj = this.dataService.getGroupNameList(true);
            if ((!(this.selectedGrpInfo == '')) && (!(this.selectedGrpInfo == undefined)) && (!(this.selectedGrpInfo == 'ALL'))) {
                for (let grpObj of arrGrpObj) {
                    if (grpObj['grpName'] == this.selectedGrpInfo) {
                        if ((!(this.profileCloud == undefined) && !(this.profileCloud === "")) && (this.Script == "Cloud")) {
                            grpObj['userProfile'] = this.profileCloud + ":" + this.proxyPortForCloud;
                            this.groupData.userProfile = this.profileCloud + ":" + this.proxyPortForCloud;
                        }
                        grpObj['rdtURLType'] = this.groupData.rdtURLType;
                    }
                }
            }
            else {
                this.scenarioUtilsService.errorMessage("Please select group first");
                isAllGrp = false;
            }
            return isAllGrp;
        }
        catch (error) {
            console.log("Exception occurred : ", error);
        }
        this.isFromSave = false;
    }
    ngOnDestroy() {
        if (this.grpAddDelSub)
            this.grpAddDelSub.unsubscribe();
        if (this.saveData)
            this.saveData.unsubscribe();
        this.dataService.resetGrpBasedTopMenuData();
    }
    clickButtonEvent(event) {
        var _a, _b;
        const me = this;
        this.selectedDevice = event.cavEventExt.rowData;
        if (((_b = (_a = event === null || event === void 0 ? void 0 : event.cavEventExt) === null || _a === void 0 ? void 0 : _a.actionConfig) === null || _b === void 0 ? void 0 : _b.action) == "delete") {
            me.removeDeviceTable(event.cavEventExt.row.index);
        }
    }
};
ScenarioRdtSettingsComponent.ctorParameters = () => [
    { type: _service_scen_keyword_definition_service__WEBPACK_IMPORTED_MODULE_10__["ScenKeywordDefinitionService"] },
    { type: _service_group_based_settings_data_service__WEBPACK_IMPORTED_MODULE_14__["GroupBasedSettingDataService"] },
    { type: primeng__WEBPACK_IMPORTED_MODULE_2__["ConfirmationService"] },
    { type: _service_scenario_utils_service__WEBPACK_IMPORTED_MODULE_12__["ScenarioUtilsService"] },
    { type: _service_scenario_http_service__WEBPACK_IMPORTED_MODULE_11__["ScenarioHttpService"] },
    { type: _service_sch_schedule_data_service__WEBPACK_IMPORTED_MODULE_13__["SchScheduleDataService"] },
    { type: src_app_core_session_session_service__WEBPACK_IMPORTED_MODULE_4__["SessionService"] },
    { type: src_app_shared_header_work_profile_services_work_profile_active_service__WEBPACK_IMPORTED_MODULE_5__["WorkProfileActiveService"] }
];
ScenarioRdtSettingsComponent = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({
        selector: 'app-scenario-rdt-settings',
        template: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"])(__webpack_require__(/*! raw-loader!./scenario-rdt-settings.component.html */ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.html")).default,
        encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None,
        styles: [Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"])(__webpack_require__(/*! ./scenario-rdt-settings.component.scss */ "./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.scss")).default]
    })
], ScenarioRdtSettingsComponent);



/***/ }),

/***/ "./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.module.ts":
/*!****************************************************************************************************************!*\
  !*** ./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.module.ts ***!
  \****************************************************************************************************************/
/*! exports provided: ScenarioRdtSettingsModule */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ScenarioRdtSettingsModule", function() { return ScenarioRdtSettingsModule; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js");
/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/__ivy_ngcc__/fesm2015/common.js");
/* harmony import */ var _scenario_rdt_settings_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./scenario-rdt-settings.component */ "./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt-settings.component.ts");
/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/__ivy_ngcc__/fesm2015/forms.js");
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/__ivy_ngcc__/fesm2015/router.js");
/* harmony import */ var primeng__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! primeng */ "./node_modules/primeng/__ivy_ngcc__/fesm2015/primeng.js");
/* harmony import */ var _interface_scenario_routing_guard__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../interface/scenario-routing-guard */ "./src/app/pages/scenario/interface/scenario-routing-guard.ts");
/* harmony import */ var primeng_toast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! primeng/toast */ "./node_modules/primeng/__ivy_ngcc__/fesm2015/primeng-toast.js");
/* harmony import */ var src_app_shared_cav_table_cav_table_module__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! src/app/shared/cav-table/cav-table.module */ "./src/app/shared/cav-table/cav-table.module.ts");










const route = [
    { path: '', component: _scenario_rdt_settings_component__WEBPACK_IMPORTED_MODULE_3__["ScenarioRdtSettingsComponent"], canDeactivate: [_interface_scenario_routing_guard__WEBPACK_IMPORTED_MODULE_7__["ScenRoutingGuard"]] }
];
let ScenarioRdtSettingsModule = class ScenarioRdtSettingsModule {
};
ScenarioRdtSettingsModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
        declarations: [_scenario_rdt_settings_component__WEBPACK_IMPORTED_MODULE_3__["ScenarioRdtSettingsComponent"]],
        imports: [
            _angular_common__WEBPACK_IMPORTED_MODULE_2__["CommonModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["FileUploadModule"],
            _angular_forms__WEBPACK_IMPORTED_MODULE_4__["FormsModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["DropdownModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["ButtonModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["SelectButtonModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["InputTextModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["TableModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["CardModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["CheckboxModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["MessageModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["RadioButtonModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["SpinnerModule"],
            primeng__WEBPACK_IMPORTED_MODULE_6__["TooltipModule"],
            primeng_toast__WEBPACK_IMPORTED_MODULE_8__["ToastModule"],
            src_app_shared_cav_table_cav_table_module__WEBPACK_IMPORTED_MODULE_9__["CavTableModule"],
            _angular_router__WEBPACK_IMPORTED_MODULE_5__["RouterModule"].forChild(route),
        ],
        exports: [_scenario_rdt_settings_component__WEBPACK_IMPORTED_MODULE_3__["ScenarioRdtSettingsComponent"]]
    })
], ScenarioRdtSettingsModule);



/***/ }),

/***/ "./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt.constants.ts":
/*!**********************************************************************************************************!*\
  !*** ./src/app/pages/scenario/group-based-settings-main/scenario-rdt-settings/scenario-rdt.constants.ts ***!
  \**********************************************************************************************************/
/*! exports provided: RdtData, RDTCheckPoint, RDTDeviceObj, RDTDesktopObj, RDTMobileObj */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RdtData", function() { return RdtData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RDTCheckPoint", function() { return RDTCheckPoint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RDTDeviceObj", function() { return RDTDeviceObj; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RDTDesktopObj", function() { return RDTDesktopObj; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RDTMobileObj", function() { return RDTMobileObj; });
class RdtData {
}
class RDTCheckPoint {
}
class RDTDeviceObj {
}
class RDTDesktopObj {
}
class RDTMobileObj {
}


/***/ }),

/***/ "./src/app/pages/scenario/interface/scenario.model.ts":
/*!************************************************************!*\
  !*** ./src/app/pages/scenario/interface/scenario.model.ts ***!
  \************************************************************/
/*! exports provided: RDTENV, SOURCE */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RDTENV", function() { return RDTENV; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SOURCE", function() { return SOURCE; });
var RDTENV;
(function (RDTENV) {
    RDTENV[RDTENV["cloud"] = 0] = "cloud";
    RDTENV[RDTENV["local"] = 1] = "local";
})(RDTENV || (RDTENV = {}));
var SOURCE;
(function (SOURCE) {
    SOURCE["tool"] = "tool";
    SOURCE["mongo"] = "mongo";
})(SOURCE || (SOURCE = {}));


/***/ })

}]);