"use strict";

exports.__esModule = true;
exports.sizeSchema = void 0;
var _react = _interopRequireDefault(require("react"));
var _sequenceUtils = require("@teselagen/sequence-utils");
var _rangeUtils = require("@teselagen/range-utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var sizeSchema = {
  path: "size",
  displayName: "尺寸",
  type: "number",
  render: function render(val, _record, i, props) {
    var record = props.isProtein ? (0, _sequenceUtils.convertDnaCaretPositionOrRangeToAA)(_record) : _record;
    var base1Range = (0, _rangeUtils.convertRangeTo1Based)(record);
    var hasJoinedLocations = record.locations && record.locations.length > 1;
    return /*#__PURE__*/_react["default"].createElement("span", null, props.isProtein ? Math.floor(val / 3) : val, " ", /*#__PURE__*/_react["default"].createElement("span", {
      style: {
        fontSize: 10
      }
    }, hasJoinedLocations ? record.locations.map(function (loc, i) {
      var base1Range = (0, _rangeUtils.convertRangeTo1Based)(loc);
      return /*#__PURE__*/_react["default"].createElement("span", {
        key: i
      }, "(", base1Range.start, "-", base1Range.end, ")");
    }) : /*#__PURE__*/_react["default"].createElement("span", null, "(", base1Range.start, "-", base1Range.end, ")")));
  }
};
exports.sizeSchema = sizeSchema;