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

/***/ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/scenario/group-based-settings-main/scenario-http-version/scenario-http-version.component.html":
/*!***********************************************************************************************************************************************************!*\
  !*** ./node_modules/raw-loader/dist/cjs.js!./src/app/pages/scenario/group-based-settings-main/scenario-http-version/scenario-http-version.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=\"my-32 p-grid p-align-center\">\n    <div class=\"p-col-2\">\n        Protocol Version\n    </div>\n    <div class=\"p-col-10\">\n        <p-selectButton class=\"radio-selectButton\" [options]=\"httpVersionOption\" [(ngModel)]=\"chkHttpMode\" [disabled]=\"enableDisKeywordList.G_HTTP_MODE\"></p-selectButton>\n    </div>\n</div>\n\n<div class=\"my-32 p-grid p-align-center\" *ngIf=\"chkHttpMode == '0'\">\n    <div class=\"p-col-2\">\n        Starting Version\n    </div>\n    <div class=\"p-col-10\">\n        <p-selectButton class=\"radio-selectButton\" [options]=\"autoStartVersionOption\" [(ngModel)]=\"autoStartVersionMode\" [disabled]=\"enableDisKeywordList.G_HTTP_MODE\"></p-selectButton>\n    </div>\n</div>");

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("");

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ScenarioHttpVersionComponent", function() { return ScenarioHttpVersionComponent; });
/* 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 _service_scen_keyword_definition_service__WEBPACK_IMPORTED_MODULE_2__ = __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_3__ = __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_4__ = __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_5__ = __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_6__ = __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 _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");









let ScenarioHttpVersionComponent = class ScenarioHttpVersionComponent {
    constructor(keywordDefinition, scenarioHttpService, dataService, schData, scenarioUtilsService) {
        this.keywordDefinition = keywordDefinition;
        this.scenarioHttpService = scenarioHttpService;
        this.dataService = dataService;
        this.schData = schData;
        this.scenarioUtilsService = scenarioUtilsService;
        this.enableDisKeywordList = {
            "G_HTTP_MODE": false
        };
        this.screenKeywordList = Object.keys(this.enableDisKeywordList);
        this.arrKeywordData = {}; //main obj of screen Keyword data.
        this.httpVersionOption = [];
        this.chkHttpMode = '1';
        this.selectedGrpInfo = "ALL";
        this.arrGrpList = [];
        this.isGroupEnabled = ''; //set none if want to disable in that case where there is no groups
        this.flag = false; //this flag is used to check, if the group name tab is present or not.
        this.autoStartVersionOption = [];
        this.autoStartVersionMode = '1';
        this.saveData = this.scenarioUtilsService.$saveGroupbasedSetting.subscribe((res) => {
            this.validateAndSaveData();
        });
        this.httpVersionOption = [
            { label: 'Auto', value: '0' },
            { label: 'HTTP/1.1', value: '1' },
            { label: 'HTTP/2', value: '2' },
            { label: 'HTTP/3', value: '3' }
        ];
        this.autoStartVersionOption = [
            { label: 'HTTP/2', value: '1' },
            { label: 'HTTP/3', value: '2' }
        ];
        /**
         * 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'] });
            }
        });
    }
    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.addGroupTab();
        this.arrKeywordData = this.keywordDefinition.chkAndGetKeywrdDataWithAdditionalKeys(this.screenKeywordList);
        if (this.keywordDefinition.isArrKeywordDataEmpty(this.arrKeywordData, this.screenKeywordList)) {
            this.keywordDefinition.setRequestKeywordListInBody(this.screenKeywordList, "ALL");
            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;
        });
    }
    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.dataService.upDateGroupMenuIcon();
    }
    fillDataInComp() {
        let keys = Object.keys(this.arrKeywordData);
        for (let i = 0; i < keys.length; i++) //keyword iteration
         {
            let keyword = keys[i];
            let keyObj = this.arrKeywordData[keyword];
            let dataObj = this.arrKeywordData[keyword][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA];
            this.enableDisKeywordList[keyword] = this.dataService.isCompEnable(this.dataService.getScenMode(), keyObj, keyword);
            if (dataObj == undefined) {
                continue;
            }
            let grpKeys = Object.keys(dataObj);
            //no group present
            if (grpKeys.length == 0)
                continue;
            if (keyword == 'G_HTTP_MODE') //screenKeywordList[0] means 'G_HTTP_MODE'
             {
                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
                     {
                        let grpArr = dataObj[_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]];
                        this.setHttpMode(grpArr);
                    }
                }
            }
        }
        this.dataService.upDateGroupMenuIcon();
    }
    setHttpMode(dataArr) {
        if (dataArr == undefined)
            dataArr = this.arrKeywordData["G_HTTP_MODE"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]][0];
        else
            dataArr = dataArr[0];
        this.chkHttpMode = (dataArr[0] == undefined) ? '1' : dataArr[0];
        if (this.chkHttpMode == '0') {
            this.autoStartVersionMode = (dataArr[1] == undefined) ? '1' : dataArr[1];
        }
    }
    /**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.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);
        }
    }
    validateAndSetKeywordArray() {
        /**vallidation  */
        //G_HTTP_MODE
        if (this.validateAndSetHttpModeKeywords() == false)
            return false;
        //All validation success
        for (let i = 0; i < this.screenKeywordList.length; i++) {
            this.schData.saveKeywordData[this.screenKeywordList[i]] = this.arrKeywordData[this.screenKeywordList[i]].data;
        }
        return true;
    }
    validateAndSetHttpModeKeywords() {
        let tempObj = [];
        tempObj.push(this.chkHttpMode);
        if (this.chkHttpMode == '0')
            tempObj.push(this.autoStartVersionMode);
        else
            tempObj.push("1");
        this.setArrayWithKeyWord("G_HTTP_MODE", tempObj);
        return true;
    }
    setArrayWithKeyWord(keyword, temObj) {
        let dataObj = this.arrKeywordData[keyword][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA];
        if (dataObj[this.selectedGrpInfo] != undefined) {
            dataObj[this.selectedGrpInfo] = [];
            dataObj[this.selectedGrpInfo].push(temObj);
        }
        else {
            dataObj[this.selectedGrpInfo] = [temObj];
        }
    }
    /**
   * 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;
        let modeDataArr = this.arrKeywordData["G_HTTP_MODE"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA][groupName];
        this.setHttpMode(modeDataArr);
        return true;
    }
    deleteSelectedGroup(groupName) {
        if (confirm("Clear HTTP 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.selectedGrpInfo == _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["DEFAULT_GROUP"]) {
                    if (this.validateAndSetKeywordArray() == false)
                        return false;
                }
                this.flag = false;
                this.copyKeywordFromDefault();
                let modeData = this.arrKeywordData["G_HTTP_MODE"][_constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_7__["KEYWORD_DATA_KEY"].DATA][groupName];
                if (modeData != undefined)
                    delete this.arrKeywordData["G_HTTP_MODE"][_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;
    }
    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_HTTP_MODE') {
                this.setHttpMode(grpArr);
            }
        }
    }
    validateAndSaveData() {
        if (this.validateAndSetKeywordArray()) {
            this.scenarioUtilsService.saveComponentData(0, {});
        }
    }
    ngOnDestroy() {
        if (this.grpAddDelSub)
            this.grpAddDelSub.unsubscribe();
        if (this.saveData)
            this.saveData.unsubscribe();
        this.dataService.resetGrpBasedTopMenuData();
    }
};
ScenarioHttpVersionComponent.ctorParameters = () => [
    { type: _service_scen_keyword_definition_service__WEBPACK_IMPORTED_MODULE_2__["ScenKeywordDefinitionService"] },
    { type: _service_scenario_http_service__WEBPACK_IMPORTED_MODULE_3__["ScenarioHttpService"] },
    { type: _service_group_based_settings_data_service__WEBPACK_IMPORTED_MODULE_6__["GroupBasedSettingDataService"] },
    { type: _service_sch_schedule_data_service__WEBPACK_IMPORTED_MODULE_5__["SchScheduleDataService"] },
    { type: _service_scenario_utils_service__WEBPACK_IMPORTED_MODULE_4__["ScenarioUtilsService"] }
];
ScenarioHttpVersionComponent = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({
        selector: 'app-scenario-http-version',
        template: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"])(__webpack_require__(/*! raw-loader!./scenario-http-version.component.html */ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/scenario/group-based-settings-main/scenario-http-version/scenario-http-version.component.html")).default,
        encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None,
        styles: [Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"])(__webpack_require__(/*! ./scenario-http-version.component.scss */ "./src/app/pages/scenario/group-based-settings-main/scenario-http-version/scenario-http-version.component.scss")).default]
    })
], ScenarioHttpVersionComponent);



