'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var React = require('react');
var React__default = _interopDefault(React);
var styleInject_es = require('../style-inject.es-dcee06b6.js');
var defineProperty = require('../defineProperty-ba7cd53d.js');
require('../_commonjsHelpers-72d386ba.js');
var index = require('../index-44e17595.js');
var utils = require('../utils-b800dc99.js');

var img = "data:image/png;base64,[encoded data, 8100 characters]";

var img$1 = "data:image/png;base64,[encoded data, 4820 characters]";

var img$2 = "data:image/png;base64,[encoded data, 7784 characters]";

var img$3 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABECAMAAAAPzWOAAAAAM1BMVEVHcEwArfAAq/AArvQAq+4Aqu8Aqu8Ar/QAqu8Aq+8Aqu8ArPAAsf8Aq/AAqu8Aq/AAqu6gIIw3AAAAEHRSTlMAKoAZ9JXXD7o86WoHSaldjgJo7wAAAgBJREFUWMPtmNmShCAMRSHsIMj/f+1oCy4YsB2oeZr7SHWdJsklEgj5iDkteXwlLrVj5JCCl4AdBCozqIy/lqSJYWOH7IeiZOySXCOC2ClY6sJ7IZwRF7vliO6HaNJOq5+2ArZTS5op4dlJ7aSQ2A+J/5A/gcyq0N5xCukWhHypFgRMobyRcl3+l/gtJIizEoRdFu0jxDyWV8UBEP8M0VVBgoiXiS368SbbA0kHycQOiK5G8wKSDudknyFWCwAQQZe/tdvHg8xPZpNAj0oyD5pfvrgfyTZEztPNE9SFDcRVzSQXSFC4tya/+ry1kQOSf6UYZbcdUWCNjeyQ8AG4YFN6wavntlhArFqP6vW7rO85Ms1WsJjA3A3ARXkcfeBViF32gV//tC8bwawrEEHqlx3pyqgYSAziWw2Q03uC6YWzQZpXN4/758Qh6ZTDYxtBOfo7iNvv7oA5R81CJgit5iQzmFwrzvDOTbJN0OrwnI90d+eBophseswneYQ43/+1r0GW8twdy2E6xdIyDjnOHwtXy+8JuOEtMAyyJXAvvQ3zUQrUQsEgE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image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAABGCAMAAACnmwfnAAAAb1BMVEVHcEwSOoYNeb4ROoUAnuMAneIAnuMROoUAneMSU5wUO4gROoUROoYROYUROYUAoOUAnuMSOoYRO4YAnuMROoUAoOUNUpwEh88Ja7QAnuQAnuQROYQAneIXLHAUM3sVL3USNn8NWqEIdLsRRYwEh8yuGf8EAAAAG3RSTlMAVQvuy+eo5PkXKW/Rr4goeETDiZ43us7AS166//BKAAAB4UlEQVRYw6WW25qCMAyEEVoOAitycBdboYrv/4yru4oS0pDK3P9f0gkZ4nmjNmWEK8vK+ivd+55dG7WkLE1scKQYqnF8q1gKNhi8V0ylCJxyYYXUrtlwsJ3BJRtW+QwO+LCCpRMHVtWfmn1X9LHZSN9fTjCYVr4GjlbAvloBz9bCdKiMMXPD4DJ3J7v6TiWk2SdSfVwldrMNDSutZfOCM37XN5211nE7wsoJvtxgLROL2T39ZP2n0LIWNDz8w3GCrwWj65sKNIMMp+ux79LFr/MTFmgGdazCWqIZ1LMKP2AXs40GsIPZ/fUFC2wtDGNM9zmHjmvxevA454hr9oTVLZZBNr/6y4TVO4e1UNcpK9AMwkcEyj6fvJxB/TBDH10jZvejOqOG81UjEmgGmUFz1KIZFLBYgWfQDwtu8Az65rAF/msOYgYbWu6gjPNg33IHHRh1fdsddGC/F8mgJbPDHXEHkWbLCTrPIDkj4rukFGHVwNMPrEUEySN14YO1KAFceZQi2uwdxfq02ZIsvKXNFiQMMshMzY5DEl4wuyDhnF6LloSzFWaDtTDA7NhzgN3MBobl0pIYtq8keZPv9HECNQA+usBHPGB5qgDsu8Chy1pAiemUxQrYzWyviN8l6I/T+wU2HDmgaaHs/gAAAABJRU5ErkJggg==";

