"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; 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); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _card = _interopRequireDefault(require("@alifd/next/lib/card"));

var _button = _interopRequireDefault(require("../button"));

var _configProvider = _interopRequireDefault(require("../config-provider"));

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

var _classnames = _interopRequireDefault(require("classnames"));

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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

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

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 _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 _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } 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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

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

var BDesignCardActions = /*#__PURE__*/function (_Component) {
  _inherits(BDesignCardActions, _Component);

  var _super = _createSuper(BDesignCardActions);

  function BDesignCardActions() {
    _classCallCheck(this, BDesignCardActions);

    return _super.apply(this, arguments);
  }

  _createClass(BDesignCardActions, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          _this$props$prefix = _this$props.prefix,
          prefix = _this$props$prefix === void 0 ? 'next-' : _this$props$prefix,
          className = _this$props.className,
          children = _this$props.children,
          btnActions = _this$props.btnActions,
          onOk = _this$props.onOk,
          onCancel = _this$props.onCancel,
          okProps = _this$props.okProps,
          cancelProps = _this$props.cancelProps,
          socialActions = _this$props.socialActions,
          onTags = _this$props.onTags,
          onLike = _this$props.onLike,
          onShare = _this$props.onShare;

      if (btnActions) {
        var _cls;

        return /*#__PURE__*/_react["default"].createElement(_card["default"].Actions, _extends({
          className: (0, _classnames["default"])(className, (_cls = {}, _defineProperty(_cls, "".concat(prefix, "card-btn-action-only-ok"), (Array.isArray(btnActions) ? btnActions.join('') : '') === ['ok'].join('')), _defineProperty(_cls, "".concat(prefix, "card-btn-action-only-cancel"), (Array.isArray(btnActions) ? btnActions.join('') : '') === ['cancel'].join('')), _defineProperty(_cls, "".concat(prefix, "card-btn-action-reverse"), (Array.isArray(btnActions) ? btnActions.join('') : '') === ['ok', 'cancel'].join('')), _cls))
        }, this.props), /*#__PURE__*/_react["default"].createElement(_button["default"], {
          type: "secondary",
          size: "medium",
          className: "btn-cancel",
          onClick: onCancel
        }, cancelProps ? cancelProps : '取消'), /*#__PURE__*/_react["default"].createElement(_button["default"], {
          type: "primary",
          size: "medium",
          className: "btn-ok",
          onClick: onOk
        }, okProps ? okProps : '确认'));
      } else if (socialActions) {
        return /*#__PURE__*/_react["default"].createElement(_card["default"].Actions, {
          className: (0, _classnames["default"])(className, _defineProperty({}, "".concat(prefix, "card-social-action"), true))
        }, /*#__PURE__*/_react["default"].createElement("div", {
          className: "cardtags",
          onClick: onTags
        }, /*#__PURE__*/_react["default"].createElement("svg", {
          width: "18px",
          height: "16px",
          viewBox: "0 0 18 16",
          version: "1.1"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "37.-\u2705-Card-\u5361\u7247-\u2B50\uFE0F",
          stroke: "none",
          "stroke-width": "1",
          fill: "none",
          "fill-rule": "evenodd"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "Card-\u5361\u7247",
          transform: "translate(-148.000000, -1434.000000)"
        }, /*#__PURE__*/_react["default"].createElement("rect", {
          fill: "#FFFFFF",
          x: "0",
          y: "0",
          width: "1200",
          height: "7472"
        }), /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7C7B\u578B",
          transform: "translate(90.000000, 319.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7F16\u7EC4\u5907\u4EFD-4",
          transform: "translate(24.000000, 787.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7F16\u7EC4-8",
          transform: "translate(0.000000, 310.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "Icon-/-Outlined-/-Toggle-/-Thumbs-up",
          transform: "translate(33.000000, 16.000000)"
        }, /*#__PURE__*/_react["default"].createElement("rect", {
          id: "\u77E9\u5F62",
          opacity: "0",
          x: "0",
          y: "0",
          width: "20",
          height: "20"
        }), /*#__PURE__*/_react["default"].createElement("path", {
          d: "M5.3125,7.8125 C5.79981007,7.8125 6.20028042,8.18430505 6.24570839,8.65971249 L6.25,8.75 L6.25,16.875 C6.25,17.3623101 5.87819495,17.7627804 5.40278751,17.8082084 L5.3125,17.8125 L2.1875,17.8125 C1.70018993,17.8125 1.29971958,17.4406949 1.25429161,16.9652875 L1.25,16.875 L1.25,8.75 C1.25,8.26268993 1.62180505,7.86221958 2.09721249,7.81679161 L2.1875,7.8125 L5.3125,7.8125 Z M11.875,2.5 C13.0985918,2.5 13.75,3.54225314 13.75,4.6875 L13.7464169,4.8092897 L13.7356529,4.95783208 L13.7176857,5.13341344 L13.6771807,5.44810978 L13.6203441,5.82525415 L13.5471012,6.26581275 L13.4237938,6.95353854 L13.3119787,7.54582113 L13.26,7.8125 L16.6837379,7.8125 C17.6453051,7.8125 18.4378138,8.53632536 18.5461234,9.46883539 L18.555555,9.57732951 L18.5587379,9.6875 L18.5540208,9.82041691 L18.5398932,9.95266504 L17.647036,16.202665 C17.5203549,17.0894328 16.7862087,17.7572304 15.9021374,17.8092353 L15.7908807,17.8125 L8.4375,17.8125 C7.95018993,17.8125 7.54971958,17.4406949 7.50429161,16.9652875 L7.5,16.875 L7.5,8.4375 C7.5,7.92707749 7.65766628,7.54671495 8.08227613,7.03035453 L8.25423124,6.82982483 L8.4524929,6.61342746 L8.67834171,6.37804456 L8.93305826,6.12055826 C9.43907578,5.61454075 9.70151777,5.11776885 9.97098413,4.09666208 L10.0186609,3.91091523 C10.2733178,2.89228787 10.5455652,2.58137472 11.4114336,2.51498493 L11.6309345,2.50350908 C11.7080973,2.50109064 11.7893541,2.5 11.875,2.5 Z M4.999375,9.0625 L2.499375,9.0625 L2.499375,16.5625 L4.999375,16.5625 L4.999375,9.0625 Z M11.875,3.75 L11.5898644,3.74193516 L11.4578016,3.73598864 L11.3996178,3.7386161 C11.3433141,3.74645403 11.324232,3.77337085 11.307732,3.84430336 L11.2637035,4.0727603 L11.2313391,4.21408477 C10.8934495,5.56564291 10.5311585,6.29022499 9.81694174,7.00444174 L9.60341937,7.22049817 L9.41721896,7.41463203 L9.25701268,7.58866803 C9.23240404,7.61610058 9.20882316,7.64277174 9.18624239,7.66871955 L9.0625376,7.81603007 C8.85693622,8.07130038 8.7656523,8.24824289 8.7518661,8.39745523 L8.75,8.4375 L8.749375,16.5625 L15.7908807,16.5625 C16.0540612,16.5625 16.2833538,16.3987518 16.3743244,16.1618305 L16.3956267,16.0954695 L16.4095992,16.0258883 L17.3024563,9.77588835 C17.3066388,9.74661129 17.3087379,9.71707429 17.3087379,9.6875 C17.3087379,9.3669776 17.0674628,9.10280802 16.7566261,9.06670483 L16.6837379,9.0625 L12.8807198,9.0625 C12.819759,9.0625 12.7589436,9.05655409 12.6991372,9.04474671 C12.1911755,8.94446145 11.8606884,8.45138006 11.9609731,7.94341758 L12.1132831,7.15837632 L12.2685016,6.31835316 L12.3427588,5.89119958 L12.4196124,5.41309563 L12.471002,5.04133563 L12.487099,4.89596453 L12.4967715,4.77793533 L12.5,4.6875 C12.5,4.14524686 12.2529707,3.75 11.875,3.75 Z",
          id: "\u5F62\u72B6\u7ED3\u5408",
          fill: "#737373"
        }))))))))), /*#__PURE__*/_react["default"].createElement("div", {
          className: "cardlike",
          onClick: onLike
        }, /*#__PURE__*/_react["default"].createElement("svg", {
          width: "20px",
          height: "20px",
          viewBox: "0 0 20 20",
          version: "1.1"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "37.-\u2705-Card-\u5361\u7247-\u2B50\uFE0F",
          stroke: "none",
          "stroke-width": "1",
          fill: "none",
          "fill-rule": "evenodd"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "Card-\u5361\u7247",
          transform: "translate(-264.000000, -1432.000000)"
        }, /*#__PURE__*/_react["default"].createElement("rect", {
          fill: "#FFFFFF",
          x: "0",
          y: "0",
          width: "1200",
          height: "7472"
        }), /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7C7B\u578B",
          transform: "translate(90.000000, 319.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7F16\u7EC4\u5907\u4EFD-4",
          transform: "translate(24.000000, 787.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7F16\u7EC4-8",
          transform: "translate(0.000000, 310.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7F16\u7EC4-10",
          transform: "translate(33.000000, 16.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "Icon-/-Outlined-/-Toggle-/-Favorite-/-16",
          transform: "translate(117.000000, 0.000000)"
        }, /*#__PURE__*/_react["default"].createElement("rect", {
          id: "\u77E9\u5F62",
          "fill-opacity": "0.01",
          fill: "#FFFFFF",
          x: "0",
          y: "0",
          width: "20",
          height: "20"
        }), /*#__PURE__*/_react["default"].createElement("path", {
          d: "M17.3637311,3.92676549 C19.1719079,5.78776395 19.2112161,8.77990217 17.4816556,10.6900806 L10.4453564,17.9360188 C10.2214444,18.166602 9.86703833,18.1864495 9.62068801,17.9940683 L9.55622799,17.9362007 L2.63626894,10.8157987 C0.787910353,8.91344468 0.787910353,5.82911947 2.63626894,3.92676549 C4.48462753,2.0244115 7.48140891,2.0244115 9.32976749,3.92676549 L9.99978617,4.61640977 L10.6702325,3.92676549 C12.5185911,2.0244115 15.5153725,2.0244115 17.3637311,3.92676549 Z M16.562208,9.82868891 C17.8443692,8.4126317 17.8086017,6.19345264 16.474674,4.82055739 C15.1156305,3.42181262 12.9183331,3.42181262 11.5590427,4.82081136 L9.99950256,6.4250083 L8.44071045,4.82055739 C7.08166691,3.42181262 4.88436953,3.42181262 3.52532598,4.82055739 C2.15822467,6.22759531 2.15822467,8.51496884 3.52522066,9.92189837 L10.0005591,16.5848009 L16.562208,9.82868891 Z",
          id: "\u8DEF\u5F84",
          fill: "#737373"
        })))))))))), /*#__PURE__*/_react["default"].createElement("div", {
          className: "cardshare",
          onClick: onShare
        }, /*#__PURE__*/_react["default"].createElement("svg", {
          width: "20px",
          height: "20px",
          viewBox: "0 0 20 20",
          version: "1.1"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "37.-\u2705-Card-\u5361\u7247-\u2B50\uFE0F",
          stroke: "none",
          "stroke-width": "1",
          fill: "none",
          "fill-rule": "evenodd"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "Card-\u5361\u7247",
          transform: "translate(-381.000000, -1432.000000)"
        }, /*#__PURE__*/_react["default"].createElement("rect", {
          fill: "#FFFFFF",
          x: "0",
          y: "0",
          width: "1200",
          height: "7472"
        }), /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7C7B\u578B",
          transform: "translate(90.000000, 319.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7F16\u7EC4\u5907\u4EFD-4",
          transform: "translate(24.000000, 787.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7F16\u7EC4-8",
          transform: "translate(0.000000, 310.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "\u7F16\u7EC4-10",
          transform: "translate(33.000000, 16.000000)"
        }, /*#__PURE__*/_react["default"].createElement("g", {
          id: "Icon-/-Outlined-/-Technology-/-Share-/-16",
          transform: "translate(234.000000, 0.000000)"
        }, /*#__PURE__*/_react["default"].createElement("rect", {
          id: "\u77E9\u5F62",
          "fill-opacity": "0.01",
          fill: "#FFFFFF",
          x: "0",
          y: "0",
          width: "20",
          height: "20"
        }), /*#__PURE__*/_react["default"].createElement("path", {
          d: "M15,1.25 C16.7258898,1.25 18.125,2.64911016 18.125,4.375 C18.125,6.10088984 16.7258898,7.5 15,7.5 C14.118079,7.5 13.3214854,7.13467017 12.7532989,6.54709037 L8.01588592,9.17844577 C8.08703063,9.44023294 8.125,9.71568236 8.125,10 C8.125,10.3092976 8.0800656,10.6081003 7.99636871,10.890236 L12.5972669,13.6267517 C13.1704953,12.9382463 14.0340687,12.5 15,12.5 C16.7258898,12.5 18.125,13.8991102 18.125,15.625 C18.125,17.3508898 16.7258898,18.75 15,18.75 C13.2741102,18.75 11.875,17.3508898 11.875,15.625 C11.875,15.3138856 11.9204638,15.0133899 12.0051101,14.7297942 L7.40582043,11.9945342 C6.83260797,12.6851773 5.96766703,13.125 5,13.125 C3.27411016,13.125 1.875,11.7258898 1.875,10 C1.875,8.27411016 3.27411016,6.875 5,6.875 C5.99370292,6.875 6.87907751,7.3388087 7.45145145,8.06175379 L12.0799721,5.49049789 C11.9475443,5.1440493 11.875,4.76799646 11.875,4.375 C11.875,2.64911016 13.2741102,1.25 15,1.25 Z M15,13.75 C13.9644661,13.75 13.125,14.5894661 13.125,15.625 C13.125,16.6605339 13.9644661,17.5 15,17.5 C16.0355339,17.5 16.875,16.6605339 16.875,15.625 C16.875,14.5894661 16.0355339,13.75 15,13.75 Z M5,8.125 C3.96446609,8.125 3.125,8.96446609 3.125,10 C3.125,11.0355339 3.96446609,11.875 5,11.875 C6.03553391,11.875 6.875,11.0355339 6.875,10 C6.875,8.96446609 6.03553391,8.125 5,8.125 Z M15,2.5 C13.9644661,2.5 13.125,3.33946609 13.125,4.375 C13.125,5.41053391 13.9644661,6.25 15,6.25 C16.0355339,6.25 16.875,5.41053391 16.875,4.375 C16.875,3.33946609 16.0355339,2.5 15,2.5 Z",
          id: "\u5F62\u72B6",
          fill: "#737373"
        })))))))))));
      }

      return /*#__PURE__*/_react["default"].createElement(_card["default"].Actions, this.props, children ? children : undefined);
    }
  }]);

  return BDesignCardActions;
}(_react.Component);

