"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transformConfig = exports.GROUP = exports.ANALYSIS = void 0;
var _lodash = _interopRequireDefault(require("lodash"));
var _chart = _interopRequireDefault(require("../assets/chart.png"));
var _prediction = _interopRequireDefault(require("../assets/prediction.png"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, 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); } // 分组
var GROUP = exports.GROUP = {
  INTELLIGENCE_ANALYSIS: {
    label: '智能分析',
    id: 'INTELLIGENCE_ANALYSIS',
    icon: _chart["default"]
  },
  INTELLIGENCE_PREDICTION: {
    label: '智能预测',
    id: 'INTELLIGENCE_PREDICTION',
    icon: _prediction["default"]
  },
  BASE_ANALYSIS: {
    label: '基础分析',
    id: 'BASE_ANALYSIS',
    icon: _chart["default"]
  },
  STRUCTURE_ANALYSIS: {
    label: '结构分析',
    id: 'STRUCTURE_ANALYSIS',
    icon: _chart["default"],
    children: []
  }
};

// 分析
var ANALYSIS = exports.ANALYSIS = {
  BUFFER_AREA: {
    label: '缓冲区分析',
    icon: '',
    group: 'BASE_ANALYSIS',
    V1: 'BufferAnalysis'
  },
  CONNECTIVITY: {
    label: '连通性分析',
    icon: '',
    group: 'BASE_ANALYSIS',
    V1: 'ConnectivityAnalysis'
  },
  FLOW_DIRECTION: {
    label: '流向分析',
    icon: '',
    group: 'BASE_ANALYSIS',
    V1: 'FlowDirectionAnalysis'
  },
  CROSS_SECTION: {
    label: '横截面分析',
    icon: '',
    group: 'BASE_ANALYSIS',
    V1: 'CrossSectionAnalysis'
  },
  LONGITUDINAL_SECTION: {
    label: '纵截面分析',
    icon: '',
    group: 'BASE_ANALYSIS',
    V1: 'ProfileAnalysis'
  },
  ISOLATE_AREA: {
    label: '孤立区域',
    icon: '',
    group: 'STRUCTURE_ANALYSIS',
    V1: 'IsolatedRegionDiagnosis'
  },
  RING_PIPE_NETWORK: {
    label: '环状管网',
    icon: '',
    group: 'STRUCTURE_ANALYSIS',
    V1: 'RingNetworkDiagnosis'
  },
  ABNORMAL_FLOW: {
    label: '流向异常',
    icon: '',
    group: 'STRUCTURE_ANALYSIS',
    V1: 'FlowAnomalyDiagnosis'
  },
  INVERSE_SLOPE: {
    label: '逆坡分析',
    icon: '',
    group: 'STRUCTURE_ANALYSIS',
    V1: 'InverseSlopeDiagnosis'
  },
  LARGE_TUBE: {
    label: '大管套小管',
    icon: '',
    group: 'STRUCTURE_ANALYSIS',
    V1: 'MacrotubuleDiagnosis'
  },
  DETONATION_POINT: {
    label: '爆管关阀分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'BlowoutValveClosingAnalysis'
  },
  DETONATION_RANGE: {
    label: '爆管范围分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: ''
  },
  FIRE_HYDRANT: {
    label: '消防栓分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'HydrantAnalysis'
  },
  LARGE_DIAMETER: {
    label: '大口径分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'LargeDiameterAnalysis'
  },
  SUPPLY_POLLUTION_SOURCE: {
    label: '污染源分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'PollutionSourceAnalysis'
  },
  DRAINAGE_POLLUTION_SOURCE: {
    label: '管网污染溯源',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'DrainagePollutionSource'
  },
  RIVER_POLLUTION_SOURCE: {
    label: '污染源分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: ''
  },
  INFLOW_INFILTRATION: {
    label: '入流入渗',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'InflowInfiltration',
    V2: 'InflowInfiltrationAnalysis'
  },
  RAIN_SEWAGE_MIXED: {
    label: '雨污混接',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'RainSewageMixedAnalysis'
  },
  SEDIMENTATION_RISK: {
    label: '淤积风险',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'SedimentationRisk',
    V2: 'SedimentationAnalysis'
  },
  CONTAMINATION_RANGE: {
    label: '纳污范围分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'ContaminationRangeAnalysis'
  },
  SOIL_COVER: {
    label: '覆土分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'SoilCoverAnalysis'
  },
  COLLISION: {
    label: '碰撞分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'CollisionAnalysis'
  },
  CLEAR_DISTANCE: {
    label: '净距分析',
    icon: '',
    group: 'CLEAR_DISTANCE_ANALYSIS',
    V1: 'CollisionAnalysis'
  },
  TRACKING: {
    label: '追踪分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'TrackingAnalysis'
  },
  SHORTEST_PATH: {
    label: '最短路径',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'ShortestPath'
  },
  INTERSECTION_QUERY: {
    label: '交叉口查询',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'IntersectionQuery'
  },
  Road_Query: {
    label: '道路查询',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'RoadQuery'
  },
  AGE_WARNING: {
    label: '年限预警',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'AgeWarning'
  },
  FACILITY_SEARCH: {
    label: '设施搜索',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'FacilitySearch'
  },
  ATTRIBUTE_QUERY: {
    label: '属性查询',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'AttributeQuery'
  },
  PIPELINE_NETWORK_STATISTICS: {
    label: '管网统计',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'PipelineNetworkStatistics'
  },
  SUNNY_RAIN_RATIO: {
    label: '晴雨比分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'SunnyRainRatio',
    V2: 'SunnyRainRatioTwo'
  },
  SEWAGE_NETWORK_COVERAGE: {
    label: '污水管网覆盖率',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'SewageNetworkCoverage'
  },
  FILLING_DEGREE: {
    label: '管网充溢度分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'FillingDegreeAnalysis'
  },
  WATER_BALANCE: {
    label: '水平衡分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'WaterBalanceAnalysis'
  },
  SEWAGE_COLLECTION_RATE: {
    label: '污水收集率分析',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'SewageCollectionRateAnalysis'
  },
  PIPELINE_NETWORK_BLOCKING: {
    label: '管网阻塞分析（基于泵站）',
    icon: '',
    group: 'INTELLIGENCE_ANALYSIS',
    V1: 'PipelineNetworkBlockingAnalysis'
  },
  PREDICT_WATER_QUALITY: {
    label: '水质预测',
    icon: '',
    group: 'INTELLIGENCE_PREDICTION',
    V1: 'WaterQualityPrediction'
  }
};
var transformConfig = exports.transformConfig = function transformConfig(config) {
  var types = config.types;
  var data = [];
  if (types !== null && types !== void 0 && types.length) {
    _lodash["default"].orderBy(types, 'orderNum', 'desc').map(function (v) {
      var typeCode = v.typeCode,
        version = v.version;
      var item = ANALYSIS[typeCode];
      if (item !== null && item !== void 0 && item[version]) {
        var group = item.group;
        var index = data.findIndex(function (v) {
          return v.id === group;
        });
        var newItem = _objectSpread(_objectSpread(_objectSpread({}, item), v), {}, {
          key: item[version]
        });
        if (index !== -1) {
          data[index].children.push(newItem);
        } else {
          var groupItem = GROUP[group];
          groupItem.children = [newItem];
          data.push(groupItem);
        }
      }
    });
  }
  return data;
};
//# sourceMappingURL=transform.js.map
