(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["default~create-scenario-create-scenario-module~scenario-design-scenario-design-module"],{

/***/ "./src/app/pages/home/script-manager/script-recorder/interface/recorder.interface.ts":
/*!*******************************************************************************************!*\
  !*** ./src/app/pages/home/script-manager/script-recorder/interface/recorder.interface.ts ***!
  \*******************************************************************************************/
/*! exports provided: RecorderBrowser, RecorderProtocol, GenerateAIOptions, RecordingMode */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecorderBrowser", function() { return RecorderBrowser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecorderProtocol", function() { return RecorderProtocol; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GenerateAIOptions", function() { return GenerateAIOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecordingMode", function() { return RecordingMode; });
var RecorderBrowser;
(function (RecorderBrowser) {
    RecorderBrowser["NS"] = "Netstorm Browser";
    RecorderBrowser["PROXY"] = "External Browser/Native Apps";
    RecorderBrowser["MOBILE_NATIVE"] = "RDT Native";
})(RecorderBrowser || (RecorderBrowser = {}));
var RecorderProtocol;
(function (RecorderProtocol) {
    RecorderProtocol["API"] = "WebC(HTTP/HTML)";
    RecorderProtocol["BROWSER"] = "WebClickAndScript";
    RecorderProtocol["MOBILE_NATIVE"] = "RealDeviceTesting(RDT)";
    RecorderProtocol["WEBSOCKET"] = "RealDeviceTesting(RDT)";
    RecorderProtocol["IBM_MQ"] = "RealDeviceTesting(RDT)";
    RecorderProtocol["TIBCO"] = "RealDeviceTesting(RDT)";
    RecorderProtocol["KAFKA"] = "RealDeviceTesting(RDT)";
    RecorderProtocol["SOCKETS"] = "RealDeviceTesting(RDT)";
    RecorderProtocol["LDAP"] = "RealDeviceTesting(RDT)";
    RecorderProtocol["IOT"] = "RealDeviceTesting(RDT)";
    RecorderProtocol["DNS"] = "DNS";
})(RecorderProtocol || (RecorderProtocol = {}));
var GenerateAIOptions;
(function (GenerateAIOptions) {
    GenerateAIOptions["AZURE_USER_STORIES"] = "AzureDevOpsUserStories";
    GenerateAIOptions["JIRA_USER_STORIES"] = "JiraUserStories";
    GenerateAIOptions["REQUIREMENTS_DOCUMENT"] = "RequirementsDocument";
    GenerateAIOptions["GHERKIN"] = "Gherkin";
    GenerateAIOptions["SPEC"] = "openspec";
})(GenerateAIOptions || (GenerateAIOptions = {}));
var RecordingMode;
(function (RecordingMode) {
    RecordingMode[RecordingMode["CODE"] = 1] = "CODE";
    RecordingMode[RecordingMode["NO_CODE"] = 2] = "NO_CODE";
})(RecordingMode || (RecordingMode = {}));


/***/ }),

/***/ "./src/app/pages/scenario/browser-step/browser-step.service.ts":
/*!*********************************************************************!*\
  !*** ./src/app/pages/scenario/browser-step/browser-step.service.ts ***!
  \*********************************************************************/
/*! exports provided: BrowserStepService */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserStepService", function() { return BrowserStepService; });
/* 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 _browser_step_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./browser-step.model */ "./src/app/pages/scenario/browser-step/browser-step.model.ts");
/* harmony import */ var _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants/scen-common-constants */ "./src/app/pages/scenario/constants/scen-common-constants.ts");
/* harmony import */ var _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants/scen-schedule-constants */ "./src/app/pages/scenario/constants/scen-schedule-constants.ts");