var Card = /*#__PURE__*/function (_Component2) {
  _inherits(Card, _Component2);

  var _super2 = _createSuper(Card);

  function Card() {
    _classCallCheck(this, Card);

    return _super2.apply(this, arguments);
  }

  _createClass(Card, [{
    key: "render",
    value: function render() {
      var _this$props2 = this.props,
          _this$props2$prefix = _this$props2.prefix,
          prefix = _this$props2$prefix === void 0 ? 'next-' : _this$props2$prefix,
          className = _this$props2.className,
          direction = _this$props2.direction;
      return /*#__PURE__*/_react["default"].createElement(_card["default"], _extends({}, this.props, {
        className: (0, _classnames["default"])(className, _defineProperty({}, "".concat(prefix, "card-horizontal"), direction === 'horizontal'))
      }));
    }
  }]);

  return Card;
}(_react.Component);

_defineProperty(Card, "BulletHeader", _card["default"].BulletHeader);

_defineProperty(Card, "CollaspeContent", _card["default"].CollaspeContent);

_defineProperty(Card, "Header", _card["default"].Header);

_defineProperty(Card, "Content", _card["default"].Content);

_defineProperty(Card, "Media", _card["default"].Media);

_defineProperty(Card, "Actions", _configProvider["default"].config(BDesignCardActions));

_defineProperty(Card, "Divider", _card["default"].Divider);

var _default = _configProvider["default"].config(Card);

exports["default"] = _default;