"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _vmInfoCollection = _interopRequireDefault(require("../../../vm-info-collection"));
var _components = require("../../../vtx-default-modal/components");
var _Rules = _interopRequireDefault(require("./Rules"));
var _TodayWork = _interopRequireDefault(require("./TodayWork"));
require("./index.less");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
var BaseInfo = function BaseInfo(props) {
  var _a, _b, _c, _d;
  var id = props.id,
    data = props.data,
    jcssInfo = props.jcssInfo,
    _props$hasRule = props.hasRule,
    hasRule = _props$hasRule === void 0 ? false : _props$hasRule,
    service = props.service,
    setIframeModalInfo = props.setIframeModalInfo,
    customMapInfo = props.customMapInfo;
  var _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme,
    mapInfo = _useSettings.mapInfo;
  var coordinate = (mapInfo === null || mapInfo === void 0 ? void 0 : mapInfo.coordinate) || 'bd09';
  //基础设施配置字段
  var info = data.info,
    baseInfo = data.baseInfo,
    rules = data.rules,
    todayWorkRes = data.todayWorkRes;
  var rings = ((_a = info === null || info === void 0 ? void 0 : info.lngLats) === null || _a === void 0 ? void 0 : _a[coordinate]) || ((_b = jcssInfo === null || jcssInfo === void 0 ? void 0 : jcssInfo.geometryInfo) === null || _b === void 0 ? void 0 : _b.lngLats) || '';
  var dataRings = rings && ((_d = (_c = rings === null || rings === void 0 ? void 0 : rings.split(';')) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.split(','));
  var _ref = (dataRings === null || dataRings === void 0 ? void 0 : dataRings.length) > 0 ? dataRings : (mapInfo === null || mapInfo === void 0 ? void 0 : mapInfo.longitude) && [mapInfo === null || mapInfo === void 0 ? void 0 : mapInfo.longitude, mapInfo === null || mapInfo === void 0 ? void 0 : mapInfo.latitude] || [],
    _ref2 = _slicedToArray(_ref, 2),
    lng = _ref2[0],
    lat = _ref2[1];
  return hasRule ? (/*#__PURE__*/_react["default"].createElement("div", {
    className: "road-baseContent ".concat(theme)
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-left"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-left-top"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u57FA\u672C\u4FE1\u606F"
  }), /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: baseInfo,
    horizontal: true,
    ellipsis: true,
    width: "49%",
    gap: 24
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-left-bottom"
  }, /*#__PURE__*/_react["default"].createElement(_Rules["default"], {
    rules: rules
  }))), /*#__PURE__*/_react["default"].createElement(_TodayWork["default"], {
    data: todayWorkRes,
    id: id,
    service: service,
    setIframeModalInfo: setIframeModalInfo
  }))) : (/*#__PURE__*/_react["default"].createElement(_components.BaseInfo, {
    id: id,
    info: jcssInfo,
    data: [],
    geometryType: 'polyline',
    customMapInfo: customMapInfo,
    mapCenter: lng && lat ? [Number(lng), Number(lat)] : [],
    lineLayer: {
      id: 'roadLine',
      rings: rings,
      config: {}
    }
  }));
};
var _default = exports["default"] = BaseInfo;
//# sourceMappingURL=index.js.map