var css = ".PayPlatformOptions_flexContainer__b-T24 {\n  display: flex;\n  justify-content: space-around;\n  align-items: center;\n}\n.PayPlatformOptions_label__3uVHv {\n  font-size: 14px;\n  font-weight: 400;\n  color: #616A79;\n}\n.PayPlatformOptions_payChannelBox__3_kPR {\n  padding: 20px 10px 10px 10px;\n  text-align: center;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_paymentImage__1Jwya {\n  display: inline-block;\n  margin: 0;\n  width: 60%;\n  vertical-align: middle;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_paymentImage-before__2mPbW {\n  display: inline-block;\n  height: 100%;\n  vertical-align: middle;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_payChannelBlock__3YbXL {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  cursor: pointer;\n  border: 1px solid transparent;\n  height: 66px;\n  line-height: 66px;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_payChannelBlock__3YbXL .PayPlatformOptions_platformName__U1hFh {\n  text-align: center;\n  white-space: nowrap;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_payChannelBlock__3YbXL.PayPlatformOptions_small__rnqDt {\n  width: 88px;\n  height: 36px;\n  line-height: 36px;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_payChannelBlock__3YbXL.PayPlatformOptions_small__rnqDt .PayPlatformOptions_paymentImage__1Jwya {\n  margin: 0;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_payChannelBlock__3YbXL.PayPlatformOptions_normal__12jfT {\n  width: 132px;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_payChannelBlock__3YbXL.PayPlatformOptions_large__Q_Mjs {\n  width: 162px;\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_payChannelBlock__3YbXL.PayPlatformOptions_active__3wAdi {\n  border-radius: 5px;\n  border-color: #1790FF;\n  box-shadow: 0px 2px 6px 0px rgba(163, 163, 163, 0.3);\n}\n.PayPlatformOptions_payChannelBox__3_kPR .PayPlatformOptions_payChannelBlock__3YbXL.PayPlatformOptions_en__Ns_g7 {\n  font-size: 12px;\n}\n.PayPlatformOptions_payChannelBox__3_kPR.PayPlatformOptions_mobile__3Ckag {\n  padding: 8px 10px 10px 8px;\n}\n.PayPlatformOptions_payChannelBox__3_kPR.PayPlatformOptions_mobile__3Ckag .PayPlatformOptions_payChannelBlock__3YbXL {\n  display: inline-flex;\n  flex-direction: column;\n  justify-content: space-around;\n  width: 78px;\n  height: 80px;\n  line-height: initial;\n  border: 1px solid transparent;\n}\n.PayPlatformOptions_payChannelBox__3_kPR.PayPlatformOptions_mobile__3Ckag .PayPlatformOptions_payChannelBlock__3YbXL.PayPlatformOptions_active__3wAdi {\n  border-radius: 4px;\n  border-color: #1790FF;\n}\n.PayPlatformOptions_payChannelBox__3_kPR.PayPlatformOptions_mobile__3Ckag .PayPlatformOptions_payChannelBlock__3YbXL .PayPlatformOptions_paymentImage__1Jwya {\n  display: inline-block;\n  width: 34px;\n  height: 34px;\n}\n@media (max-width: 768px) {\n  .PayPlatformOptions_payChannelBlock__3YbXL {\n    cursor: pointer;\n    border: 1px solid transparent;\n  }\n  .PayPlatformOptions_payChannelBlock__3YbXL.PayPlatformOptions_active__3wAdi {\n    border-radius: 5px;\n    border-color: #1790FF;\n  }\n}\n";
var styles = {
  "flexContainer": "PayPlatformOptions_flexContainer__b-T24",
  "label": "PayPlatformOptions_label__3uVHv",
  "payChannelBox": "PayPlatformOptions_payChannelBox__3_kPR",
  "paymentImage": "PayPlatformOptions_paymentImage__1Jwya",
  "paymentImage-before": "PayPlatformOptions_paymentImage-before__2mPbW",
  "payChannelBlock": "PayPlatformOptions_payChannelBlock__3YbXL",
  "platformName": "PayPlatformOptions_platformName__U1hFh",
  "small": "PayPlatformOptions_small__rnqDt",
  "normal": "PayPlatformOptions_normal__12jfT",
  "large": "PayPlatformOptions_large__Q_Mjs",
  "active": "PayPlatformOptions_active__3wAdi",
  "en": "PayPlatformOptions_en__Ns_g7",
  "mobile": "PayPlatformOptions_mobile__3Ckag",
  "paymentImageBefore": "PayPlatformOptions_paymentImage-before__2mPbW"
};
styleInject_es.styleInject(css);

function ownKeys(object, enumerableOnly) {
  var keys = Object.keys(object);

  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    if (enumerableOnly) symbols = symbols.filter(function (sym) {
      return Object.getOwnPropertyDescriptor(object, sym).enumerable;
    });
    keys.push.apply(keys, symbols);
  }

  return keys;
}