/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ScenarioHttpVersionModule", function() { return ScenarioHttpVersionModule; });
/* 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_http_version_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./scenario-http-version.component */ "./src/app/pages/scenario/group-based-settings-main/scenario-http-version/scenario-http-version.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 src_app_shared_file_manager_file_manager_module__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! src/app/shared/file-manager/file-manager.module */ "./src/app/shared/file-manager/file-manager.module.ts");
/* harmony import */ var _interface_scenario_routing_guard__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../interface/scenario-routing-guard */ "./src/app/pages/scenario/interface/scenario-routing-guard.ts");
/* harmony import */ var primeng_toast__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! primeng/toast */ "./node_modules/primeng/__ivy_ngcc__/fesm2015/primeng-toast.js");










const route = [
    { path: '', component: _scenario_http_version_component__WEBPACK_IMPORTED_MODULE_3__["ScenarioHttpVersionComponent"], canDeactivate: [_interface_scenario_routing_guard__WEBPACK_IMPORTED_MODULE_8__["ScenRoutingGuard"]] }
];
let ScenarioHttpVersionModule = class ScenarioHttpVersionModule {
};
ScenarioHttpVersionModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
        declarations: [_scenario_http_version_component__WEBPACK_IMPORTED_MODULE_3__["ScenarioHttpVersionComponent"]],
        imports: [
            _angular_common__WEBPACK_IMPORTED_MODULE_2__["CommonModule"],
            _angular_common__WEBPACK_IMPORTED_MODULE_2__["CommonModule"],
            _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_9__["ToastModule"],
            _angular_router__WEBPACK_IMPORTED_MODULE_5__["RouterModule"].forChild(route),
            src_app_shared_file_manager_file_manager_module__WEBPACK_IMPORTED_MODULE_7__["FileManagerModule"]
        ],
        exports: [_scenario_http_version_component__WEBPACK_IMPORTED_MODULE_3__["ScenarioHttpVersionComponent"]]
    })
], ScenarioHttpVersionModule);



/***/ })

}]);