let BrowserStepService = class BrowserStepService {
    constructor() {
        this.groupTypeForScenario = '';
        this.selectedProtocolForScenario = '';
    }
    checkValidation(groupArray, selectedTabIndex, isFlowInline) {
        let isValid = { isValid: true, message: '' };
        let uniqueStepName = new Set();
        if (groupArray && groupArray.length > 0) {
            for (let i = 0; i < groupArray.length; i++) {
                let group = groupArray[i];
                if (group && group.flowArr && group.flowArr.length > 0) {
                    for (let j = 0; j < group.flowArr.length; j++) {
                        let flow = group.flowArr[j];
                        if (flow && flow.stepsArr && flow.stepsArr.length > 0) {
                            for (let k = 0; k < flow.stepsArr.length; k++) {
                                let browserSteps = flow.stepsArr[k];
                                if (!browserSteps)
                                    continue;
                                let result = this.validateStep(browserSteps, group.grpName, flow.flowName, isFlowInline, uniqueStepName, group.grpType);
                                if (!result.isValid) {
                                    return result;
                                }
                            }
                        }
                    }
                }
            }
        }
        return isValid;
    }
    isLocatorValid(locators, stepName, flowName, grpName, isFlowInline) {
        for (const key in locators) {
            const value = locators[key];
            if (key === 'coordinates') {
                if (!Array.isArray(value) ||
                    value.length !== 2 ||
                    typeof value[0] !== 'number' ||
                    typeof value[1] !== 'number') {
                    return { isValid: false, message: 'Invalid coordinates' }; // Valid coordinates found
                }
            }
            else if (!value) {
                return { isValid: false, message: (isFlowInline == "yes") ? `Locator '${key}' value cannot be empty for step '${stepName}' in flow '${flowName}' under group '${grpName}'.` : `Locator '${key}' value cannot be empty for step '${stepName}' in group '${grpName}'.` };
            }
        }
        return { isValid: true, message: '' };
    }
    getLabelFromValue(value) {
        let match;
        if (this.groupTypeForScenario === _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_4__["GROUP_TYPE"].BROWSER)
            match = _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionList"].find(item => item.value === value);
        else
            match = _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionListForRDT"].find(item => item.value === value);
        return match ? match.label : null;
    }
    getLatestStepName(groupArray, selectedTabIndex) {
        let totalInteraction = 0;
        let stepNameArr = [];
        let index = -1;
        for (let grpObj of groupArray) {
            index++;
            for (let flowObj of grpObj.flowArr) {
                for (let reqObj of flowObj.stepsArr) {
                    totalInteraction++;
                    stepNameArr.push(reqObj.stepName);
                }
            }
        }
        return this.getNewStepName(totalInteraction, stepNameArr);
    }
    getNewStepName(totalInteraction, stepNameArr) {
        if (stepNameArr.indexOf(`Step_${totalInteraction + 1}`) > -1)
            return this.getNewStepName(totalInteraction + 1, stepNameArr);
        else
            return `Step_${totalInteraction + 1}`;
    }
    validateStep(browserSteps, grpName, flowName, isFlowInline, uniqueStepName, grpType) {
        let isValid = { isValid: true, message: '' };
        if (!browserSteps.stepName) {
            isValid.isValid = false;
            isValid.message = (isFlowInline == "yes") ? `Step name cannot be empty for flow '${flowName}' in group '${grpName}'.` : `Step name cannot be empty for group '${grpName}' `;
            return isValid;
        }
        let pattern = /^[a-zA-Z][a-zA-Z0-9_]*$/;
        if (!pattern.test(browserSteps.stepName)) {
            isValid.isValid = false;
            isValid.message = (isFlowInline == "yes") ? `Please enter a valid step name '${browserSteps.stepName}' for flow '${flowName}' in group '${grpName}'. The name must start with a letter and can only contain letters, numbers, and underscores.` : `Please enter a valid step name '${browserSteps.stepName}' in group '${grpName}'. The name must start with a letter and can only contain letters, numbers, and underscores.`;
            return isValid;
        }
        if (browserSteps.stepName.length > 64) {
            isValid.isValid = false;
            isValid.message = (isFlowInline == "yes") ? `Step name '${browserSteps.stepName}' in flow '${flowName}' of group '${grpName}' cannot exceed 64 characters.` : `Step name '${browserSteps.stepName}' in group '${grpName}' cannot exceed 64 characters`;
            return isValid;
        }
        if (uniqueStepName.has(browserSteps.stepName)) {
            isValid.isValid = false;
            isValid.message = (isFlowInline == "yes") ? `Duplicate step name '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}' is not allowed.` : `Duplicate step name '${browserSteps.stepName}' of group '${grpName}' is not allowed.`;
            return isValid;
        }
        else {
            uniqueStepName.add(browserSteps.stepName);
        }
        if (browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].GO) {
            if (!browserSteps.url) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `URL cannot be empty for step name '${browserSteps.stepName}' in flow '${flowName}' of group '${grpName}'. For example: https://www.cavisson.com` : `URL cannot be empty for step name '${browserSteps.stepName}' in group '${grpName}'. For example: https://www.cavisson.com`;
                return isValid;
            }
            var protocol = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_3__["URL_REGEX"].PROTOCOL_URL;
            var numericUrl = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_3__["URL_REGEX"].NUMERIC_URL;
            var stringUrl = _constants_scen_common_constants__WEBPACK_IMPORTED_MODULE_3__["URL_REGEX"].STRING_URL;
            var isValidUrl = protocol.test(browserSteps.url) ? (stringUrl.test(browserSteps.url) ? true : (numericUrl.test(browserSteps.url) ? true : false)) : false;
            //This is special check to validate when whole url is parametrize. For ex: {url}/v2/index.html or {url}
            if (/^{[\w\W]+}(([\w\-\._~:\/?#[\]@!\$&'\(\)\*\+,;=.%"^|]+)|({[\w]+}))*$/.test(browserSteps.url))
                isValidUrl = true;
            if (!isValidUrl) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Enter a valid URL for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'. For example: https://www.cavisson.com` : `Enter a valid URL for step '${browserSteps.stepName}' in group '${grpName}'. For example: https://www.cavisson.com`;
                return isValid;
            }
        }
        else if (browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].SELECT || browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].SCROLL || browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].DOUBLE_CLICK || browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].HOVER || browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].SEND_KEYS || browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].SELECT_RADIO || browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].CHECK || browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].MULTI_SELECT || browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].INPUT_FILES) {
            if (grpType == _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_4__["GROUP_TYPE"].BROWSER && !browserSteps.tagName) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Tag name cannot be empty for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'.` : `Tag name cannot be empty for step '${browserSteps.stepName}' in group '${grpName}'.`;
                return isValid;
            }
            let pattern = /^[a-zA-Z][a-zA-Z0-9_]*$/;
            if (grpType == _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_4__["GROUP_TYPE"].BROWSER && !pattern.test(browserSteps.tagName)) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Please enter a valid tag name '${browserSteps.tagName}' for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'. It must start with an alphabet and can contain only alphanumeric characters and underscores.` : `Please enter a valid tag name '${browserSteps.tagName}' for step '${browserSteps.stepName}' in group '${grpName}'. It must start with an alphabet and can contain only alphanumeric characters and underscores.`;
                return isValid;
            }
            if (grpType == _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_4__["GROUP_TYPE"].BROWSER && browserSteps.tagName.length > 64) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Tag name '${browserSteps.tagName}' for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}' cannot exceed 64 characters.` : `Tag name '${browserSteps.tagName}' for step '${browserSteps.stepName}' in group '${grpName}' cannot exceed 64 characters.`;
                return isValid;
            }
            if (browserSteps.waitElementTimeout < 0) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Wait Element Timeout for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}' must be greater than or equal to 0.` : `Wait Element Timeout for step '${browserSteps.stepName}' in group '${grpName}' must be greater than or equal to 0.`;
                return isValid;
            }
            if (!browserSteps.locators) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Element locators cannot be empty for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'.` : `Element locators cannot be empty for step '${browserSteps.stepName}' in group '${grpName}'.`;
                return isValid;
            }
            if (browserSteps.locators) {
                let isLocatorValid = this.isLocatorValid(browserSteps.locators, browserSteps.stepName, flowName, grpName, isFlowInline);
                if (!isLocatorValid.isValid) {
                    return isLocatorValid;
                }
            }
            if (browserSteps.heroElement) {
                let isLocatorValid = this.isLocatorValid(browserSteps.heroElement, browserSteps.stepName, flowName, grpName, isFlowInline);
                if (!isLocatorValid.isValid) {
                    return isLocatorValid;
                }
            }
            if (browserSteps.iFrameLocator && Array.isArray(browserSteps.iFrameLocator)) {
                for (let iframeLocators of browserSteps.iFrameLocator) {
                    let isLocatorValid = this.isLocatorValid(iframeLocators, browserSteps.stepName, flowName, grpName, isFlowInline);
                    if (!isLocatorValid.isValid) {
                        return isLocatorValid;
                    }
                }
            }
        }
        else if (browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].INPUT) {
            let pattern = /^[a-zA-Z][a-zA-Z0-9_]*$/;
            if (!browserSteps.value) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Value cannot be empty for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'.` : `Value cannot be empty for step '${browserSteps.stepName}' in group '${grpName}'.`;
                return isValid;
            }
            /*if (!pattern.test(browserSteps.value)) {
              isValid.isValid = false;
              isValid.message = (isFlowInline == "yes") ? `Please enter a valid value '${browserSteps.value}' for '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'. It must start with an alphabet and may contain only alphabets, numbers, and underscores.` : `Please enter a valid value '${browserSteps.value}' for step '${browserSteps.stepName}' in group '${grpName}'. It must start with a letter and contain only letters, numbers, and underscores.`;
              return isValid;
            }*/
            if (browserSteps.value.length > 64) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Value '${browserSteps.value}' of step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}' cannot exceed 64 characters.` : `Value '${browserSteps.value}' of step '${browserSteps.stepName}' in group '${grpName}' cannot exceed 64 characters.`;
                return isValid;
            }
            if (grpType == _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_4__["GROUP_TYPE"].BROWSER && !browserSteps.tagName) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Tag name cannot be empty for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'.` : `Tag name cannot be empty for step '${browserSteps.stepName}' in group '${grpName}'.`;
                return isValid;
            }
            if (grpType == _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_4__["GROUP_TYPE"].BROWSER && !pattern.test(browserSteps.tagName)) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Please enter a valid tag name '${browserSteps.tagName}' for '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'. It must start with an alphabet and may contain only alphabets, numbers, and underscores.` : `Please enter a valid tag name '${browserSteps.tagName}' for step '${browserSteps.stepName}' in group '${grpName}'. It must start with a letter and contain only letters, numbers, and underscores.`;
                return isValid;
            }
            if (grpType == _constants_scen_schedule_constants__WEBPACK_IMPORTED_MODULE_4__["GROUP_TYPE"].BROWSER && browserSteps.tagName.length > 64) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Tag name '${browserSteps.tagName}' of step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}' cannot exceed 64 characters.` : `Tag name '${browserSteps.tagName}' of step '${browserSteps.stepName}' in group '${grpName}' cannot exceed 64 characters.`;
                return isValid;
            }
            if (browserSteps.waitElementTimeout < 0) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Wait Element Timeout for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}' must be greater than or equal to 0.` : `Wait Element Timeout for step '${browserSteps.stepName}' in group '${grpName}' must be greater than or equal to 0.`;
                return isValid;
            }
            if (!browserSteps.locators) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Element locators cannot be empty for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}'.` : `Element locators cannot be empty for step '${browserSteps.stepName}' in group '${grpName}'.`;
                return isValid;
            }
            if (browserSteps.locators) {
                let isLocatorValid = this.isLocatorValid(browserSteps.locators, browserSteps.stepName, flowName, grpName, isFlowInline);
                if (!isLocatorValid.isValid) {
                    return isLocatorValid;
                }
            }
            if (browserSteps.heroElement) {
                let isLocatorValid = this.isLocatorValid(browserSteps.heroElement, browserSteps.stepName, flowName, grpName, isFlowInline);
                if (!isLocatorValid.isValid) {
                    return isLocatorValid;
                }
            }
            if (browserSteps.iFrameLocator && Array.isArray(browserSteps.iFrameLocator)) {
                for (let iframeLocators of browserSteps.iFrameLocator) {
                    let isLocatorValid = this.isLocatorValid(iframeLocators, browserSteps.stepName, flowName, grpName, isFlowInline);
                    if (!isLocatorValid.isValid) {
                        return isLocatorValid;
                    }
                }
            }
        }
        else if (browserSteps.type == _browser_step_model__WEBPACK_IMPORTED_MODULE_2__["InteractionType"].SWITCH_TAB) {
            if (browserSteps.tabIndex < 0) {
                isValid.isValid = false;
                isValid.message = (isFlowInline == "yes") ? `Tab Index for step '${browserSteps.stepName}' in flow '${flowName}' under group '${grpName}' must be greater than or equal to 0.` : `Tab Index for step '${browserSteps.stepName}' in group '${grpName}' must be greater than or equal to 0.`;
                return isValid;
            }
        }
        return isValid;
    }
};
BrowserStepService = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])({
        providedIn: 'root'
    })
], BrowserStepService);



/***/ })

}]);