function _objectSpread(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};

    if (i % 2) {
      ownKeys(Object(source), true).forEach(function (key) {
        defineProperty._defineProperty(target, key, source[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
      ownKeys(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }
  }

  return target;
}
var PAY_CHANNEL = {
  PAYPAL: "PAYPAL_PAYPAL",
  ALI_WEB: "ALI_WEB",
  ALI_WAP: "ALI_WAP",
  WX_WAP: "WX_WAP",
  WX_NATIVE: "WX_NATIVE"
};
var PAY_CHANNEL_CATEGORY = {
  ALI: "Alipay",
  WX: "Wechat",
  PAYPAL: "Paypal"
};
var PAY_CHANNEL_INSTANCE = [{
  image: {
    desktop: img,
    mobile: img$3
  },
  text: {
    zh: "支付宝",
    en: "Alipay"
  },
  key: PAY_CHANNEL_CATEGORY.ALI
}, {
  image: {
    desktop: img$1,
    mobile: img$4
  },
  text: {
    zh: "微信",
    en: "WeChat"
  },
  key: PAY_CHANNEL_CATEGORY.WX
}, {
  image: {
    desktop: img$2,
    mobile: img$5
  },
  text: {
    zh: "PayPal",
    en: "PayPal"
  },
  key: PAY_CHANNEL_CATEGORY.PAYPAL
}];

var PayPlatformBlock = function PayPlatformBlock(_ref) {
  var _ref$isMobile = _ref.isMobile,
      isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile,
      _ref$isActive = _ref.isActive,
      isActive = _ref$isActive === void 0 ? false : _ref$isActive,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? "normal" : _ref$size,
      onClick = _ref.onClick,
      text = _ref.text,
      image = _ref.image,
      _ref$locale = _ref.locale,
      locale = _ref$locale === void 0 ? "zh" : _ref$locale;
  var showText = text[locale];

  if (isMobile) {
    return React__default.createElement("div", {
      className: styles.flexItem
    }, React__default.createElement("div", {
      className: index.classnames(styles.payChannelBlock, _objectSpread(defineProperty._defineProperty({}, styles.active, isActive), utils.exportStyleSizeClass(styles, size)), styles[locale]),
      onClick: onClick
    }, React__default.createElement("img", {
      src: image.mobile,
      alt: showText,
      className: styles.paymentImage
    }), React__default.createElement("div", {
      className: styles.platformName
    }, showText)));
  }

  return React__default.createElement("div", {
    className: styles.flexItem
  }, React__default.createElement("div", {
    className: index.classnames(styles.payChannelBlock, _objectSpread(defineProperty._defineProperty({}, styles.active, isActive), utils.exportStyleSizeClass(styles, size)), styles[locale]),
    onClick: onClick
  }, React__default.createElement("span", {
    className: styles["payment-method-before"]
  }), React__default.createElement("img", {
    src: image.desktop,
    alt: showText,
    className: styles.paymentImage
  })));
};

var PayPlatformOptions = function PayPlatformOptions(_ref2) {
  var payChannel = _ref2.payChannel,
      onPayChannelChange = _ref2.onPayChannelChange,
      _ref2$size = _ref2.size,
      size = _ref2$size === void 0 ? "normal" : _ref2$size,
      _ref2$isMobile = _ref2.isMobile,
      isMobile = _ref2$isMobile === void 0 ? false : _ref2$isMobile,
      _ref2$withTitle = _ref2.withTitle,
      withTitle = _ref2$withTitle === void 0 ? true : _ref2$withTitle,
      titleText = _ref2.titleText,
      _ref2$locale = _ref2.locale,
      locale = _ref2$locale === void 0 ? "zh" : _ref2$locale;
  var titleDOM = null;
  var payListDOM = [{
    valueKey: PAY_CHANNEL.ALI_WEB,
    categoryKey: PAY_CHANNEL_CATEGORY.ALI
  }, {
    valueKey: PAY_CHANNEL.WX_NATIVE,
    categoryKey: PAY_CHANNEL_CATEGORY.WX
  }, {
    valueKey: PAY_CHANNEL.PAYPAL,
    categoryKey: PAY_CHANNEL_CATEGORY.PAYPAL
  }].map(function (v) {
    var valueKey = v.valueKey,
        categoryKey = v.categoryKey;
    var targetInstance = PAY_CHANNEL_INSTANCE.find(function (ins) {
      return ins.key === categoryKey;
    });

    if (targetInstance) {
      var text = targetInstance.text,
          image = targetInstance.image;
      return React__default.createElement(PayPlatformBlock, Object.assign({
        key: valueKey
      }, {
        isMobile: isMobile,
        locale: locale,
        size: size
      }, {
        onClick: function onClick() {
          return onPayChannelChange(valueKey);
        },
        isActive: valueKey === payChannel,
        text: text,
        image: image
      }));
    }
  });

  if (withTitle) {
    titleDOM = React__default.createElement("div", {
      className: styles.label
    }, titleText || locale === "zh" ? "支付方式" : "Payment");
  }

  return React__default.createElement("div", null, titleDOM, React__default.createElement("div", {
    className: index.classnames(styles.payChannelBox, defineProperty._defineProperty({}, styles.mobile, isMobile))
  }, React__default.createElement("div", {
    className: styles.flexContainer
  }, payListDOM)));
};

exports.PAY_CHANNEL = PAY_CHANNEL;
exports.PAY_CHANNEL_CATEGORY = PAY_CHANNEL_CATEGORY;
exports.default = PayPlatformOptions;
//# sourceMappingURL=index.js.map
