function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

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; }

import React, { Component, PureComponent } from 'react';

var PerDayLeftNav =
/*#__PURE__*/
function (_ref) {
  _inherits(PerDayLeftNav, _ref);

  function PerDayLeftNav() {
    var _getPrototypeOf2;

    var _this;

    _classCallCheck(this, PerDayLeftNav);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(PerDayLeftNav)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _defineProperty(_assertThisInitialized(_this), "state", {
      navContent: []
    });

    _defineProperty(_assertThisInitialized(_this), "getHtml", function () {
      var rentalType = window.$$RESOURCECONTEXT.rentalType;
      var navContent = _this.state.navContent;
      var _this$props$halfDayTi = _this.props.halfDayTimeIntervals,
          halfDayTimeIntervals = _this$props$halfDayTi === void 0 ? [] : _this$props$halfDayTi;
      var windowWidth = window.innerWidth;
      var dateStyle = halfDayTimeIntervals.length < 3 ? {
        height: '1.77rem',
        "float": 'left',
        borderBottom: '0.01rem solid #e0e0e0'
      } : {
        height: '2.66rem',
        "float": 'left',
        borderBottom: '0.01rem solid #e0e0e0'
      };
      var dateStyle1 = halfDayTimeIntervals.length < 3 ? {
        height: '1.78rem'
      } : {
        height: '2.67rem'
      };
      var html;

      if (String(rentalType) === '0') {
        html = React.createElement("div", {
          style: {
            marginTop: "".concat(22.25 * window.devicePixelRatio, "px")
          },
          className: "group"
        }, navContent.map(function (ele, index) {
          return navContent && navContent.length === index + 1 ? React.createElement("div", {
            className: "item"
          }, React.createElement("div", {
            className: "nav-bar-last-column",
            style: {
              lineHeight: '0.89rem',
              width: "".concat(windowWidth / 4, "px")
            }
          })) : React.createElement("div", {
            className: "item nav-bar-column",
            style: {
              lineHeight: '0.89rem'
            }
          }, React.createElement("div", {
            style: {
              width: "".concat(windowWidth / 4, "px")
            }
          }, ele.dayTimeStr));
        }));
      } else if (String(rentalType) === '1' || String(rentalType) === '3') {
        html = React.createElement("div", {
          className: "group"
        }, navContent.map(function (ele, index) {
          return React.createElement("div", {
            key: String(index),
            className: "item nav-bar-column nav-bar-per-half-day-column",
            style: _objectSpread({
              width: "".concat(windowWidth / 3, "px")
            }, dateStyle1)
          }, React.createElement("div", {
            className: "half-day-date",
            id: "half-day-date".concat(index),
            style: _objectSpread({}, dateStyle, {
              width: "".concat(windowWidth / 6, "px")
            })
          }, React.createElement("div", {
            className: "half-day-date-day"
          }, ele.day), ele.dayTimeStr && React.createElement("div", null, ele.dayTimeStr)), React.createElement("div", {
            className: "half-day-time",
            style: {
              width: "".concat(windowWidth / 6, "px")
            }
          }, halfDayTimeIntervals.map(function (e, i) {
            return React.createElement("div", {
              key: String(i),
              className: halfDayTimeIntervals.length === 1 ? 'half-day-am' : 'half-day-am-pm'
            }, e.name);
          })));
        }));
      } else if (String(rentalType) === '2' || String(rentalType) === '4') {
        html = React.createElement("div", {
          className: "group"
        }, navContent.map(function (ele, index) {
          return React.createElement("div", {
            key: String(index),
            className: "item nav-bar-column-per-day"
          }, React.createElement("div", {
            style: {
              width: "".concat(windowWidth / 3, "px")
            }
          }, React.createElement("div", {
            className: "day-date",
            style: {
              height: '0.88rem',
              "float": 'left',
              borderBottom: '0.01rem solid #e0e0e0',
              width: "".concat(windowWidth / 3, "px")
            }
          }, React.createElement("div", {
            className: "day-date-day"
          }, React.createElement("div", {
            className: "day-style"
          }, ele.day), React.createElement("div", {
            className: "day-str-style"
          }, ele.dayTimeStr)))));
        }));
      } else if (String(rentalType) === '5') {
        html = React.createElement("div", {
          className: "group"
        }, navContent.map(function (ele, index) {
          return React.createElement("div", {
            key: String(index),
            className: "item nav-bar-column-per-day",
            style: {
              height: "".concat(133.5 * window.devicePixelRatio, "px")
            }
          }, React.createElement("div", {
            className: "week-left-nav-child",
            style: {
              width: "".concat(windowWidth / 3, "px")
            }
          }, React.createElement("div", {
            className: "day-date",
            style: {
              width: "".concat(windowWidth / 3, "px")
            }
          }, React.createElement("div", {
            className: "day-style"
          }, ele.dayTimeStr))));
        }));
      }

      return html;
    });

    return _this;
  }

  _createClass(PerDayLeftNav, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this.initComponent(this.props);
    }
  }, {
    key: "componentWillReceiveProps",
    value: function componentWillReceiveProps(nextProps) {
      this.initComponent(nextProps);
    }
  }, {
    key: "initComponent",
    value: function initComponent(props) {
      var _props$navContent = props.navContent,
          navContent = _props$navContent === void 0 ? [] : _props$navContent;
      this.setState({
        navContent: navContent
      });
    }
  }, {
    key: "render",
    value: function render() {
      return React.createElement("div", {
        className: "left"
      }, this.getHtml());
    }
  }]);

  return PerDayLeftNav;
}(PureComponent || Component);

export default PerDayLeftNav;