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 _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 _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

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

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

import React, { Component, PureComponent } from 'react';
import PerHour from './components/PerHour';
import PerHalfDay from './components/PerHalfDay';
import PerDay from './components/PerDay';
import PerWeek from './components/PerWeek';
import PerMonth from './components/PerMonth'; // import initIScroll from './components/iscroll';
// initIScroll(window, document, window.Math);

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

  function ResourceUnit(props) {
    var _this;

    _classCallCheck(this, ResourceUnit);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(ResourceUnit).call(this, props));
    _this.state = {};
    return _this;
  }

  _createClass(ResourceUnit, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          goNext = _this$props.goNext,
          history = _this$props.history,
          multiUnit = _this$props.multiUnit,
          notice = _this$props.notice,
          rentalType = _this$props.rentalType,
          resourceType = _this$props.resourceType,
          autoAssign = _this$props.autoAssign,
          rentalSiteId = _this$props.rentalSiteId,
          priceType = _this$props.priceType,
          packageName = _this$props.packageName,
          needPay = _this$props.needPay,
          allowRent = _this$props.allowRent,
          sceneToken = _this$props.sceneToken,
          namespaceId = _this$props.namespaceId,
          Spin = _this$props.Spin,
          Calendar = _this$props.Calendar;
      var sceneType = this.props.sceneType;
      sceneType = sceneType ? decodeURI(sceneType) : '';
      window.$$RESOURCECONTEXT = {
        goNext: goNext,
        Calendar: Calendar,
        Spin: Spin,
        multiUnit: multiUnit,
        notice: notice,
        resourceType: resourceType,
        sceneType: sceneType,
        rentalType: rentalType,
        autoAssign: autoAssign,
        needPay: needPay,
        rentalSiteId: rentalSiteId,
        priceType: priceType,
        packageName: packageName,
        allowRent: allowRent,
        sceneToken: sceneToken,
        namespaceId: namespaceId
      };

      var GoWhichRentalType = function GoWhichRentalType() {
        var rentalTypes = {
          0: React.createElement(PerHour, {
            history: history
          }),
          1: React.createElement(PerHalfDay, {
            history: history
          }),
          2: React.createElement(PerDay, {
            history: history
          }),
          3: React.createElement(PerHalfDay, {
            history: history
          }),
          4: React.createElement(PerMonth, {
            history: history
          }),
          5: React.createElement(PerWeek, {
            history: history
          })
        };
        return rentalTypes[Number(rentalType)];
      };

      return React.createElement("div", null, React.createElement(GoWhichRentalType, null));
    }
  }]);

  return ResourceUnit;
}(PureComponent || Component);

export default ResourceUnit;