import "choerodon-ui/pro/lib/password/style";
import _Password from "choerodon-ui/pro/lib/password";
import "choerodon-ui/pro/lib/number-field/style";
import _NumberField from "choerodon-ui/pro/lib/number-field";
import "choerodon-ui/pro/lib/select-box/style";
import _SelectBox from "choerodon-ui/pro/lib/select-box";
import "choerodon-ui/pro/lib/text-field/style";
import _TextField from "choerodon-ui/pro/lib/text-field";
import "choerodon-ui/lib/spin/style";
import _Spin from "@hzero-front-ui/c7n-ui/lib/Spin";
import "choerodon-ui/pro/lib/button/style";
import _Button from "choerodon-ui/pro/lib/button";
import "choerodon-ui/lib/icon/style";
import _Icon from "choerodon-ui/lib/icon";
import "choerodon-ui/pro/lib/form/style";
import _Form from "@hzero-front-ui/c7n-ui/lib/FormPro";
import "choerodon-ui/pro/lib/modal/style";
import _Modal from "choerodon-ui/pro/lib/modal";
import "choerodon-ui/lib/tooltip/style";
import _Tooltip from "choerodon-ui/lib/tooltip";
import "choerodon-ui/pro/lib/message/style";
import _message from "choerodon-ui/pro/lib/message";
import "choerodon-ui/pro/lib/select/style";
import _Select from "choerodon-ui/pro/lib/select";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

