import { _ as _extends } from '../_rollupPluginBabelHelpers-736b301a.js';
import React__default, { useMemo } from 'react';
import { formatTimeStamp } from '@zenview/micro-utils';
import CaptureBox from '../CaptureCard/index.js';
import IconFont from '../IconFont/index.js';
import '../index-07cebbd5.js';
import '../ImageView/index.js';
import '../ToolsBar/index.js';
import '../AuthComponent/index.js';
import '@zenview/micro-basic-library';
import 'antd';
import 'lodash';
import '../index-19c4ec5b.js';
import 'react-router-dom';

const plateColorClass = [{
  code: '117751',
  label: '黑色',
  className: 'plate-black'
}, {
  code: '117752',
  label: '白色',
  className: 'plate-white'
}, {
  code: '117753',
  label: '黄色',
  className: 'plate-yellow'
}, {
  code: '117754',
  label: '蓝色',
  className: 'plate-blue'
}, {
  code: '117755',
  label: '绿色',
  className: 'plate-green'
}, {
  code: '117756',
  label: '黄绿色',
  className: 'plate-yellow-green'
}, {
  code: '117757',
  label: '未知',
  className: 'plate-other'
}, {
  code: '117758',
  label: '渐变绿',
  className: 'plate-gree-white'
}];
function VehiclelibCard({
  dictMap,
  type = 'vehicle',
  ...data
}) {
  const {
    deviceName,
    captureTime,
    plateNo,
    tags
  } = useMemo(() => data, [data]);
  let newplateNo = '-';
  let platenoclassName = 'no-plate';
  if (type === 'vehicle') {
    const plateColor = dictMap[117750] || [];
    if (plateNo && plateNo.length > 1) {
      platenoclassName = 'plate-other';
      let prefix = plateNo.substring(0, 2);
      let suffix = plateNo.substring(2, plateNo.length);
      newplateNo = `${prefix}·${suffix}`;
    }
    if (tags) {
      let plateItem = tags.find(tag => plateColor.find(x => x.value === tag));
      if (plateItem) {
        platenoclassName = (plateColorClass.find(x => x.code === plateItem) || {}).className;
      }
    }
  }
  return /*#__PURE__*/React__default.createElement(CaptureBox, _extends({
    className: 'vehiclelib-card-item-box'
  }, data), type === 'vehicle' && /*#__PURE__*/React__default.createElement("div", {
    className: `card-info-item plate-no ${platenoclassName}`
  }, /*#__PURE__*/React__default.createElement("span", null, newplateNo)), /*#__PURE__*/React__default.createElement("div", {
    className: "card-info-item"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_Bar_Add"
  }), /*#__PURE__*/React__default.createElement("span", null, deviceName)), /*#__PURE__*/React__default.createElement("div", {
    className: "card-info-item"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_Edit_ClockStart"
  }), /*#__PURE__*/React__default.createElement("span", null, formatTimeStamp(captureTime))));
}

export { VehiclelibCard as default };
//# sourceMappingURL=index.js.map
