"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getConfig = getConfig;
exports.getCustomizable = getCustomizable;
exports.getPrefixCls = getPrefixCls;
exports.getProPrefixCls = getProPrefixCls;
exports.isCustomizable = isCustomizable;

var _isBoolean = _interopRequireDefault(require("lodash/isBoolean"));

var _isObject = _interopRequireDefault(require("lodash/isObject"));

var _dataset = require("choerodon-ui/dataset");

function isCustomizable(target) {
  return (0, _isObject["default"])(target);
}

function getConfig(key) {
  return (0, _dataset.getConfig)(key);
}

function getPrefixCls(suffixCls, customizePrefixCls) {
  if (customizePrefixCls) {
    return customizePrefixCls;
  }

  return "".concat(getConfig('prefixCls'), "-").concat(suffixCls);
}

function getProPrefixCls(suffixCls, customizePrefixCls) {
  if (customizePrefixCls) {
    return customizePrefixCls;
  }

  return "".concat(getConfig('proPrefixCls'), "-").concat(suffixCls);
}

function getCustomizable(component) {
  var customizable = getConfig('customizable');

  if ((0, _isBoolean["default"])(customizable)) {
    return customizable;
  }

  if (isCustomizable(customizable)) {
    return customizable[component];
  }
}
//# sourceMappingURL=utils.js.map
