function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }

function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }

function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }

function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }

function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }

(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["file-parameter-file-parameter-module"], {
  /***/
  "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/home/script-manager/parameter/components/add-parameter/file-parameter/file-parameter.component.html":
  /*!*****************************************************************************************************************************************************************!*\
    !*** ./node_modules/raw-loader/dist/cjs.js!./src/app/pages/home/script-manager/parameter/components/add-parameter/file-parameter/file-parameter.component.html ***!
    \*****************************************************************************************************************************************************************/

  /*! exports provided: default */

  /***/
  function _node_modules_rawLoader_dist_cjsJs_src_app_pages_home_scriptManager_parameter_components_addParameter_fileParameter_fileParameterComponentHtml(module, __webpack_exports__, __webpack_require__) {
    "use strict";

    __webpack_require__.r(__webpack_exports__);
    /* harmony default export */


    __webpack_exports__["default"] = "    <app-param-name></app-param-name>\n\n    <ng-container >\n        <app-select-datadir></app-select-datadir>\n    </ng-container>\n    <div class=\"p-grid p-align-center\">\n        <div class=\"p-col-3\">Data File</div>\n        <div class=\"p-col-7\">\n            <!-- <div class=\"type-search\">\n                <i class=\"right-icon icons8 icons8-opened-folder btn-icon\"></i>\n                <input type=\"text\" pInputText class=\"pl-6 pr-20 w-100-p\">\n            </div> -->\n            <p-dropdown [options]=\"parameterService.arrayOfFiles\" [filter]=\"true\" filterBy=\"label\" [editable]=\"true\" placeholder=\"Enter new data file name or select file\" emptyFilterMessage=\"No files available\" [(ngModel)]=\"parameterService.objForFileParameter.fileName\" (onChange)=\"onChangeFile($event)\"\n                [style]=\"{'min-width':'100%'}\" dropdownIcon=\"icons8 icons8-expand-arrow\">\n            </p-dropdown>\n        </div>\n        <div class=\"p-col-fixed width-50\">\n            <div class=\"type-search\">\n                <i class=\"left-icon las-cloud-upload-alt-solid font-22 btn-icon\"></i>\n                <input type=\"file\" pInputText class=\"pl-20 pr-20 w-100-p custom-file-input\" #myInput (change)=\"onChangeFileInput($event.target.files)\" pTooltip=\"Browse file\" tooltipZIndex=\"12000\">\n                <i class=\"icons8 icons8-spinner spin loadingIcon\" *ngIf=\"fileReadService.loadingOnUpload\"></i>\n            </div>\n            <!-- <p-fileUpload mode=\"basic\" class=\"upload-icon\" chooseIcon=\"las-cloud-upload-alt-solid\" name=\"demo[]\" url=\"./upload.php\" accept=\"image/*\" maxFileSize=\"1000000\" (onUpload)=\"onBasicUpload($event)\"></p-fileUpload> -->\n        </div>\n        <p-message *ngIf=\"utilService.isValidFileName\" severity=\"error\" text={{utilService.textForInvalid}}></p-message>\n\n    </div>\n\n    <div class=\"p-grid p-align-center\">\n        <div class=\"p-col-3\">Column Delimiter</div>\n        <div class=\"p-col-2\">\n            <p-dropdown [options]=\"column\" [(ngModel)]=\"parameterService.objForFileParameter.columnDelimiter\" [editable] =\"true\" [maxlength]=\"1\" [style]=\"{'min-width':'100%'}\"\n                dropdownIcon=\"icons8 icons8-expand-arrow\">\n            </p-dropdown>\n        </div>\n        <div class=\"p-col-3 text-right\">First Data Row</div>\n        <div class=\"p-col-2\">\n            <p-spinner inputStyleClass=\"w-100-p\" [(ngModel)]=\"parameterService.objForFileParameter.firstDataLine\" [min]=\"1\"></p-spinner>\n        </div>\n    </div>\n\n    <div class=\"m-10\">\n        <div class=\"type-search\">\n    \n            <i class=\"icons8 icons8-spinner spin loadingIcon\" *ngIf=\"loading\"></i>\n            <!-- <textarea pInputTextarea rows=\"7\" [(ngModel)]=\"parameterService.textArea\" \n                *ngIf=\"!showTableFormat && !fileReadService.readOnly\" class=\"w-100-p\" placeholder=\"Enter content of file.\">\n            </textarea>\n            <textarea pInputTextarea rows=\"7\" [(ngModel)]=\"parameterService.textArea\" readonly\n                *ngIf=\"!showTableFormat && fileReadService.readOnly \" class=\"w-100-p\">\n            </textarea> -->\n            <div class=\"p-col-12 mt-20 border-3\" style=\"border-style:solid;border-width:1px\"  *ngIf=\"!showTableFormat\">\n                <ngx-monaco-editor class=\"rowText\" class=\"editor-container\" #bodyEditor\n                    (onInit)=\"onInitEditor($event)\" \n                    [options]=\"bodyEditorOptions\"\n                    [(ngModel)]=\"parameterService.textArea\">\n                </ngx-monaco-editor>\n            </div>\n        </div>\n        <div class=\"m-5 text-right\">\n            <button type=\"button\" [disabled]=\"parameterService.disableViewFile\" pButton label=\"View File\" (click)=\"viewFileData()\"></button>\n            \n        </div>\n    \n        <div *ngIf=\"showTableFormat\" class=\"p-col-12\">\n            <cav-table [value]=\"twoDimArray\" [headers]=\"headers\" [scrollable]=\"true\" scrollHeight=\"200px\" [tableConfig]=\"tableConfig\"></cav-table>\n        </div>\n    \n        <button type=\"button\" pButton class=\"btn-icon\"  *ngIf=\"!showTableFormat\" label=\"Show Tabular Form\" (click)=\"toggleTable()\"></button>\n        <button type=\"button\" pButton class=\"btn-icon\"  *ngIf=\"showTableFormat\" label=\"Don't Show Tabular Form\" (click)=\"this.showTableFormat = !this.showTableFormat\"></button>\n\n    </div>\n\n\n    <p-accordion>\n        <p-accordionTab header=\"Advanced\" [selected]=\"false\">\n            <app-advance-file-param></app-advance-file-param>\n            <div class=\"p-grid pb-60 p-align-center p-5\">\n                <p-checkbox [(ngModel)]=\"parameterService.objForFileParameter.ignoreInvalidData\" binary=\"true\" label=\"Ignore invalid data lines\" class=\"mr-20\">\n                </p-checkbox>\n                <p-checkbox *ngIf=\"parameterService.copyTestRun\" [(ngModel)]=\"parameterService.objForFileParameter.copyToTestRun\" binary=\"true\" label=\"Copy to Testrun\"></p-checkbox>\n\n            </div>\n        </p-accordionTab>\n    </p-accordion>\n";
    /***/
  },

  /***/
  "./src/app/pages/home/script-manager/parameter/components/add-parameter/file-parameter/file-parameter.component.ts":
  /*!*************************************************************************************************************************!*\
    !*** ./src/app/pages/home/script-manager/parameter/components/add-parameter/file-parameter/file-parameter.component.ts ***!
    \*************************************************************************************************************************/

  /*! exports provided: FileParameterComponent */

  /***/
  function _src_app_pages_home_scriptManager_parameter_components_addParameter_fileParameter_fileParameterComponentTs(module, __webpack_exports__, __webpack_require__) {
    "use strict";

    __webpack_require__.r(__webpack_exports__);
    /* harmony export (binding) */


    __webpack_require__.d(__webpack_exports__, "FileParameterComponent", function () {
      return FileParameterComponent;
    });
    /* 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 src_app_core_session_session_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
    /*! src/app/core/session/session.service */
    "./src/app/core/session/session.service.ts");
    /* harmony import */


    var src_app_pages_scenario_service_scenario_utils_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
    /*! src/app/pages/scenario/service/scenario-utils.service */
    "./src/app/pages/scenario/service/scenario-utils.service.ts");
    /* harmony import */


    var src_app_shared_common_services_file_read_client_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
    /*! src/app/shared/common-services/file-read-client.service */
    "./src/app/shared/common-services/file-read-client.service.ts");
    /* harmony import */


    var src_app_shared_header_work_profile_services_work_profile_active_service__WEBPACK_IMPORTED_MODULE_6__ = __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 _script_edit_home_script_topmenu_script_tab_script_tab_data_service__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(
    /*! ../../../../script-edit-home/script-topmenu/script-tab/script-tab-data.service */
    "./src/app/pages/home/script-manager/script-edit-home/script-topmenu/script-tab/script-tab-data.service.ts");
    /* harmony import */


    var _services_script_msg_service__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(
    /*! ../../../../services/script-msg.service */
    "./src/app/pages/home/script-manager/services/script-msg.service.ts");
    /* harmony import */


    var _services_script_rest_service__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(
    /*! ../../../../services/script-rest.service */
    "./src/app/pages/home/script-manager/services/script-rest.service.ts");
    /* harmony import */


    var _services_script_state__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(
    /*! ../../../../services/script.state */
    "./src/app/pages/home/script-manager/services/script.state.ts");
    /* harmony import */


    var _sm_tree_sm_tree_service__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(
    /*! ../../../../sm-tree/sm-tree.service */
    "./src/app/pages/home/script-manager/sm-tree/sm-tree.service.ts");
    /* harmony import */


    var _parameter_data_service__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(
    /*! ../parameter-data.service */
    "./src/app/pages/home/script-manager/parameter/components/add-parameter/parameter-data.service.ts");
    /* harmony import */


    var _parameter_utils_service__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(
    /*! ../parameter-utils.service */
    "./src/app/pages/home/script-manager/parameter/components/add-parameter/parameter-utils.service.ts");

    var FileParameterComponent = /*#__PURE__*/function () {
      function FileParameterComponent(utilService, tabService, parameterService, session, workprofile, restService, scriptMsgService, smTreeService, scenUtilService, fileReadService, confirmationService) {
        _classCallCheck(this, FileParameterComponent);

        this.utilService = utilService;
        this.tabService = tabService;
        this.parameterService = parameterService;
        this.session = session;
        this.workprofile = workprofile;
        this.restService = restService;
        this.scriptMsgService = scriptMsgService;
        this.smTreeService = smTreeService;
        this.scenUtilService = scenUtilService;
        this.fileReadService = fileReadService;
        this.confirmationService = confirmationService;
        this.selectedType = '20';
        this.val = '';
        this.invalidData = false;
        this.copyTest = false;
        this.scriptParameter = 'newVal1';
        this.fileNames = [];
        this.showTextEditor = false;
        this.styleChangeValue = false;
        this.typeDropdownValue = 'value';
        this.showTableFormat = false;
        this.numOfColsInIndexTable = [];
        this.headerCols = [];
        this.subscriptionArr = [];
        this.limit = 10240; //10MB into KB

        this.loading = false;
        this.readOnly = false;
        this.bodyEditorOptions = {
          theme: 'Light',
          language: "text",
          renderIndentGuides: false,
          renderLineHighlight: 'none',
          glyphMargin: false,
          lineNumbersMinChars: 0,
          minimap: {
            enabled: false
          },
          fontFamily: 'inherit',
          wordWrap: 'wordWrapColumn',
          wordWrapColumn: 140,
          scrollbar: {
            verticalScrollbarSize: 0
          },
          readOnly: false,
          renderValidationDecorations: 'off'
        };
        this.column = [{
          label: ',',
          value: ','
        }, {
          label: ';',
          value: ';'
        }, {
          label: ':',
          value: ':'
        }, {
          label: '|',
          value: '|'
        }, {
          label: '#',
          value: '#'
        }, {
          label: '$',
          value: '$'
        }, {
          label: '/',
          value: '/'
        }, {
          label: '_',
          value: '_'
        }];
        this.tableConfig = {
          "config": {
            "toggleFilter": true,
            "download": true
          }
        };
        this.typeDropdown = [{
          label: 'Value',
          value: 'value'
        }, {
          label: 'File',
          value: 'file'
        }, {
          label: 'File_Param',
          value: 'file_param'
        }];
      }

      return _createClass(FileParameterComponent, [{
        key: "ngOnInit",
        value: function ngOnInit() {
          var _this = this;

          var themeName = 'Light';
          if (sessionStorage.getItem('theme')) themeName = sessionStorage.getItem('theme');
          this.bodyEditorOptions = Object.assign(Object.assign({}, this.bodyEditorOptions), {
            theme: themeName
          }); // Or 

          Object.assign({}, this.bodyEditorOptions, {
            theme: themeName
          });
          this.profile = this.workprofile.profile;
          this.workspaceName = this.session.session.cctx.u;

          if (this.workspaceName == 'cavisson') {
            this.workspaceName = 'admin';
          }

          this.subscriptionArr.push(this.parameterService.resetFile.subscribe(function () {
            _this.myInputVariable.nativeElement.value = "";

            _this.bodyEditor._editor.updateOptions({
              readOnly: false
            });
          }));
          this.subscriptionArr.push(this.fileReadService.readFileForMaxLimitSub.subscribe(function (data) {
            if (data.isUploadingInProg) _this.fileReadService.loadingOnUpload = true;else if (data.isReadingInProg) _this.fileReadService.loadingOnUpload = true;else _this.fileReadService.loadingOnUpload = false;

            if (!data.isReadingInProg) {
              if (data.maxLimitReached) _this.bodyEditor._editor.updateOptions({
                readOnly: true
              });else _this.bodyEditor._editor.updateOptions({
                readOnly: false
              });
              _this.parameterService.textArea = data.data;
            }
          })); // this.parameterService.objForFileParameter['copyToTestRun'] =this.copyTest
          // this.parameterService.objForFileParameter['ignoreInvalidData'] = this.invalidData  

          if (this.parameterService.mode == 'UpdateParam' && this.scenUtilService.openFrom == 'script') this.viewFileData();
        }
      }, {
        key: "onChangeFile",
        value: function onChangeFile(event) {
          var _a;

          if (!this.utilService.validateFileName(event.value)) return;
          this.parameterService.objForFileParameter['fileName'] = event.value;

          for (var i = 0; i < this.parameterService.arrayOfFiles.length; i++) {
            if (this.parameterService.arrayOfFiles[i].value.includes(event.value)) {
              this.parameterService.disableViewFile = false;
              break;
            } else this.parameterService.disableViewFile = true;
          }

          if (event.originalEvent.type == "click") {
            this.parameterService.textArea = "";

            this.bodyEditor._editor.updateOptions({
              readOnly: false
            });
          }

          if (this.scenUtilService.openFrom == 'script') {
            var fileUploadPath;
            var scriptPath = (_a = this.tabService.activeTabDataInfo['filePath']) === null || _a === void 0 ? void 0 : _a.replace(/(\/runlogic\/)|(\/)$/gi, "");
            var fileName = this.parameterService.objForFileParameter['fileName'];

            if (fileName.includes("/") && this.parameterService.commonObj['dataDir'] == "") {
              var dir = fileName.substring(0, fileName.lastIndexOf('/'));
              fileName = fileName.substring(fileName.lastIndexOf('/') + 1);
              fileUploadPath = "".concat(scriptPath, "/").concat(dir);
            } else if (this.parameterService.commonObj['dataDir'] == "") fileUploadPath = "".concat(scriptPath);else if (fileName.includes("/") && this.parameterService.commonObj['dataDir']) {
              var _dir = fileName.substring(0, fileName.lastIndexOf('/'));

              fileName = fileName.substring(fileName.lastIndexOf('/') + 1);
              fileUploadPath = this.parameterService.commonObj['dataDir'] + "/" + _dir;
            } else fileUploadPath = "".concat(this.parameterService.commonObj['dataDir']);

            var node,
                isAlreadyExist = false;

            try {
              if (this.parameterService.commonObj['dataDir'] == "") {
                node = this.smTreeService.findNodeInTree(fileUploadPath, 0);
              } else node = this.smTreeService.findNodeInTree(fileUploadPath, 1);

              for (var matchIndex = 0; matchIndex < node.children.length; matchIndex++) {
                if (!fileName.includes('.')) fileName = fileName + ".dat";

                if (fileName == node.children[matchIndex]['label']) {
                  isAlreadyExist = true;
                  break;
                } else isAlreadyExist = false;
              }
            } catch (e) {}

            if (isAlreadyExist) {
              this.parameterService.disableViewFile = false;
              this.parameterService.fileAlreadyExist = true;
            } else {
              this.parameterService.disableViewFile = true;
              this.parameterService.fileAlreadyExist = false;
            }
          }

          this.fileReadService.readOnly = false;
          this.myInputVariable.nativeElement.value = "";
        }
      }, {
        key: "showMessage",
        value: function showMessage(severe, title, details) {
          this.scriptMsgService.emitMsgObj({
            key: "script",
            severity: severe,
            summary: title,
            detail: details
          });
        }
      }, {
        key: "onInitEditor",
        value: function onInitEditor(e) {}
      }, {
        key: "onChangeFileInput",
        value: function onChangeFileInput(file) {
          var _a;

          var fileToRead = file[0];
          var iFileSize = fileToRead.size;

          if (!this.utilService.validExtensionOfFile(file[0].name)) {
            this.showMessage("error", "", "Supported file extension are txt, csv, dat, text, seq, ran, log, body.");
            return false;
          }

          this.parameterService.objForFileParameter['fileName'] = file[0].name;
          var fileUploadPath;
          var scriptPath = (_a = this.tabService.activeTabDataInfo['filePath']) === null || _a === void 0 ? void 0 : _a.replace(/(\/runlogic\/)|(\/)$/gi, "");
          var fileName = this.parameterService.objForFileParameter['fileName'];

          if (fileName.includes("/") && this.parameterService.commonObj['dataDir'] == "") {
            var dir = fileName.split("/")[0];
            fileName = fileName.split("/")[1];
            fileUploadPath = "/home/cavisson/\"".concat(this.session.preSession.controllerName, "/workspace/").concat(this.workspaceName, "/").concat(this.profile, "/cavisson/").concat(scriptPath, "/").concat(dir);
          } else if (this.parameterService.commonObj['dataDir'] == "") fileUploadPath = "/home/cavisson/".concat(this.session.preSession.controllerName, "/workspace/").concat(this.workspaceName, "/").concat(this.profile, "/cavisson/").concat(scriptPath);else if (fileName.includes("/") && this.parameterService.commonObj['dataDir']) {
            var _dir2 = fileName.split("/")[0];
            fileName = fileName.split("/")[1];
            fileUploadPath = "/home/cavisson/" + this.session.preSession.controllerName + "/workspace/" + this.workspaceName + "/" + this.profile + "/cavisson/data/" + this.parameterService.commonObj['dataDir'] + "/" + _dir2;
          } else fileUploadPath = "/home/cavisson/".concat(this.session.preSession.controllerName, "/workspace/").concat(this.workspaceName, "/").concat(this.profile, "/cavisson/data/").concat(this.parameterService.commonObj['dataDir']);

          if (!this.utilService.validateFileName(fileName)) return;
          this.fileReadService.readFile(fileToRead, true, fileUploadPath);
        }
      }, {
        key: "toggleTable",
        value: function toggleTable() {
          var _this2 = this;

          this.showTableFormat = !this.showTableFormat;
          this.twoDimArray = [];
          var maxlengthOfJagged = 0;
          var lines = this.parameterService.textArea.split("\n").filter(function (line) {
            return line.trim() !== '';
          });

          for (var i = 0; i < lines.length; i++) {
            if (lines[i].indexOf(this.parameterService.objForFileParameter.columnDelimiter) != -1) {
              var subArray = lines[i].split(this.parameterService.objForFileParameter.columnDelimiter);

              if (subArray.length > maxlengthOfJagged) {
                maxlengthOfJagged = subArray.length;
              }
            } else {
              maxlengthOfJagged = 1;
            }
          }

          this.numOfColsInIndexTable = new Array(maxlengthOfJagged);
          this.headerCols = [];

          var _loop = function _loop() {
            if (_i == Number.parseInt(_this2.parameterService.objForFileParameter.firstDataLine) - 2) {
              var _subArray = lines[_i].split(_this2.parameterService.objForFileParameter.columnDelimiter);

              for (var j = 0; j < maxlengthOfJagged; j++) {
                if (j < _subArray.length) _this2.headerCols.push({
                  "label": _subArray[j],
                  "key": _subArray[j],
                  "type": 0
                });else _this2.headerCols.push({
                  "label": "Col-" + j,
                  "key": "Col-" + j,
                  "type": 0
                });
              }

              return 0; // continue
            } else if (_i < Number.parseInt(_this2.parameterService.objForFileParameter.firstDataLine) - 2) return 0; // continue
            else if (_i == lines.length - 1 && _this2.headerCols.length == 0) {
              for (var _j = 0; _j < maxlengthOfJagged; _j++) {
                _this2.headerCols.push({
                  "label": "Cols-" + _j,
                  "key": "Cols-" + _j,
                  "type": 0
                });
              }
            }

            if (lines[_i].indexOf(_this2.parameterService.objForFileParameter.columnDelimiter) != -1) {
              var _subArray2 = lines[_i].split(_this2.parameterService.objForFileParameter.columnDelimiter); // Converting jagged array to normal 2D Array


              var jaggDiff = maxlengthOfJagged - _subArray2.length;

              if (jaggDiff > 0) {
                for (var index = 0; index < jaggDiff; index++) {
                  _subArray2.push("--"); // this.headerCols.push("Col-" + index+1);

                }
              } // Transform subArray into an object


              var rowObject = {};

              _this2.headerCols.forEach(function (col, index) {
                rowObject[col.key] = _subArray2[index];
              });

              _this2.twoDimArray.push(rowObject);
            } else {
              var _subArray3 = new Array(lines[_i]);

              var _jaggDiff = maxlengthOfJagged - _subArray3.length;

              if (_jaggDiff > 0) {
                for (var _index = 0; _index < _jaggDiff; _index++) {
                  _subArray3.push("--"); // this.headerCols.push("Col-" + index+1);

                }
              }

              var _rowObject = {};

              _this2.headerCols.forEach(function (col, index) {
                _rowObject[col.key] = _subArray3[index];
              });

              _this2.twoDimArray.push(_rowObject);
            }
          },
              _ret;

          for (var _i = 0; _i < lines.length; _i++) {
            _ret = _loop();
            if (_ret === 0) continue;
          }

          this.headers = [{
            cols: this.headerCols
          }];
        }
      }, {
        key: "viewFileData",
        value: function viewFileData() {
          var _this3 = this;

          var filePath;
          var prj,
              subPrj,
              scriptName = '';

          if (this.scenUtilService.openFrom == 'script') {
            prj = this.tabService.activeTabDataInfo['treePath'].split('/')[0];
            subPrj = this.tabService.activeTabDataInfo['treePath'].split('/')[1];
            scriptName = this.tabService.activeTabDataInfo['treePath'].split('/')[2];
          } // Check if the filename is an absolute path


          if (this.parameterService.objForFileParameter['fileName'].startsWith('/')) {
            filePath = this.parameterService.objForFileParameter['fileName'];
          } else {
            if (this.parameterService.commonObj['dataDir']) filePath = "workspace/".concat(this.workspaceName, "/").concat(this.profile, "/cavisson/data/").concat(this.parameterService.commonObj['dataDir'], "/").concat(this.parameterService.objForFileParameter['fileName']);else filePath = "workspace/".concat(this.workspaceName, "/").concat(this.profile, "/cavisson/").concat(prj, "/").concat(subPrj, "/scripts/").concat(scriptName, "/").concat(this.parameterService.objForFileParameter['fileName']);
          }

          var payload = {
            fp: filePath,
            offset: 0,
            limit: this.limit
          };
          this.restService.readFileData(payload).subscribe(function (state) {
            if (state instanceof _services_script_state__WEBPACK_IMPORTED_MODULE_10__["ScriptRestLoading"]) {
              _this3.loading = true;
              return;
            }

            if (state instanceof _services_script_state__WEBPACK_IMPORTED_MODULE_10__["ScriptRestLoaded"]) {
              var res = state.data;
              _this3.parameterService.textArea = res.data;

              if (res.endOfFile == false && res.msg == null) {
                _this3.showMessage('warn', '', 'You cannot edit data file here\n as maximum file limit reached(10MB)');

                _this3.loading = false;
                _this3.fileReadService.readOnly = true;

                _this3.bodyEditor._editor.updateOptions({
                  readOnly: true
                });

                return;
              }

              _this3.loading = false;

              _this3.bodyEditor._editor.updateOptions({
                readOnly: false
              });
            }
          }, function (state) {
            console.error("Error in reading...", state.error);
            _this3.loading = false;
          });
        }
      }, {
        key: "ngOnDestroy",
        value: function ngOnDestroy() {
          this.subscriptionArr.forEach(function (subscription) {
            subscription.unsubscribe();
          });
          this.fileReadService.readOnly = false;
          this.fileReadService.loadingOnUpload = false;
          this.parameterService.fileAlreadyExist = false;
          this.parameterService.disableViewFile = true;
          this.utilService.isValidFileName = false;
          this.parameterService.textArea = '';
          this.parameterService.arrayOfFiles = [];
        }
      }]);
    }();

    FileParameterComponent.ctorParameters = function () {
      return [{
        type: _parameter_utils_service__WEBPACK_IMPORTED_MODULE_13__["ParameterUtilsService"]
      }, {
        type: _script_edit_home_script_topmenu_script_tab_script_tab_data_service__WEBPACK_IMPORTED_MODULE_7__["ScriptTabDataService"]
      }, {
        type: _parameter_data_service__WEBPACK_IMPORTED_MODULE_12__["ParameterDataService"]
      }, {
        type: src_app_core_session_session_service__WEBPACK_IMPORTED_MODULE_3__["SessionService"]
      }, {
        type: src_app_shared_header_work_profile_services_work_profile_active_service__WEBPACK_IMPORTED_MODULE_6__["WorkProfileActiveService"]
      }, {
        type: _services_script_rest_service__WEBPACK_IMPORTED_MODULE_9__["ScriptRestService"]
      }, {
        type: _services_script_msg_service__WEBPACK_IMPORTED_MODULE_8__["ScriptMsgService"]
      }, {
        type: _sm_tree_sm_tree_service__WEBPACK_IMPORTED_MODULE_11__["SmTreeService"]
      }, {
        type: src_app_pages_scenario_service_scenario_utils_service__WEBPACK_IMPORTED_MODULE_4__["ScenarioUtilsService"]
      }, {
        type: src_app_shared_common_services_file_read_client_service__WEBPACK_IMPORTED_MODULE_5__["FileReadClientService"]
      }, {
        type: primeng__WEBPACK_IMPORTED_MODULE_2__["ConfirmationService"]
      }];
    };

    Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewChild"])('myInput')], FileParameterComponent.prototype, "myInputVariable", void 0);
    Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewChild"])("bodyEditor")], FileParameterComponent.prototype, "bodyEditor", void 0);
    FileParameterComponent = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({
      selector: 'app-file-parameter',
      template: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"])(__webpack_require__(
      /*! raw-loader!./file-parameter.component.html */
      "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/home/script-manager/parameter/components/add-parameter/file-parameter/file-parameter.component.html"))["default"]
    })], FileParameterComponent);
    /***/
  },

  /***/
  "./src/app/pages/home/script-manager/parameter/components/add-parameter/file-parameter/file-parameter.module.ts":
  /*!**********************************************************************************************************************!*\
    !*** ./src/app/pages/home/script-manager/parameter/components/add-parameter/file-parameter/file-parameter.module.ts ***!
    \**********************************************************************************************************************/

  /*! exports provided: onMonacoLoad, FileParameterModule */

  /***/
  function _src_app_pages_home_scriptManager_parameter_components_addParameter_fileParameter_fileParameterModuleTs(module, __webpack_exports__, __webpack_require__) {
    "use strict";

    __webpack_require__.r(__webpack_exports__);
    /* harmony export (binding) */


    __webpack_require__.d(__webpack_exports__, "onMonacoLoad", function () {
      return onMonacoLoad;
    });
    /* harmony export (binding) */


    __webpack_require__.d(__webpack_exports__, "FileParameterModule", function () {
      return FileParameterModule;
    });
    /* 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 _file_parameter_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
    /*! ./file-parameter.component */
    "./src/app/pages/home/script-manager/parameter/components/add-parameter/file-parameter/file-parameter.component.ts");
    /* harmony import */


    var _angular_common_http__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
    /*! @angular/common/http */
    "./node_modules/@angular/common/__ivy_ngcc__/fesm2015/http.js");
    /* harmony import */


    var _angular_forms__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
    /*! @angular/forms */
    "./node_modules/@angular/forms/__ivy_ngcc__/fesm2015/forms.js");
    /* harmony import */


    var _angular_router__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
    /*! @angular/router */
    "./node_modules/@angular/router/__ivy_ngcc__/fesm2015/router.js");
    /* harmony import */


    var primeng__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(
    /*! primeng */
    "./node_modules/primeng/__ivy_ngcc__/fesm2015/primeng.js");
    /* harmony import */


    var _param_name_component_param_name_module__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(
    /*! ../../param-name-component/param-name.module */
    "./src/app/pages/home/script-manager/parameter/components/param-name-component/param-name.module.ts");
    /* harmony import */


    var _advance_file_param_advance_file_param_module__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(
    /*! ../advance-file-param/advance-file-param.module */
    "./src/app/pages/home/script-manager/parameter/components/add-parameter/advance-file-param/advance-file-param.module.ts");
    /* harmony import */


    var _common_code_select_datadir_module__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(
    /*! ../../../common-code/select-datadir.module */
    "./src/app/pages/home/script-manager/parameter/common-code/select-datadir.module.ts");
    /* harmony import */


    var ngx_monaco_editor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(
    /*! ngx-monaco-editor */
    "./node_modules/ngx-monaco-editor/__ivy_ngcc__/fesm2015/ngx-monaco-editor.js");
    /* harmony import */


    var src_app_shared_cav_table_cav_table_module__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(
    /*! src/app/shared/cav-table/cav-table.module */
    "./src/app/shared/cav-table/cav-table.module.ts");

    var route = [{
      path: '',
      component: _file_parameter_component__WEBPACK_IMPORTED_MODULE_3__["FileParameterComponent"]
    }];

    function onMonacoLoad() {
      return window.monaco;
    }

    var monacoConfig = {
      baseUrl: './assets',
      defaultOptions: {
        scrollBeyondLastLine: false
      },
      onMonacoLoad: onMonacoLoad // here monaco object will be available as window.monaco use this function to extend monaco editor functionalities.

    };

    var FileParameterModule = /*#__PURE__*/_createClass(function FileParameterModule() {
      _classCallCheck(this, FileParameterModule);
    });

    FileParameterModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
      declarations: [_file_parameter_component__WEBPACK_IMPORTED_MODULE_3__["FileParameterComponent"]],
      exports: [],
      imports: [_angular_common__WEBPACK_IMPORTED_MODULE_2__["CommonModule"], _angular_forms__WEBPACK_IMPORTED_MODULE_5__["FormsModule"], _angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HttpClientModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["DropdownModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["ButtonModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["InputTextModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["FieldsetModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["TableModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["CheckboxModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["MenuModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["MessageModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["MultiSelectModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["TooltipModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["TabViewModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["ConfirmDialogModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["MessagesModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["SidebarModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["InputNumberModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["DialogModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["TabMenuModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["AutoCompleteModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["AccordionModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["RadioButtonModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["SpinnerModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["FileUploadModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["SelectButtonModule"], _param_name_component_param_name_module__WEBPACK_IMPORTED_MODULE_8__["ParamNameModule"], _advance_file_param_advance_file_param_module__WEBPACK_IMPORTED_MODULE_9__["AdvanceFileParamModule"], _common_code_select_datadir_module__WEBPACK_IMPORTED_MODULE_10__["SelectDatadirModule"], primeng__WEBPACK_IMPORTED_MODULE_7__["InputTextareaModule"], src_app_shared_cav_table_cav_table_module__WEBPACK_IMPORTED_MODULE_12__["CavTableModule"], _angular_router__WEBPACK_IMPORTED_MODULE_6__["RouterModule"].forChild(route), ngx_monaco_editor__WEBPACK_IMPORTED_MODULE_11__["MonacoEditorModule"].forRoot(monacoConfig)]
    })], FileParameterModule);
    /***/
  }
}]);