/* eslint-disable */
import React, { useState, useEffect, useCallback } from 'react';
import { observer } from 'mobx-react-lite';
import { axios } from '@choerodon/boot';
import _ from 'lodash';
import { Base64 } from 'js-base64';
import { NewTips } from '@choerodon/components';
import Tips from "../../../../../../components/new-tips";
import YamlEditor from "../../../../../../components/yamlEditor";
import emptyImg from "../../../../../../components/empty-page/image/owner.png";
import DependRepo from "./DependRepo";
import { useAddTaskStore } from "./stores";
import JSONbig from 'json-bigint';
import "./index.less";
var Option = _Select.Option;
var currentSize = 10;
var originBranchs = [{
  value: 'master',
  name: 'master'
}, {
  value: 'feature',
  name: 'feature'
}, {
  value: 'bugfix',
  name: 'bugfix'
}, {
  value: 'hotfix',
  name: 'hotfix'
}, {
  value: 'release',
  name: 'release'
}, {
  value: 'tag',
  name: 'tag'
}];
var obj = {
  Maven: 'Maven构建',
  npm: 'Npm构建',
  // upload: '上传软件包至存储库',
  docker: 'Docker构建',
  chart: 'Chart构建',
  go: 'Go语言构建',
  maven_deploy: 'Maven发布',
  upload_jar: '上传jar包至制品库'
};
var checkField = {
  upload: ['uploadFilePattern', 'uploadArtifactFileName'],
  docker: ['dockerContextDir', 'dockerFilePath']
};
var AddTask = observer(function () {
  var _useAddTaskStore = useAddTaskStore(),
      AddTaskFormDataSet = _useAddTaskStore.AddTaskFormDataSet,
      AddTaskStepFormDataSet = _useAddTaskStore.AddTaskStepFormDataSet,
      DependRepoDataSet = _useAddTaskStore.DependRepoDataSet,
      modal = _useAddTaskStore.modal,
      handleOk = _useAddTaskStore.handleOk,
      useStore = _useAddTaskStore.AddTaskUseStore,
      id = _useAddTaskStore.AppState.currentMenuType.id,
      jobDetail = _useAddTaskStore.jobDetail,
      appServiceId = _useAddTaskStore.appServiceId,
      PipelineCreateFormDataSet = _useAddTaskStore.PipelineCreateFormDataSet,
      image = _useAddTaskStore.image,
      formatMessage = _useAddTaskStore.intl.formatMessage,
      stageName = _useAddTaskStore.stageName;

  var _useState = useState([]),
      _useState2 = _slicedToArray(_useState, 2),
      steps = _useState2[0],
      setSteps = _useState2[1];

  var _useState3 = useState(''),
      _useState4 = _slicedToArray(_useState3, 2),
      testConnect = _useState4[0],
      setTestConnect = _useState4[1];

  var _useState5 = useState(false),
      _useState6 = _slicedToArray(_useState5, 2),
      ConnectLoading = _useState6[0],
      setConnectLoading = _useState6[1];

  var _useState7 = useState(useStore.getYaml.custom),
      _useState8 = _slicedToArray(_useState7, 2),
      customYaml = _useState8[0],
      setCustomYaml = _useState8[1];

  var _useState9 = useState(''),
      _useState10 = _slicedToArray(_useState9, 2),
      defaultImage = _useState10[0],
      setDefaultImage = _useState10[1];

  var _useState11 = useState(false),
      _useState12 = _slicedToArray(_useState11, 2),
      expandIf = _useState12[0],
      setExpandIf = _useState12[1];

  var _useState13 = useState(false),
      _useState14 = _slicedToArray(_useState13, 2),
      expandIfSetting = _useState14[0],
      setExpandIfSetting = _useState14[1];

  var _useState15 = useState(originBranchs),
      _useState16 = _slicedToArray(_useState15, 2),
      branchsList = _useState16[0],
      setBranchsList = _useState16[1];

  useEffect(function () {
    // 有docker步骤设置必填项
    function setRequiredExistDocker(stepsParams, ds) {
      // 如果有docker步骤
      if (stepsParams.find(function (i) {
        return i.type === 'docker';
      })) {
        var _ds$current$toData = ds.current.toData(),
            imageScan = _ds$current$toData.imageScan,
            securityControl = _ds$current$toData.securityControl; // 如果镜像安全扫描和发布门禁都为是


        if (imageScan && securityControl) {
          ds.getField('level').set('required', true);
          ds.getField('condition').set('required', true);
        } else {
          ds.getField('level').set('required', false);
          ds.getField('condition').set('required', false);
        }
      } else {
        ds.getField('level').set('required', false);
        ds.getField('condition').set('required', false);
      }
    }

    if (steps.length > 0) {
      var old = AddTaskFormDataSet.current.get('private');

      if (steps.find(function (s) {
        return s.checked;
      }).repo) {
        var item = [].concat(_toConsumableArray(steps.find(function (s) {
          return s.checked;
        }).repo.publicRepo || []), _toConsumableArray(steps.find(function (s) {
          return s.checked;
        }).repo.privateRepo || []));
        AddTaskFormDataSet.current.set('private', item.length > 0 ? Array.from(new Set([].concat(_toConsumableArray(old), ['custom']))) : old.filter(function (o) {
          return o !== 'custom';
        }));
      }

      if (steps.find(function (s) {
        return s.checked;
      }).mavenSettings) {
        AddTaskFormDataSet.current.set('private', Array.from(new Set([].concat(_toConsumableArray(old), ['copy']))));
      }

      AddTaskFormDataSet.getField('uploadFilePattern').set('required', steps.some(function (s) {
        return s.type === 'upload';
      }));
      AddTaskFormDataSet.getField('dockerContextDir').set('required', steps.some(function (s) {
        return s.type === 'docker';
      }));
      AddTaskFormDataSet.getField('dockerFilePath').set('required', steps.some(function (s) {
        return s.type === 'docker';
      }));
      AddTaskFormDataSet.getField('uploadArtifactFileName').set('required', steps.some(function (s) {
        return s.type === 'upload';
      }));
      AddTaskFormDataSet.getField('zpk').set('required', steps.some(function (s) {
        return s.type === 'maven_deploy';
      }));
      AddTaskFormDataSet.getField('jar_zpk').set('required', steps.some(function (s) {
        return s.type === 'upload_jar';
      }));
      setRequiredExistDocker(steps, AddTaskFormDataSet);
    }

    if (AddTaskFormDataSet.current.get('type') === 'build') {
      AddTaskFormDataSet.getField('bzmc').set('required', steps.length > 0);
    }
  }, [steps, AddTaskFormDataSet.current.get('imageScan'), AddTaskFormDataSet.current.get('securityControl')]);

  function decode(base64) {
    var decodeStr = atob(base64);
    return decodeURI(decodeStr);
  }

  var getBranchsList = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
    var url, res;
    return regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            url = "devops/v1/projects/".concat(id, "/app_service/").concat(PipelineCreateFormDataSet.current.get('appServiceId'), "/git/page_branch_by_options?page=1&size=").concat(currentSize);
            _context.next = 3;
            return axios.post(url);

          case 3:
            res = _context.sent;

            if (res.content.length % 10 === 0 && res.content.length !== 0) {
              res.content.push({
                name: '加载更多',
                value: 'more'
              });
            }

            setBranchsList(res.content.map(function (c) {
              if (c.branchName) {
                c.name = c.branchName;
                c.value = c.branchName;
              }

              return c;
            }));

          case 6:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  })), [currentSize]); // 通过传入的stageName 替换自定义的yaml

  var initCustomYaml = function initCustomYaml(stage, yaml, setYaml) {
    var newYaml = yaml.replace('{stageName}', stage || 'build');
    setYaml(newYaml);
  };

  useEffect(function () {
    initCustomYaml(stageName, customYaml, setCustomYaml);

    function initBranchs() {
      return _initBranchs.apply(this, arguments);
    }

    function _initBranchs() {
      _initBranchs = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
        var value;
        return regeneratorRuntime.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                value = AddTaskFormDataSet.current.get('triggerType');

                if (value && !value.includes('exact')) {
                  setBranchsList(originBranchs);
                } else {
                  getBranchsList();
                }

              case 2:
              case "end":
                return _context2.stop();
            }
          }
        }, _callee2);
      }));
      return _initBranchs.apply(this, arguments);
    }

    initBranchs();
  }, [AddTaskFormDataSet.current.get('triggerType')]);
  useEffect(function () {
    var init = /*#__PURE__*/function () {
      var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
        var res, _newSteps$find, _JSONbig$parse, config, authType, username, token, password, sonarUrl, configType, scannerType, sources, skipTests, uploadFilePattern, dockerContextDir, dockerFilePath, uploadArtifactFileName, dockerArtifactFileName, skipDockerTlsVerify, imageScan, securityControl, level, symbol, condition, share, nexusMavenRepoIds, zpk, jarZpk, newSteps, data;

        return regeneratorRuntime.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                _context3.next = 2;
                return useStore.axiosGetDefaultImage();

              case 2:
                res = _context3.sent;
                useStore.setDefaultImage(res);

                if (jobDetail) {
                  if (!['custom', 'chart'].includes(jobDetail.type)) {
                    _JSONbig$parse = JSONbig.parse(jobDetail.metadata.replace(/'/g, '"')), config = _JSONbig$parse.config, authType = _JSONbig$parse.authType, username = _JSONbig$parse.username, token = _JSONbig$parse.token, password = _JSONbig$parse.password, sonarUrl = _JSONbig$parse.sonarUrl, configType = _JSONbig$parse.configType, scannerType = _JSONbig$parse.scannerType, sources = _JSONbig$parse.sources, skipTests = _JSONbig$parse.skipTests;
                    securityControl = true;
                    symbol = '<=';
                    share = [];
                    config && config.forEach(function (c, cIndex) {
                      if (c.repos) {
                        c.repo = {
                          privateRepo: c.repos.filter(function (i) {
                            return i["private"];
                          }).map(function (i) {
                            i.privateIf = i["private"];
                            return i;
                          }),
                          publicRepo: c.repos.filter(function (i) {
                            return !i["private"];
                          }).map(function (i) {
                            i.privateIf = i["private"];
                            return i;
                          })
                        };
                      }

                      if (cIndex === 0) {
                        c.checked = true;
                      } else {
                        c.checked = false;
                      }

                      if (c.type === 'upload') {
                        uploadFilePattern = c.uploadFilePattern;
                        uploadArtifactFileName = c.artifactFileName;
                      } else if (c.type === 'docker') {
                        dockerContextDir = c.dockerContextDir;
                        dockerFilePath = c.dockerFilePath;
                        skipDockerTlsVerify = c.skipDockerTlsVerify || false;
                        imageScan = c.imageScan || false;
                        dockerArtifactFileName = c.artifactFileName;

                        if (!(_.isUndefined(c.securityControl) || _.isNull(c.securityControl))) {
                          securityControl = c.securityControl;
                        } else {
                          securityControl = false;
                        }

                        if (c.securityCondition) {
                          level = c.securityCondition.level;
                          symbol = c.securityCondition.symbol;
                          condition = c.securityCondition.condition;
                        }
                      } else if (c.type === 'Maven') {
                        if (c.nexusMavenRepoIds) {
                          nexusMavenRepoIds = c.nexusMavenRepoIds;
                        }
                      } else if (c.type === 'maven_deploy') {
                        if (c.mavenDeployRepoSettings) {
                          zpk = c.mavenDeployRepoSettings.nexusRepoIds;
                          nexusMavenRepoIds = c.nexusMavenRepoIds;
                        }
                      } else if (c.type === 'upload_jar') {
                        if (c.mavenDeployRepoSettings) {
                          jarZpk = c.mavenDeployRepoSettings.nexusRepoIds;
                        }
                      }

                      if (c.mavenSettings) {
                        c.mavenSettings = Base64.decode(c.mavenSettings);
                      }

                      c.yaml = Base64.decode(c.script);
                    });
                    ['toUpload', 'toDownload'].forEach(function (item) {
                      if (jobDetail[item]) {
                        share.push(item);
                      }
                    });
                    newSteps = config || [];
                    data = _objectSpread(_objectSpread({}, jobDetail), {}, {
                      uploadFilePattern: uploadFilePattern,
                      dockerContextDir: dockerContextDir,
                      dockerFilePath: dockerFilePath,
                      uploadArtifactFileName: uploadArtifactFileName,
                      dockerArtifactFileName: dockerArtifactFileName,
                      nexusMavenRepoIds: nexusMavenRepoIds,
                      zpk: zpk,
                      jar_zpk: jarZpk,
                      skipDockerTlsVerify: skipDockerTlsVerify,
                      imageScan: imageScan,
                      securityControl: securityControl,
                      level: level,
                      symbol: symbol,
                      condition: condition,
                      scannerType: scannerType,
                      sources: sources,
                      skipTests: skipTests,
                      triggerValue: jobDetail.triggerValue && jobDetail.triggerType !== 'regex' ? jobDetail.triggerValue.split(',') : jobDetail.triggerValue,
                      configType: configType,
                      // triggerRefs: jobDetail.triggerRefs ? jobDetail.triggerRefs.split(',') : [],
                      glyyfw: appServiceId || PipelineCreateFormDataSet.getField('appServiceId').getText(PipelineCreateFormDataSet.current.get('appServiceId')),
                      bzmc: newSteps.find(function (s) {
                        return s.checked;
                      }) ? newSteps.find(function (s) {
                        return s.checked;
                      }).name : '',
                      authType: authType,
                      username: username,
                      token: token,
                      password: password,
                      sonarUrl: sonarUrl,
                      "private": newSteps.length > 0 && (newSteps === null || newSteps === void 0 ? void 0 : (_newSteps$find = newSteps.find(function (s) {
                        return s.checked;
                      })) === null || _newSteps$find === void 0 ? void 0 : _newSteps$find.repos) ? ['custom'] : '',
                      share: share
                    });
                    AddTaskFormDataSet.loadData([data]);
                    setSteps(newSteps);
                  } else {
                    AddTaskFormDataSet.loadData([_objectSpread(_objectSpread({}, jobDetail), {}, {
                      triggerValue: jobDetail.triggerValue && jobDetail.triggerType !== 'regex' ? jobDetail.triggerValue.split(',') : jobDetail.triggerValue,
                      glyyfw: appServiceId || PipelineCreateFormDataSet.getField('appServiceId').getText(PipelineCreateFormDataSet.current.get('appServiceId'))
                    })]);

                    if (jobDetail.type === 'custom') {
                      setCustomYaml(Base64.decode(jobDetail.metadata));
                    }
                  }

                  if (!jobDetail.image) {
                    AddTaskFormDataSet.current.set('selectImage', '0');

                    if (!image) {
                      AddTaskFormDataSet.current.set('image', useStore.getDefaultImage);
                      setDefaultImage(useStore.getDefaultImage);
                    } else {
                      AddTaskFormDataSet.current.set('image', image);
                      setDefaultImage(image);
                    }
                  } else {
                    AddTaskFormDataSet.current.set('selectImage', '1');
                    AddTaskFormDataSet.current.set('image', jobDetail.image);
                    setDefaultImage(jobDetail.image);
                  } // if (jobDetail.image !== res) {
                  //   AddTaskFormDataSet.current.set('selectImage', '1');
                  // } else {
                  //   AddTaskFormDataSet.current.set('selectImage', '0');
                  // }

                } else {
                  if (image) {
                    AddTaskFormDataSet.current.set('selectImage', '0');
                    AddTaskFormDataSet.current.set('image', image);
                    setDefaultImage(image);
                  } else {
                    AddTaskFormDataSet.current.set('selectImage', '0');
                    AddTaskFormDataSet.current.set('image', useStore.getDefaultImage);
                    setDefaultImage(useStore.getDefaultImage);
                  }

                  AddTaskFormDataSet.current.set('glyyfw', appServiceId || PipelineCreateFormDataSet.getField('appServiceId').getText(PipelineCreateFormDataSet.current.get('appServiceId')));
                }

              case 5:
              case "end":
                return _context3.stop();
            }
          }
        }, _callee3);
      }));

      return function init() {
        return _ref2.apply(this, arguments);
      };
    }();

    init();
  }, []);

  function encode(str) {
    var encodeStr = encodeURI(str);
    return btoa(encodeStr);
  }

  var handleAdd = /*#__PURE__*/function () {
    var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
      var result, connet, data, checkedIndex, i, j, isValid;
      return regeneratorRuntime.wrap(function _callee4$(_context4) {
        while (1) {
          switch (_context4.prev = _context4.next) {
            case 0:
              if (!(AddTaskFormDataSet.current.get('type') === 'build')) {
                _context4.next = 4;
                break;
              }

              if (!(steps.length === 0)) {
                _context4.next = 4;
                break;
              }

              _message.error('请先添加步骤');

              return _context4.abrupt("return", false);

            case 4:
              _context4.next = 6;
              return AddTaskFormDataSet.validate();

            case 6:
              result = _context4.sent;

              if (!result) {
                _context4.next = 18;
                break;
              }

              if (!(AddTaskFormDataSet.current.get('type') === 'sonar' && AddTaskFormDataSet.current.get('configType') === 'custom' && AddTaskFormDataSet.current.get('authType') === 'username')) {
                _context4.next = 14;
                break;
              }

              _context4.next = 11;
              return handleTestConnect();

            case 11:
              connet = _context4.sent;

              if (connet) {
                _context4.next = 14;
                break;
              }

              return _context4.abrupt("return", false);

            case 14:
              data = AddTaskFormDataSet.toData()[0];
              data = _objectSpread(_objectSpread({}, data), {}, {
                // eslint-disable-next-line no-nested-ternary
                triggerValue: data.triggerValue && data.triggerType !== 'regex' ? typeof data.triggerValue === 'object' ? data.triggerValue.join(',') : data.triggerValue : data.triggerValue,
                image: data.selectImage === '1' ? data.image : null,
                toUpload: data.type === 'build' && data.share.includes('toUpload'),
                toDownload: data.type === 'build' && data.share.includes('toDownload'),
                configJobTypes: data.type === 'build' ? steps.map(function (step) {
                  return step.type;
                }) : null,
                metadata: function () {
                  if (data.type === 'build') {
                    return JSON.stringify({
                      config: steps.map(function (s, sIndex) {
                        s.sequence = sIndex;
                        s.script = Base64.encode(s.yaml);
                        delete s.yaml;

                        if (s.repo) {
                          s.repos = [].concat(_toConsumableArray((s.repo.publicRepo || []).map(function (p) {
                            p["private"] = p.privateIf;
                            return p;
                          })), _toConsumableArray((s.repo.privateRepo || []).map(function (p) {
                            p["private"] = p.privateIf;
                            return p;
                          })));
                        }

                        if (data.nexusMavenRepoIds && s.type === 'Maven') {
                          s.nexusMavenRepoIds = data.nexusMavenRepoIds;
                        }

                        if (s.mavenSettings) {
                          s.mavenSettings = Base64.encode(s.mavenSettings);
                        }

                        if (s.type === 'upload') {
                          s.uploadFilePattern = data.uploadFilePattern;

                          if (data.uploadArtifactFileName) {
                            s.artifactFileName = data.uploadArtifactFileName;
                          }
                        }

                        if (s.type === 'docker') {
                          s.dockerContextDir = data.dockerContextDir;
                          s.dockerFilePath = data.dockerFilePath;
                          s.skipDockerTlsVerify = data.skipDockerTlsVerify;
                          s.imageScan = data.imageScan;

                          if (data.dockerArtifactFileName) {
                            s.artifactFileName = data.dockerArtifactFileName;
                          }

                          s.securityControl = data.securityControl;
                          s.securityCondition = {
                            level: data.level,
                            symbol: data.symbol,
                            condition: data.condition
                          };
                        }

                        if (data.zpk && s.type === 'maven_deploy') {
                          s.mavenDeployRepoSettings = {
                            nexusRepoIds: data.zpk
                          };
                          s.nexusMavenRepoIds = data.nexusMavenRepoIds;
                        }

                        if (data.jar_zpk && s.type === 'upload_jar') {
                          s.mavenDeployRepoSettings = {
                            nexusRepoIds: data.jar_zpk
                          };
                        }

                        return s;
                      })
                    }).replace(/"/g, "'");
                  }

                  if (data.type === 'sonar') {
                    return JSON.stringify(_objectSpread(_objectSpread({}, data), {}, {
                      metadata: ''
                    })).replace(/"/g, "'");
                  }

                  if (data.type === 'custom') {
                    return Base64.encode(customYaml);
                  }
                }()
              });
              handleOk(data);
              return _context4.abrupt("return", true);

            case 18:
              i = 0;

            case 19:
              if (!(i < steps.length)) {
                _context4.next = 35;
                break;
              }

              if (!Object.keys(checkField).includes(steps[i].type)) {
                _context4.next = 30;
                break;
              }

              j = 0;

            case 22:
              if (!(j < checkField[steps[i].type].length)) {
                _context4.next = 30;
                break;
              }

              isValid = AddTaskFormDataSet.current.getField(checkField[steps[i].type][j]).isValid();

              if (isValid) {
                _context4.next = 27;
                break;
              }

              checkedIndex = i;
              return _context4.abrupt("break", 30);

            case 27:
              j++;
              _context4.next = 22;
              break;

            case 30:
              if (!(String(checkedIndex) !== 'undefined')) {
                _context4.next = 32;
                break;
              }

              return _context4.abrupt("break", 35);

            case 32:
              i++;
              _context4.next = 19;
              break;

            case 35:
              if (String(checkedIndex) !== 'undefined') {
                setSteps(steps.map(function (s, sIndex) {
                  if (String(sIndex) === String(checkedIndex)) {
                    s.checked = true;
                  } else {
                    s.checked = false;
                  }

                  return s;
                }));
              }

              return _context4.abrupt("return", false);

            case 37:
            case "end":
              return _context4.stop();
          }
        }
      }, _callee4);
    }));

    return function handleAdd() {
      return _ref3.apply(this, arguments);
    };
  }();

  useEffect(function () {
    function useEffectByType() {
      return _useEffectByType.apply(this, arguments);
    }

    function _useEffectByType() {
      _useEffectByType = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
        return regeneratorRuntime.wrap(function _callee5$(_context5) {
          while (1) {
            switch (_context5.prev = _context5.next) {
              case 0:
                if (!(AddTaskFormDataSet.current.get('type') === 'sonar')) {
                  _context5.next = 7;
                  break;
                }

                if (AddTaskFormDataSet.current.get('authType') === 'username') {
                  modal.update({
                    okProps: {
                      disabled: !testConnect
                    }
                  });
                } else {
                  modal.update({
                    okProps: {
                      disabled: false
                    }
                  });
                }

                _context5.next = 4;
                return useStore.axiosGetHasDefaultSonar();

              case 4:
                modal.update({
                  okProps: {
                    disabled: !useStore.getHasDefaultSonar
                  }
                });
                _context5.next = 8;
                break;

              case 7:
                modal.update({
                  okProps: {
                    disabled: false
                  }
                });

              case 8:
                if (AddTaskFormDataSet.current.get('type') !== 'build') {
                  AddTaskFormDataSet.getField('uploadFilePattern').set('required', false);
                  AddTaskFormDataSet.getField('dockerContextDir').set('required', false);
                  AddTaskFormDataSet.getField('dockerFilePath').set('required', false);
                  AddTaskFormDataSet.getField('uploadArtifactFileName').set('required', false);
                  AddTaskFormDataSet.getField('zpk').set('required', false);
                  AddTaskFormDataSet.getField('jar_zpk').set('required', false);
                }

                if (AddTaskFormDataSet.current.get('type') === 'custom') {
                  AddTaskFormDataSet.getField('name').set('required', false);
                  AddTaskFormDataSet.getField('glyyfw').set('required', false);
                }

              case 10:
              case "end":
                return _context5.stop();
            }
          }
        }, _callee5);
      }));
      return _useEffectByType.apply(this, arguments);
    }

    useEffectByType();
  }, [testConnect, AddTaskFormDataSet.current.get('type'), AddTaskFormDataSet.current.get('authType')]);
  modal.handleOk(handleAdd);

  var handleClickStepItem = function handleClickStepItem(index) {
    setSteps(steps.map(function (s, sIndex) {
      if (sIndex === index) {
        s.checked = true;
        AddTaskFormDataSet.current.set('bzmc', s.name);
      } else {
        s.checked = false;
      }

      return s;
    }));
  };

  var renderer = function renderer(_ref4) {
    var text = _ref4.text;
    return text;
  };

  var optionRenderer = function optionRenderer(_ref5) {
    var text = _ref5.text;

    if (text === 'Docker构建') {
      return /*#__PURE__*/React.createElement(_Tooltip, {
        title: "\u7531\u4E8E\u8BE5\u6B65\u9AA4\u4E2DDockerfile\u5185kaniko\u6307\u4EE4\u9650\u5236\uFF0C\u5EFA\u8BAE\u6B64\u6B65\u9AA4\u4F5C\u4E3A\u540C\u4EFB\u52A1\u4E2D\u6700\u540E\u4E00\u4E2A\u6B65\u9AA4\u3002"
      }, /*#__PURE__*/React.createElement("div", {
        style: {
          display: 'flex',
          alignItems: 'center'
        }
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          marginRight: '5px'
        }
      }, text), /*#__PURE__*/React.createElement(NewTips, null)));
    }

    return text;
  };

  var handleAddStepItem = function handleAddStepItem(index) {
    _Modal.open({
      key: _Modal.key(),
      title: '添加步骤',
      style: {
        width: 380
      },
      children: /*#__PURE__*/React.createElement(_Form, {
        dataSet: AddTaskStepFormDataSet
      }, /*#__PURE__*/React.createElement(_Select, {
        onOption: function onOption(_ref6) {
          var record = _ref6.record;
          return {
            disabled: steps.map(function (s) {
              return s.type;
            }).includes(record.get('value'))
          };
        },
        optionRenderer: optionRenderer,
        renderer: renderer,
        name: "kybz"
      })),
      drawer: true,
      okText: '添加',
      onOk: function () {
        var _onOk = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
          var result, value, newSteps;
          return regeneratorRuntime.wrap(function _callee6$(_context6) {
            while (1) {
              switch (_context6.prev = _context6.next) {
                case 0:
                  _context6.next = 2;
                  return AddTaskStepFormDataSet.validate();

                case 2:
                  result = _context6.sent;

                  if (result) {
                    _context6.next = 5;
                    break;
                  }

                  return _context6.abrupt("return", false);

                case 5:
                  if (AddTaskStepFormDataSet.current && AddTaskStepFormDataSet.current.get('kybz')) {
                    value = AddTaskStepFormDataSet.current.get('kybz');

                    if (value) {
                      newSteps = steps;
                      newSteps.splice(index, 0, {
                        name: obj[value],
                        type: value,
                        checked: true,
                        yaml: useStore.getYaml[value] || ''
                      });
                      setSteps(newSteps.map(function (s, sIndex) {
                        if (sIndex === index) {
                          s.checked = true;
                          AddTaskFormDataSet.current.set('bzmc', s.name);
                        } else {
                          s.checked = false;
                        }

                        return s;
                      }));
                    }
                  }

                  AddTaskStepFormDataSet.reset();

                case 7:
                case "end":
                  return _context6.stop();
              }
            }
          }, _callee6);
        }));

        function onOk() {
          return _onOk.apply(this, arguments);
        }

        return onOk;
      }(),
      onCancel: function onCancel() {
        AddTaskStepFormDataSet.reset();
      }
    });
  };

  var handleDeleteStep = function handleDeleteStep(index, e) {
    e.stopPropagation();
    var newSteps = steps;
    newSteps.splice(index, 1);
    var newSteps2 = newSteps.map(function (s, sIndex) {
      if (index === 0) {
        if (sIndex === 0) {
          s.checked = true;
          AddTaskFormDataSet.current.set('bzmc', s.name);
        } else {
          s.checked = false;
        }
      } else if (sIndex === index - 1) {
        s.checked = true;
        AddTaskFormDataSet.current.set('bzmc', s.name);
      } else {
        s.checked = false;
      }

      return s;
    });
    setSteps(newSteps2);
  };

  var generateSteps = function generateSteps() {
    return /*#__PURE__*/React.createElement("div", {
      className: "AddTask_stepItemsContainer"
    }, steps.length > 0 ? steps.map(function (s, index) {
      return /*#__PURE__*/React.createElement("div", {
        className: "AddTask_stepMapContent"
      }, /*#__PURE__*/React.createElement("div", {
        style: {
          display: index === 0 ? 'flex' : 'none'
        },
        className: "AddTask_stepAdd"
      }, /*#__PURE__*/React.createElement("span", _defineProperty({
        style: {
          position: 'relative',
          bottom: '1px'
        },
        onClick: function onClick() {
          return handleAddStepItem(index);
        }
      }, "style", {
        fontSize: 20
      }), "+")), /*#__PURE__*/React.createElement("div", {
        className: "AddTask_addLine"
      }), /*#__PURE__*/React.createElement("div", {
        onClick: function onClick() {
          return handleClickStepItem(index);
        },
        className: s.checked ? 'AddTask_stepItem AddTask_stepItemChecked' : 'AddTask_stepItem'
      }, s.name, /*#__PURE__*/React.createElement(_Icon, {
        onClick: function onClick(e) {
          return handleDeleteStep(index, e);
        },
        style: {
          position: 'relative',
          bottom: '1px'
        },
        type: "delete_forever"
      })), /*#__PURE__*/React.createElement("div", {
        className: "AddTask_addLine"
      }), /*#__PURE__*/React.createElement("div", {
        className: "AddTask_stepAdd"
      }, /*#__PURE__*/React.createElement("span", _defineProperty({
        style: {
          position: 'relative',
          bottom: '1px'
        },
        onClick: function onClick() {
          return handleAddStepItem(index + 1);
        }
      }, "style", {
        fontSize: 20
      }), "+")));
    }) : /*#__PURE__*/React.createElement("div", {
      className: "AddTask_stepMapContent"
    }, /*#__PURE__*/React.createElement("div", {
      className: "AddTask_stepAdd"
    }, /*#__PURE__*/React.createElement("span", _defineProperty({
      style: {
        position: 'relative',
        bottom: '1px'
      },
      onClick: function onClick() {
        return handleAddStepItem(0);
      }
    }, "style", {
      fontSize: 20
    }), "+"))));
  };

  var handleChangeValue = function handleChangeValue(value, index) {
    setSteps(steps.map(function (s, sIndex) {
      if (s.checked) {
        s.yaml = value;
      }

      return s;
    }));
  };

  var handleTestConnect = function handleTestConnect() {
    return new Promise(function (resolve) {
      setConnectLoading(true);
      var data = AddTaskFormDataSet.current.toData();
      useStore.axiosConnectTest(data, id).then(function (res) {
        setTestConnect(res);
        setConnectLoading(false);
        resolve(res);
      })["catch"](function (e) {
        setTestConnect(false);
        setConnectLoading(false);
        resolve(false);
      });
    });
  };

  var handleChangeBuildTemple = function handleChangeBuildTemple(value) {
    if (value) {
      AddTaskFormDataSet.current.set('bzmc', obj[value]);
      var origin = value !== 'go' ? [{
        name: obj[value],
        type: value,
        checked: true,
        yaml: useStore.getYaml[value]
      }] : [];
      var extra = [];

      if (value === 'Maven') {
        extra = [{
          name: 'Docker构建',
          type: 'docker',
          checked: false
        }];
      } else if (value === 'npm') {
        extra = [{
          name: 'Docker构建',
          type: 'docker',
          checked: false
        }];
      } else if (value === 'go') {
        extra = [{
          name: 'Docker构建',
          type: 'docker',
          checked: true
        }];
      }

      setSteps([].concat(origin, _toConsumableArray(extra)));
    } else {
      setSteps([]);
    }
  };

  var renderTestConnect = function renderTestConnect() {
    function renderDom() {
      if (String(testConnect)) {
        if (testConnect) {
          return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
            className: "addTask_testConnect_success"
          }, /*#__PURE__*/React.createElement("i", {
            className: "success"
          })), /*#__PURE__*/React.createElement("p", {
            className: "addTask_testConnect_havnot",
            style: {
              marginTop: '4px',
              marginBottom: '6px'
            }
          }, "\u6D4B\u8BD5\u8FDE\u63A5:", /*#__PURE__*/React.createElement("span", null, "\u6210\u529F")), /*#__PURE__*/React.createElement("p", {
            style: {
              color: 'rgba(58,52,95,0.65)'
            }
          }, "(\u91CD\u65B0\u8FDB\u884C\u8FDE\u63A5\u6D4B\u8BD5:", /*#__PURE__*/React.createElement(_Button, {
            onClick: handleTestConnect,
            funcType: "flat",
            style: {
              width: 'auto',
              color: '#3F51B5'
            }
          }, "\u6D4B\u8BD5\u8FDE\u63A5"), ")"));
        }

        return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
          style: {
            borderColor: 'rgb(247, 122, 112)'
          },
          className: "addTask_testConnect_success"
        }, /*#__PURE__*/React.createElement("i", {
          className: "failure"
        }, "X")), /*#__PURE__*/React.createElement("p", {
          className: "addTask_testConnect_havnot",
          style: {
            marginTop: '4px',
            marginBottom: '6px'
          }
        }, "\u6D4B\u8BD5\u8FDE\u63A5:", /*#__PURE__*/React.createElement("span", {
          style: {
            color: 'rgb(247, 122, 112)'
          }
        }, "\u5931\u8D25")), /*#__PURE__*/React.createElement("p", {
          style: {
            color: 'rgba(58,52,95,0.65)'
          }
        }, "(\u91CD\u65B0\u8FDB\u884C\u8FDE\u63A5\u6D4B\u8BD5:", /*#__PURE__*/React.createElement(_Button, {
          onClick: handleTestConnect,
          funcType: "flat",
          style: {
            width: 'auto',
            color: '#3F51B5'
          }
        }, "\u6D4B\u8BD5\u8FDE\u63A5"), ")"));
      }

      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("img", {
        style: {
          width: 121,
          marginRight: 39
        },
        src: emptyImg,
        alt: "none"
      }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
        className: "addTask_testConnect_havnot"
      }, "\u672A\u8FDB\u884C\u8FC7\u8FDE\u63A5"), /*#__PURE__*/React.createElement(_Button, {
        className: "addTest_notTestButton",
        onClick: handleTestConnect,
        funcType: "raised",
        style: {
          width: 'auto',
          color: '#3F51B5'
        },
        newLine: true
      }, "\u6D4B\u8BD5\u8FDE\u63A5")));
    }

    if (AddTaskFormDataSet.current.get('authType') === 'username') {
      return /*#__PURE__*/React.createElement("div", {
        colSpan: 4,
        newLine: true,
        className: "addTask_testConnect_container",
        style: {
          background: ConnectLoading ? 'rgba(117,137,242,0.06)' : function () {
            if (String(testConnect)) {
              return 'rgba(0,191,165,0.06)';
            }

            return 'white';
          }(),
          flexDirection: !String(testConnect) && !ConnectLoading ? 'row' : 'column',
          textAlign: 'center'
        }
      }, ConnectLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Spin, {
        size: "large"
      }), /*#__PURE__*/React.createElement("p", {
        className: "addTask_testConnect_havnot"
      }, "\u6B63\u5728\u8FDB\u884C\u8FDE\u63A5\u6D4B\u8BD5")) : renderDom());
    }
  };

  var handleAddRepo = function handleAddRepo(data, privateIf) {
    var old = AddTaskFormDataSet.current.get('private');
    var flag = false;

    if (data.length === 0) {
      flag = true;
      var newData = old.filter(function (o) {
        return o !== 'custom';
      });
      AddTaskFormDataSet.current.set('private', newData);
    }

    var data2 = steps.map(function (s) {
      if (s.checked) {
        var newRepo = flag ? undefined : {
          privateRepo: [],
          publicRepo: []
        };
        data.forEach(function (d) {
          if (d.privateIf) {
            newRepo.privateRepo = [].concat(_toConsumableArray(newRepo.privateRepo), [d]);
          } else {
            newRepo.publicRepo = [].concat(_toConsumableArray(newRepo.publicRepo), [d]);
          }
        });
        s.repo = _objectSpread(_objectSpread({}, s.repo), newRepo);
      }

      return s;
    });
    setSteps(data2);
  };

  var handleOpenRepo = function handleOpenRepo() {
    if (AddTaskFormDataSet.current.get('private').includes('copy')) {
      _Modal.confirm({
        title: '切换配置方式',
        children: '确定要切换为"界面可视化定义"的方式吗，切换后，将会清空已有的Setting配置。'
      }).then(function (button) {
        if (button === 'ok') {
          setSteps(steps.map(function (s) {
            if (s.checked) {
              s.mavenSettings = '';
            }

            return s;
          }));
          AddTaskFormDataSet.current.set('private', ['custom']);
          initRepo();
        } else {
          AddTaskFormDataSet.current.set('private', ['copy']);
        }
      });
    } else {
      initRepo();
    }

    function initRepo() {
      _Modal.open({
        key: _Modal.key(),
        title: '配置依赖仓库',
        style: {
          width: 380
        },
        children: /*#__PURE__*/React.createElement(DependRepo, {
          handleParentCancel: handleCancel,
          dsData: steps.find(function (s) {
            return s.checked;
          }).repo,
          handleAdd: handleAddRepo,
          ds: DependRepoDataSet
        }),
        drawer: true,
        okText: '添加'
      });
    }
  };

  var handleCancel = function handleCancel(data) {
    var old = AddTaskFormDataSet.current.get('private');

    if (data.length === 0) {
      var newData = old.filter(function (o) {
        return o !== 'custom';
      });
      AddTaskFormDataSet.current.set('private', newData);
    }
  };

  var handleOpenXML = function handleOpenXML() {
    if (AddTaskFormDataSet.current.get('private').includes('custom')) {
      _Modal.confirm({
        title: '切换配置方式',
        children: '确定要切换为"粘贴XML内容"的方式吗，切换后，将会清空已有的Setting配置。'
      }).then(function (button) {
        if (button === 'ok') {
          setSteps(steps.map(function (s) {
            if (s.checked) {
              s.repo = undefined;
            }

            return s;
          }));
          AddTaskFormDataSet.current.set('private', ['copy']);
          initXml();
        } else {
          AddTaskFormDataSet.current.set('private', ['custom']);
        }
      });
    } else {
      initXml();
    }

    function initXml() {
      var originMavenSetting = steps.find(function (s) {
        return s.checked;
      }).mavenSettings || '';

      _Modal.open({
        key: _Modal.key(),
        title: '配置依赖仓库',
        style: {
          width: 380
        },
        drawer: true,
        children: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "Setting\u6587\u4EF6\u5185\u5BB9"), /*#__PURE__*/React.createElement(YamlEditor, {
          readOnly: false,
          colSpan: 4,
          newLine: true,
          value: steps.length > 0 ? steps.find(function (s) {
            return s.checked;
          }).mavenSettings || '' : '',
          onValueChange: function onValueChange(valueYaml) {
            return setSteps(steps.map(function (s) {
              if (s.checked) {
                s.mavenSettings = valueYaml;
              }

              return s;
            }));
          },
          modeChange: false,
          showError: false
        })),
        onOk: function onOk() {
          if (!steps.find(function (s) {
            return s.checked;
          }).mavenSettings) {
            AddTaskFormDataSet.current.set('private', AddTaskFormDataSet.current.get('private').filter(function (o) {
              return o !== 'copy';
            }));
          }
        },
        onCancel: function onCancel() {
          setSteps(steps.map(function (s) {
            if (s.checked) {
              s.mavenSettings = originMavenSetting;
            }

            return s;
          }));

          if (!steps.find(function (s) {
            return s.checked;
          }).mavenSettings) {
            AddTaskFormDataSet.current.set('private', AddTaskFormDataSet.current.get('private').filter(function (o) {
              return o !== 'copy';
            }));
          }
        }
      });
    }
  };

  var handleChangePrivate = function handleChangePrivate(newV, oldV) {
    newV = newV || [];
    oldV = oldV || [];

    function minus(a, b) {
      return [].concat(_toConsumableArray(a.filter(function (item) {
        return !b.includes(item);
      })), _toConsumableArray(b.filter(function (item) {
        return !a.includes(item);
      })));
    }

    var extra = minus(newV, oldV)[0];

    if (newV.length > oldV.length) {
      // 打钩
      if (extra === 'custom') {
        handleOpenRepo();
      } else {
        handleOpenXML();
      }
    } else if (extra === 'custom') {
      _Modal.confirm({
        title: '清空配置',
        children: '确定清空已有的Setting配置吗?'
      }).then(function (button) {
        if (button === 'ok') {
          setSteps(steps.map(function (s) {
            if (s.checked) {
              s.repo = undefined;
              s.repos = undefined;
            }

            return s;
          }));
        } else {
          AddTaskFormDataSet.current.set('private', extra);
        }
      });
    } else {
      _Modal.confirm({
        title: '清空配置',
        children: '确定清空已有的Setting配置吗?'
      }).then(function (button) {
        if (button === 'ok') {
          setSteps(steps.map(function (s) {
            if (s.checked) {
              s.mavenSettings = '';
            }

            return s;
          }));
        } else {
          AddTaskFormDataSet.current.set('private', ['copy']);
        }
      });
    }
  };

  var renderderBranchs = function renderderBranchs(_ref7) {
    var text = _ref7.text;
    return text === '加载更多' ? /*#__PURE__*/React.createElement("a", {
      style: {
        display: 'block',
        width: '100%',
        height: '100%'
      },
      onClick: function onClick(e) {
        e.preventDefault();
        e.stopPropagation();
        currentSize += 10;
        getBranchsList();
      }
    }, text) : text;
  };

  var getMissionOther = function getMissionOther() {
    if (AddTaskFormDataSet.current.get('type') === 'build') {
      return [/*#__PURE__*/React.createElement("div", {
        colSpan: 4,
        className: "AddTask_configStep",
        style: {
          marginTop: "".concat(expandIf ? '-.3rem' : '0')
        }
      }, /*#__PURE__*/React.createElement("p", null, "\u914D\u7F6E\u6B65\u9AA4")), /*#__PURE__*/React.createElement(_Select, {
        colSpan: 2,
        onChange: handleChangeBuildTemple,
        name: "gjmb"
      }, /*#__PURE__*/React.createElement(Option, {
        value: "Maven"
      }, "Maven\u6A21\u677F"), /*#__PURE__*/React.createElement(Option, {
        value: "npm"
      }, "Npm\u6A21\u677F"), /*#__PURE__*/React.createElement(Option, {
        value: "go"
      }, "Go\u6A21\u677F")), /*#__PURE__*/React.createElement("div", {
        newLine: true,
        colSpan: 4,
        style: {
          display: 'flex',
          flexDirection: 'column'
        },
        className: "AddTask_stepContent"
      }, generateSteps(), steps.length !== 0 ? /*#__PURE__*/React.createElement("div", {
        className: "stepformContent"
      }, /*#__PURE__*/React.createElement(_TextField, {
        onChange: function onChange(value) {
          setSteps(steps.map(function (s) {
            if (s.checked) {
              s.name = value;
            }

            return s;
          }));
        },
        style: {
          width: 312,
          marginTop: 30,
          marginBottom: AddTaskFormDataSet.current.getField('bzmc').isValid() ? 20 : 40,
          marginRight: 8
        },
        name: "bzmc"
      }), function () {
        if (steps.find(function (s) {
          return s.checked;
        })) {
          var _steps$find = steps.find(function (s) {
            return s.checked;
          }),
              type = _steps$find.type;

          var style = {
            width: 339,
            marginTop: 30,
            marginBottom: 20
          };

          if (type === 'Maven') {
            return /*#__PURE__*/React.createElement(_Select, {
              name: "nexusMavenRepoIds",
              style: style,
              renderer: function renderer(_ref8) {
                var text = _ref8.text;
                return /*#__PURE__*/React.createElement(_Tooltip, {
                  title: text
                }, text);
              }
            });
          }

          if (type === 'maven_deploy') {
            style.marginBottom = AddTaskFormDataSet.current.getField('zpk').isValid() ? 20 : 40;
            return /*#__PURE__*/React.createElement(_Select, {
              name: "zpk",
              style: style
            });
          }

          if (type === 'upload_jar') {
            style.marginBottom = AddTaskFormDataSet.current.getField('jar_zpk').isValid() ? 20 : 40;
            return /*#__PURE__*/React.createElement(_Select, {
              name: "jar_zpk",
              style: style
            });
          }
        }
      }()) : null, /*#__PURE__*/React.createElement("div", null, function () {
        if (steps.find(function (s) {
          return s.checked;
        })) {
          var _steps$find2 = steps.find(function (s) {
            return s.checked;
          }),
              type = _steps$find2.type;

          if (type === 'maven_deploy') {
            return /*#__PURE__*/React.createElement("div", {
              style: {
                marginBottom: 20
              }
            }, /*#__PURE__*/React.createElement(_Select, {
              name: "nexusMavenRepoIds",
              style: {
                width: '100%'
              },
              help: "123",
              showHelp: "tooltip",
              renderer: function renderer(_ref9) {
                var text = _ref9.text;
                return /*#__PURE__*/React.createElement(_Tooltip, {
                  title: text
                }, text);
              }
            }));
          }
        }
      }()), steps.find(function (s) {
        return s.checked;
      }) && (steps.find(function (s) {
        return s.checked;
      }).type === 'Maven' || steps.find(function (s) {
        return s.checked;
      }).type === 'maven_deploy') ? [/*#__PURE__*/React.createElement("div", {
        style: {
          marginLeft: '-16px',
          height: '1px',
          width: 'calc(100% + 32px)',
          background: 'var(--divider)'
        }
      }), /*#__PURE__*/React.createElement("div", {
        colSpan: 4,
        newLine: true,
        className: "advanced_text",
        style: {
          cursor: 'pointer',
          // borderTop: '1px solid #d8d8d8',
          paddingTop: '20px'
        },
        onClick: function onClick() {
          return setExpandIfSetting(!expandIfSetting);
        }
      }, "\u9AD8\u7EA7\u8BBE\u7F6E", /*#__PURE__*/React.createElement(_Icon, {
        style: {
          fontSize: 18
        },
        type: expandIfSetting ? 'expand_less' : 'expand_more'
      })), expandIfSetting ? /*#__PURE__*/React.createElement("div", {
        newLine: true
      }, /*#__PURE__*/React.createElement("div", {
        className: "c7ncd-pipeline-add-task-tips"
      }, /*#__PURE__*/React.createElement("span", null, "Setting\u914D\u7F6E"), /*#__PURE__*/React.createElement(_Tooltip, {
        title: "\u7528\u4E8E\u8FD0\u884C\u8FC7\u7A0B\u4E2D\uFF0C\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u751F\u6210settings\u6587\u4EF6\uFF1B\u60A8\u53EF\u5728\u811A\u672C\u4E2D\u52A0\u4E0A -s \u6216\u8005 -gs \u53C2\u6570\u8FDB\u884C\u4F7F\u7528",
        theme: "light"
      }, /*#__PURE__*/React.createElement(_Icon, {
        type: "help"
      }))), /*#__PURE__*/React.createElement(_SelectBox, {
        onChange: handleChangePrivate,
        name: "private",
        style: {
          width: 339
        },
        className: "addTask_authType"
      }, /*#__PURE__*/React.createElement(Option, {
        value: "custom"
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'inline-flex',
          alignItems: 'center'
        }
      }, "\u81EA\u5B9A\u4E49\u4ED3\u5E93\u914D\u7F6E", /*#__PURE__*/React.createElement(_Button, {
        onClick: handleOpenRepo,
        style: {
          marginLeft: 8,
          display: function () {
            var _steps$find3 = steps.find(function (s) {
              return s.checked;
            }),
                repo = _steps$find3.repo,
                repos = _steps$find3.repos;

            if (JSON.stringify(repo) && JSON.stringify(repo) !== '{}' || JSON.stringify(repos) && JSON.stringify(repos) !== '[]') {
              return 'inline-block';
            }

            return 'none';
          }()
        }
      }, /*#__PURE__*/React.createElement(_Icon, {
        style: {
          color: '#3F51B5'
        },
        type: "mode_edit"
      })))), steps.find(function (s) {
        return s.checked;
      }) && steps.find(function (s) {
        return s.checked;
      }).type !== 'maven_deploy' && /*#__PURE__*/React.createElement(Option, {
        value: "copy"
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'inline-flex',
          alignItems: 'center'
        }
      }, "\u7C98\u8D34XML\u5185\u5BB9", /*#__PURE__*/React.createElement(_Button, {
        onClick: handleOpenXML,
        style: {
          marginLeft: 8,
          display: steps.find(function (s) {
            return s.checked;
          }).mavenSettings ? 'inline-block' : 'none'
        }
      }, /*#__PURE__*/React.createElement(_Icon, {
        style: {
          color: '#3F51B5'
        },
        type: "mode_edit"
      })))))) : '', /*#__PURE__*/React.createElement("div", {
        style: {
          height: 20
        }
      })] : '', function () {
        if (steps.length > 0) {
          var _steps$find4;

          var type = steps === null || steps === void 0 ? void 0 : (_steps$find4 = steps.find(function (s) {
            return s.checked;
          })) === null || _steps$find4 === void 0 ? void 0 : _steps$find4.type;

          if (type && ['Maven', 'npm', 'go', 'maven_deploy', 'upload_jar'].includes(type)) {
            return [/*#__PURE__*/React.createElement("div", {
              style: {
                marginLeft: '-16px',
                height: '1px',
                width: 'calc(100% + 32px)',
                background: 'var(--divider)'
              }
            }), /*#__PURE__*/React.createElement("div", {
              style: {
                paddingTop: '20px'
              }
            }, /*#__PURE__*/React.createElement(YamlEditor, {
              readOnly: false,
              colSpan: 4,
              newLine: true,
              value: steps.length > 0 ? steps.find(function (s) {
                return s.checked;
              }).yaml : '',
              onValueChange: function onValueChange(valueYaml) {
                return handleChangeValue(valueYaml);
              },
              modeChange: false,
              showError: false
            }))];
          }

          if (type === 'upload') {
            return [/*#__PURE__*/React.createElement(_TextField, {
              style: {
                width: 314
              },
              addonAfter: /*#__PURE__*/React.createElement(Tips, {
                helpText: "\u6B64\u5904\u5B9A\u4E49\u7684\u8DEF\u5F84\u5C06\u7528\u4E8E\u5B58\u653E\u6784\u5EFA\u6240\u9700\u7684\u5168\u90E8\u5185\u5BB9"
              }),
              name: "uploadFilePattern"
            }), /*#__PURE__*/React.createElement(_TextField, {
              style: {
                width: 339,
                marginTop: 20,
                marginBottom: 20
              },
              name: "uploadArtifactFileName"
            })];
          }

          if (type === 'docker') {
            return [/*#__PURE__*/React.createElement("div", {
              style: {
                marginBottom: 20,
                display: 'flex',
                alignItems: 'flex-start'
              }
            }, /*#__PURE__*/React.createElement("div", {
              style: {
                width: 326
              }
            }, /*#__PURE__*/React.createElement(_TextField, {
              style: {
                width: 312
              },
              name: "dockerFilePath",
              addonAfter: /*#__PURE__*/React.createElement(Tips, {
                helpText: "Dockerfile\u8DEF\u5F84\u4E3ADockerfile\u6587\u4EF6\u76F8\u5BF9\u4E8E\u4EE3\u7801\u5E93\u6839\u76EE\u5F55\u6240\u5728\u8DEF\u5F84\uFF0C\u5982docker/Dockerfile\u6216Dockerfile"
              })
            })), /*#__PURE__*/React.createElement("div", {
              style: {
                width: 326
              }
            }, /*#__PURE__*/React.createElement(_TextField, {
              className: "dockerContextDir",
              style: {
                width: 312
              },
              name: "dockerContextDir",
              addonAfter: /*#__PURE__*/React.createElement(Tips, {
                helpText: "ContextPath\u4E3Adocker build\u547D\u4EE4\u6267\u884C\u4E0A\u4E0B\u6587\u8DEF\u5F84\u3002\u586B\u5199\u76F8\u5BF9\u4E8E\u4EE3\u7801\u6839\u76EE\u5F55\u7684\u8DEF\u5F84\uFF0C\u5982docker"
              }),
              onFocus: function onFocus() {
                var res;
                var value = AddTaskFormDataSet.current.get('dockerFilePath');
                var arrValue = value.split('');

                var lastIndex = _.findLastIndex(arrValue, function (o) {
                  return o === '/';
                });

                if (lastIndex !== -1) {
                  res = arrValue.slice(0, lastIndex).join('');
                } else {
                  res = '.';
                }

                AddTaskFormDataSet.current.set('dockerContextDir', res);
              }
            }))), /*#__PURE__*/React.createElement("div", {
              style: {
                position: 'relative',
                marginBottom: 20
              }
            }, /*#__PURE__*/React.createElement(_SelectBox, {
              style: {
                marginTop: 20,
                width: 300
              },
              name: "skipDockerTlsVerify"
            }, /*#__PURE__*/React.createElement(Option, {
              value: true
            }, "\u662F"), /*#__PURE__*/React.createElement(Option, {
              value: false
            }, "\u5426")), /*#__PURE__*/React.createElement(_Tooltip, {
              title: "\u662F\u5426\u5BF9harbor\u57DF\u540D\u8FDB\u884C\u8BC1\u4E66\u6821\u9A8C"
            }, /*#__PURE__*/React.createElement(_Icon, {
              type: "help",
              className: "c7ncd-select-tips-icon",
              style: {
                position: 'absolute',
                top: '27px',
                left: '100px'
              }
            })), /*#__PURE__*/React.createElement(_SelectBox, {
              name: "imageScan",
              style: {
                width: 300
              } // className="c7ncd-addTask-imageScan"

            }, /*#__PURE__*/React.createElement(Option, {
              value: true
            }, "\u662F"), /*#__PURE__*/React.createElement(Option, {
              value: false
            }, "\u5426")), /*#__PURE__*/React.createElement(_Tooltip, {
              title: /*#__PURE__*/React.createElement("span", null, "\u5F00\u542F\u955C\u50CF\u5B89\u5168\u626B\u63CF\u540E\uFF0C\u6B64\u6B65\u9AA4\u4E2D\u751F\u6210\u7684\u955C\u50CF\u5C06\u4F1A\u901A\u8FC7Trivy\u8FDB\u884C\u6F0F\u6D1E\u626B\u63CF\uFF0C\u5E76\u5728\u8BB0\u5F55\u4E2D\u751F\u6210\u62A5\u544A\uFF1B")
            }, /*#__PURE__*/React.createElement(_Icon, {
              type: "help",
              className: "c7ncd-select-tips-icon",
              style: {
                position: 'absolute',
                top: '27px',
                right: '215px'
              }
            }))), /*#__PURE__*/React.createElement("div", {
              style: {
                marginBottom: 20,
                display: AddTaskFormDataSet.current.get('imageScan') ? 'block' : 'none',
                position: 'relative'
              }
            }, /*#__PURE__*/React.createElement(_SelectBox, {
              name: "securityControl",
              style: {
                width: 312
              }
            }), /*#__PURE__*/React.createElement(_Tooltip, {
              title: /*#__PURE__*/React.createElement("span", null, "\u5F00\u542F\u955C\u50CF\u53D1\u5E03\u95E8\u7981\u540E\uFF0C\u82E5\u8BE5\u6B65\u9AA4\u4E2D\u751F\u6210\u7684\u955C\u50CF\u626B\u63CF\u540E\u7684\u7ED3\u679C\u4E0D\u6EE1\u8DB3\u95E8\u7981\u6761\u4EF6\uFF0C\u90A3\u4E48\u8BE5\u955C\u50CF\u5C06\u4E0D\u4F1A\u88AB\u63A8\u9001\u5230\u955C\u50CF\u4ED3\u5E93\u3002\u540C\u65F6\u8BE5\u6784\u5EFA\u4EFB\u52A1\u4E5F\u4F1A\u88AB\u7F6E\u4E3A\u5931\u8D25\u72B6\u6001\u3002")
            }, /*#__PURE__*/React.createElement(_Icon, {
              type: "help",
              className: "c7ncd-select-tips-icon",
              style: {
                position: 'absolute',
                top: '8px',
                left: '123px'
              }
            }))), /*#__PURE__*/React.createElement("div", {
              style: {
                marginBottom: 20,
                display: AddTaskFormDataSet.current.get('securityControl') && AddTaskFormDataSet.current.get('imageScan') ? 'block' : 'none'
              }
            }, /*#__PURE__*/React.createElement("p", {
              style: {
                color: 'rgba(0, 0, 0, 0.6)',
                fontWeight: 500
              }
            }, "\u95E8\u7981\u9650\u5236", /*#__PURE__*/React.createElement(_Tooltip, {
              title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, "\u95E8\u7981\u9650\u5236\u53EF\u9009\u62E9\u6F0F\u6D1E\u7684\u4E25\u91CD\u5EA6\u4E0E\u6F0F\u6D1E\u6570\u91CF\u4F5C\u4E3A\u57FA\u51C6\u3002\u4E14\u53EA\u6709\u6EE1\u8DB3\u9650\u5236\u65F6\uFF0C\u624D\u53EF\u901A\u8FC7\u8BBE\u7F6E\u7684\u95E8\u7981\u3002"), /*#__PURE__*/React.createElement("p", null, "\u82E5\u955C\u50CF\u6F0F\u6D1E\u626B\u63CF\u7684\u7ED3\u679C\u4E2D\u5B58\u5728\u6F0F\u6D1E\u4E25\u91CD\u5EA6\u6BD4\u9650\u5236\u4E2D\u8BBE\u7F6E\u7684\u4E25\u91CD\u5EA6\u5C42\u7EA7\u66F4\u9AD8\uFF08\u4E25\u91CD\u5EA6\u5C42\u7EA7\u7531\u9AD8\u81F3\u4F4E\uFF1A\u5371\u6025>\u4E25\u91CD>\u4E2D\u7B49>\u8F83\u4F4E\uFF09\u6216\u8005\u540C\u5C42\u7EA7\u4E25\u91CD\u5EA6\u7684\u6F0F\u6D1E\u6570\u91CF\u8D85\u8FC7\u4E86\u8BBE\u7F6E\u7684\u6570\u91CF\u65F6\uFF0C\u8BE5\u955C\u50CF\u5747\u89C6\u4F5C\u4E0D\u6EE1\u8DB3\u95E8\u7981\u9650\u5236\u800C\u4E0D\u4F1A\u88AB\u63A8\u9001\u81F3\u955C\u50CF\u4ED3\u5E93\u3002"))
            }, /*#__PURE__*/React.createElement(_Icon, {
              style: {
                position: 'relative',
                bottom: '2px'
              },
              type: "help",
              className: "c7ncd-select-tips-icon"
            }))), /*#__PURE__*/React.createElement("div", {
              style: {
                width: 468,
                display: 'flex',
                alignItems: 'flex-start',
                justifyContent: 'space-between'
              }
            }, /*#__PURE__*/React.createElement("div", {
              style: {
                width: '33%'
              }
            }, /*#__PURE__*/React.createElement(_Select, {
              name: "level"
            })), /*#__PURE__*/React.createElement("div", {
              style: {
                width: '33%'
              }
            }, /*#__PURE__*/React.createElement(_Select, {
              name: "symbol"
            })), /*#__PURE__*/React.createElement("div", {
              style: {
                width: '33%'
              }
            }, /*#__PURE__*/React.createElement(_NumberField, {
              min: 0,
              name: "condition",
              step: 1
            }))))];
          }
        }

        return '';
      }())];
    }

    var extra;

    if (AddTaskFormDataSet.current.get('authType') === 'username') {
      extra = [/*#__PURE__*/React.createElement(_TextField, {
        newLine: true,
        name: "username",
        colSpan: 2
      }), /*#__PURE__*/React.createElement(_Password, {
        name: "password",
        colSpan: 2
      }), /*#__PURE__*/React.createElement(_TextField, {
        name: "sonarUrl",
        colSpan: 2
      })];
    } else {
      extra = [/*#__PURE__*/React.createElement(_TextField, {
        newLine: true,
        name: "token"
      }), /*#__PURE__*/React.createElement(_TextField, {
        name: "sonarUrl"
      })];
    }

    return [/*#__PURE__*/React.createElement("p", {
      className: "c7ncd-sonarqube-title",
      colSpan: 4,
      newLine: true
    }, "SonarQube"), /*#__PURE__*/React.createElement(_Select, {
      name: "scannerType",
      colSpan: 2,
      addonAfter: /*#__PURE__*/React.createElement(Tips, {
        helpText: "SonarMaven: \u7528\u4E8E\u626B\u63CFMaven\u9879\u76EE\u7684\u7279\u5B9A\u626B\u63CF\u5668 SonarScanner: \u5BF9\u4E8E\u6CA1\u6709\u7279\u5B9A\u626B\u63CF\u5668\u7684\u9879\u76EE\uFF0C\u53EF\u4EE5\u4F7F\u7528SonarScanner\u626B\u63CF"
      })
    }, /*#__PURE__*/React.createElement(Option, {
      value: "SonarScanner"
    }, "SonarScanner"), /*#__PURE__*/React.createElement(Option, {
      value: "SonarMaven"
    }, "SonarMaven")), function () {
      var record = AddTaskFormDataSet.current;

      if (record.get('scannerType') === 'SonarScanner') {
        return /*#__PURE__*/React.createElement(_TextField, {
          name: "sources",
          colSpan: 2,
          addonAfter: /*#__PURE__*/React.createElement(Tips, {
            helpText: "\u6B64\u5904\u6307\u7684\u662F\u9879\u76EE\u4E0B\u7684\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u6BD4\u5982'src'\u3002\u591A\u4E2A\u8DEF\u5F84\u4F7F\u7528','\u9694\u5F00"
          })
        });
      }

      if (record.get('scannerType') === 'SonarMaven') {
        return /*#__PURE__*/React.createElement(_SelectBox, {
          name: "skipTests",
          colSpan: 2
        }, /*#__PURE__*/React.createElement(Option, {
          value: false
        }, "\u662F"), /*#__PURE__*/React.createElement(Option, {
          value: true
        }, "\u5426"));
      }

      return /*#__PURE__*/React.createElement("div", {
        colSpan: 2
      });
    }(), /*#__PURE__*/React.createElement(_SelectBox, {
      className: "addTask_authType",
      name: "configType",
      colSpan: 2,
      addonAfter: /*#__PURE__*/React.createElement(Tips, {
        helpText: !useStore.getHasDefaultSonar ? '平台暂无默认的SonarQube配置，请在自定义配置中进行添加。' : ''
      })
    }, /*#__PURE__*/React.createElement(Option, {
      value: "default"
    }, "\u9ED8\u8BA4\u914D\u7F6E"), /*#__PURE__*/React.createElement(Option, {
      value: "custom"
    }, "\u81EA\u5B9A\u4E49\u914D\u7F6E")), AddTaskFormDataSet.current.get('configType') === 'custom' ? [/*#__PURE__*/React.createElement(_SelectBox, {
      className: "addTask_authType",
      name: "authType",
      colSpan: 2
    }, /*#__PURE__*/React.createElement(Option, {
      value: "username"
    }, "\u7528\u6237\u540D\u4E0E\u5BC6\u7801"), /*#__PURE__*/React.createElement(Option, {
      value: "token"
    }, "Token"))].concat(_toConsumableArray(extra), [renderTestConnect()]) : ''];
  };

  var handleChangeImage = function handleChangeImage(data) {
    if (data === defaultImage) {
      AddTaskFormDataSet.current.set('selectImage', '0');
    } else {
      AddTaskFormDataSet.current.set('selectImage', '1');
    }
  };

  var getImageDom = function getImageDom() {
    return [/*#__PURE__*/React.createElement("div", {
      colSpan: 4,
      newLine: true,
      className: "advanced_text border-advanced ".concat(!expandIf && 'border-advanced-after'),
      style: {
        cursor: 'pointer',
        marginBottom: '-17px'
      },
      onClick: function onClick() {
        return setExpandIf(!expandIf);
      }
    }, "\u9AD8\u7EA7\u8BBE\u7F6E", /*#__PURE__*/React.createElement(_Icon, {
      style: {
        fontSize: 18
      },
      type: expandIf ? 'expand_less' : 'expand_more'
    })), expandIf ? /*#__PURE__*/React.createElement("div", {
      className: ['chart', 'sonar'].includes(AddTaskFormDataSet.current.get('type')) && 'border-advanced-after',
      newLine: true,
      colSpan: 4,
      style: {
        marginTop: '-19px',
        paddingTop: 0
      }
    }, /*#__PURE__*/React.createElement(_Select, {
      addonAfter: /*#__PURE__*/React.createElement(Tips, {
        helpText: "CI\u4EFB\u52A1Runner\u955C\u50CF\u662F\u8BE5CI\u4EFB\u52A1\u7684\u6267\u884C\u73AF\u5883\u3002\u60A8\u53EF\u76F4\u63A5\u4F7F\u7528\u6B64\u5904\u7ED9\u51FA\u7684\u9ED8\u8BA4Runner\u955C\u50CF\uFF0C\u6216\u662F\u8F93\u5165\u81EA\u5B9A\u4E49\u7684CI\u4EFB\u52A1Runner\u955C\u50CF"
      }),
      onChange: handleChangeImage,
      combo: true,
      colSpan: 4,
      name: "image"
    }, /*#__PURE__*/React.createElement(Option, {
      value: defaultImage
    }, "".concat(defaultImage).concat(defaultImage === useStore.getDefaultImage ? '(默认)' : '')))) : ''];
  };

  var getShareSettings = function getShareSettings() {
    return expandIf && AddTaskFormDataSet.current.get('type') === 'build' ? [/*#__PURE__*/React.createElement("div", {
      className: "border-advanced-after",
      newLine: true,
      colSpan: 4,
      style: {
        marginTop: '-19px'
      }
    }, /*#__PURE__*/React.createElement(Tips, {
      title: formatMessage({
        id: 'c7ncd.pipelineManage.create.share.title'
      }),
      helpText: formatMessage({
        id: 'c7ncd.pipelineManage.create.share.tips'
      }),
      newLine: true
    }), /*#__PURE__*/React.createElement(_SelectBox, {
      name: "share",
      newLine: true,
      colSpan: 4
    }, /*#__PURE__*/React.createElement(Option, {
      value: "toUpload"
    }, "\u4E0A\u4F20\u5171\u4EAB\u76EE\u5F55choerodon-ci-cache"), /*#__PURE__*/React.createElement(Option, {
      value: "toDownload"
    }, "\u4E0B\u8F7D\u5171\u4EAB\u76EE\u5F55choerodon-ci-cache")))] : null;
  };

  function renderTriggerTypeTips() {
    var type = AddTaskFormDataSet.current.get('triggerType');

    switch (type) {
      case 'refs':
        return '您可在此选择或输入触发该任务的分支类型；支持多填多选；若不填写，则默认为所有分支和tag';

      case 'exact_match':
        return '您可在此精确选择或输入触发该任务的具体分支名称；支持多填多选；若不填写，则默认为所有分支和tag';

      default:
        return '您可在此选择或输入某几个具体的分支名称以此来精确排除；此处支持多填多选；若不填写，则默认为没有需要排除的分支或tag';
    }
  }

  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
    className: "addTaskForm",
    dataSet: AddTaskFormDataSet,
    columns: 4
  }, /*#__PURE__*/React.createElement(_Select, {
    name: "type",
    colSpan: 1
  }, /*#__PURE__*/React.createElement(Option, {
    value: "build"
  }, "\u6784\u5EFA"), /*#__PURE__*/React.createElement(Option, {
    value: "sonar"
  }, "\u4EE3\u7801\u68C0\u67E5"), /*#__PURE__*/React.createElement(Option, {
    value: "custom"
  }, "\u81EA\u5B9A\u4E49"), /*#__PURE__*/React.createElement(Option, {
    value: "chart"
  }, "\u53D1\u5E03Chart")), AddTaskFormDataSet.current.get('type') !== 'custom' ? [/*#__PURE__*/React.createElement(_TextField, {
    name: "name",
    colSpan: 3
  }), /*#__PURE__*/React.createElement(_TextField, {
    name: "glyyfw",
    colSpan: 1
  }), /*#__PURE__*/React.createElement("div", {
    className: "matchType",
    style: {
      display: 'inline-flex',
      position: 'relative'
    },
    colSpan: 3
  }, /*#__PURE__*/React.createElement(_Select, {
    onChange: function onChange(value) {
      AddTaskFormDataSet.current.set('triggerValue', undefined);
    },
    combo: false,
    style: {
      marginRight: 8
    },
    name: "triggerType",
    allowClear: false,
    clearButton: false
  }, /*#__PURE__*/React.createElement(Option, {
    value: "refs"
  }, "\u5206\u652F\u7C7B\u578B\u5339\u914D"), /*#__PURE__*/React.createElement(Option, {
    value: "regex"
  }, "\u6B63\u5219\u5339\u914D"), /*#__PURE__*/React.createElement(Option, {
    value: "exact_match"
  }, "\u7CBE\u786E\u5339\u914D"), /*#__PURE__*/React.createElement(Option, {
    value: "exact_exclude"
  }, "\u7CBE\u786E\u6392\u9664")), AddTaskFormDataSet.current.get('triggerType') === 'regex' ? /*#__PURE__*/React.createElement(_TextField, {
    name: "triggerValue",
    addonAfter: /*#__PURE__*/React.createElement(Tips, {
      helpText: "\u60A8\u53EF\u5728\u6B64\u8F93\u5165\u6B63\u5219\u8868\u8FBE\u5F0F\u6765\u914D\u7F6E\u89E6\u53D1\u5206\u652F\uFF1B\u4F8B\uFF1A\u82E5\u60F3\u5339\u914D\u4EE5 feature \u5F00\u5934\u7684\u5206\u652F\uFF0C\u53EF\u4EE5\u8F93\u5165 ^feature.*\u3002\u66F4\u591A\u8868\u8FBE\u5F0F\uFF0C\u8BE6\u89C1\u7528\u6237\u624B\u518C\u3002\u82E5\u4E0D\u586B\u5199\uFF0C\u5219\u9ED8\u8BA4\u4E3A\u6240\u6709\u5206\u652F\u548Ctag"
    })
  }) : /*#__PURE__*/React.createElement(_Select, {
    combo: true,
    searchable: true,
    multiple: true,
    name: "triggerValue",
    addonAfter: /*#__PURE__*/React.createElement(Tips, {
      helpText: renderTriggerTypeTips()
    }),
    searchMatcher: "branchName",
    optionRenderer: function optionRenderer(_ref10) {
      var text = _ref10.text;
      return renderderBranchs({
        text: text
      });
    },
    maxTagCount: 3,
    maxTagPlaceholder: function maxTagPlaceholder(omittedValues) {
      return /*#__PURE__*/React.createElement(_Tooltip, {
        title: omittedValues.join(',')
      }, "+".concat(omittedValues.length));
    },
    className: "addTaskForm-select",
    renderer: renderderBranchs,
    colSpan: 2
  }, branchsList.map(function (b) {
    return /*#__PURE__*/React.createElement(Option, {
      value: b.value
    }, b.name);
  }))), getImageDom(), getShareSettings(), AddTaskFormDataSet.current.get('type') !== 'chart' ? getMissionOther() : ''] : [/*#__PURE__*/React.createElement(YamlEditor, {
    readOnly: false,
    colSpan: 4,
    newLine: true,
    value: customYaml,
    onValueChange: function onValueChange(valueYaml) {
      return setCustomYaml(valueYaml);
    },
    modeChange: false,
    showError: false
  })]));
});
export default AddTask;