"use strict";

exports.__esModule = true;
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _excluded = ["type", "className", "iconAttribute", "children"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _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; }

var Peg = /*#__PURE__*/function (_Component) {
  _inheritsLoose(Peg, _Component);

  function Peg(props) {
    return _Component.call(this, props) || this;
  }

  var _proto = Peg.prototype;

  _proto.render = function render() {
    var _this = this;

    var _this$props = this.props,
        type = _this$props.type,
        className = _this$props.className,
        iconAttribute = _this$props.iconAttribute,
        children = _this$props.children,
        others = _objectWithoutPropertiesLoose(_this$props, _excluded); // 根据类型使用不同的className


    var typeClassName = '';

    switch (type) {
      case 'line':
        typeClassName = 'sticker-line';
        break;

      default:
        typeClassName = 'sticker';
    } // 如果有图标, 则使用图标类型的样式sticker-icon


    if (iconAttribute) {
      typeClassName = typeClassName + ' sticker-icon';
    }

    return /*#__PURE__*/_react["default"].createElement("span", _extends({
      ref: function ref(el) {
        _this.$el = el;
      }
    }, others, {
      className: "" + typeClassName + (className ? ' ' + className : '')
    }), iconAttribute && /*#__PURE__*/_react["default"].createElement("span", _extends({}, iconAttribute, {
      "class": "size12" + (iconAttribute.className ? ' ' + iconAttribute.className : '')
    })), children && /*#__PURE__*/_react["default"].createElement("span", null, children));
  };

  return Peg;
}(_react.Component);

exports["default"] = Peg;

_defineProperty(Peg, "defaultProps", {
  className: 'top right'
});

Peg.propTypes = process.env.NODE_ENV !== "production" ? {
  type: _propTypes["default"].string,
  // line
  className: _propTypes["default"].string,
  iconAttribute: _propTypes["default"].object,
  children: _propTypes["default"].node
} : {};
module.exports = exports.default;