import * as _vue from "vue";

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

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

import { inject } from 'vue';
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import CheckOutlined from '@ant-design/icons-vue/CheckOutlined';
import PropTypes from '../_util/vue-types';
import { initDefaultProps, getOptionProps, getComponent, getSlot } from '../_util/props-util';
import VcSteps from '../vc-steps';
import { ConfigConsumerProps } from '../config-provider';

var getStepsProps = function getStepsProps() {
  var defaultProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var props = {
    prefixCls: PropTypes.string,
    iconPrefix: PropTypes.string,
    current: PropTypes.number,
    initial: PropTypes.number,
    labelPlacement: PropTypes.oneOf(['horizontal', 'vertical']).def('horizontal'),
    status: PropTypes.oneOf(['wait', 'process', 'finish', 'error']),
    size: PropTypes.oneOf(['default', 'small']),
    direction: PropTypes.oneOf(['horizontal', 'vertical']),
    progressDot: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
    type: PropTypes.oneOf(['default', 'navigation'])
  };
  return initDefaultProps(props, defaultProps);
};

var Steps = {
  name: 'ASteps',
  props: getStepsProps({
    current: 0
  }),
  setup: function setup() {
    return {
      configProvider: inject('configProvider', ConfigConsumerProps)
    };
  },
  Step: _objectSpread(_objectSpread({}, VcSteps.Step), {}, {
    name: 'AStep'
  }),
  render: function render() {
    var _this = this;

    var props = getOptionProps(this);
    var customizePrefixCls = props.prefixCls,
        customizeIconPrefixCls = props.iconPrefix;
    var getPrefixCls = this.configProvider.getPrefixCls;
    var prefixCls = getPrefixCls('steps', customizePrefixCls);
    var iconPrefix = getPrefixCls('', customizeIconPrefixCls);
    var progressDot = getComponent(this, 'progressDot', this, false);
    var icons = {
      finish: _vue.createVNode(CheckOutlined, {
        "class": "".concat(prefixCls, "-finish-icon")
      }, null),
      error: _vue.createVNode(CloseOutlined, {
        "class": "".concat(prefixCls, "-error-icon")
      }, null)
    };

    var stepsProps = _objectSpread({
      icons: icons,
      iconPrefix: iconPrefix,
      prefixCls: prefixCls,
      progressDot: progressDot
    }, props);

    return _vue.createVNode(VcSteps, stepsProps, {
      default: function _default() {
        return [getSlot(_this)];
      }
    });
  }
};
/* istanbul ignore next */

Steps.install = function (app) {
  app.component(Steps.name, Steps);
  app.component(Steps.Step.name, Steps.Step);
};

export default Steps;