"use strict";

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

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

var _datePicker = _interopRequireDefault(require("./date-picker"));

var _rangePicker = _interopRequireDefault(require("./range-picker"));

var _monthPicker = _interopRequireDefault(require("./month-picker"));

var _yearPicker = _interopRequireDefault(require("./year-picker"));

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

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

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

/* istanbul ignore next */
var transform = function transform(props, deprecated) {
  var open = props.open,
      defaultOpen = props.defaultOpen,
      onOpenChange = props.onOpenChange,
      others = _objectWithoutProperties(props, ["open", "defaultOpen", "onOpenChange"]);

  var newProps = others;
  delete newProps.formater;

  if ('open' in props) {
    deprecated('open', 'visible', 'DatePicker');
    newProps.visible = open;

    if ('visible' in props) {
      newProps.visible = props.visible;
    }
  }

  if ('defaultOpen' in props) {
    deprecated('defaultOpen', 'defaultVisible', 'DatePicker');
    newProps.defaultVisible = defaultOpen;

    if ('defaultVisible' in props) {
      newProps.defaultVisible = props.defaultVisible;
    }
  }

  if ('onOpenChange' in props && typeof onOpenChange === 'function') {
    deprecated('onOpenChange', 'onVisibleChange', 'DatePicker');
    newProps.onVisibleChange = onOpenChange;

    if ('onVisibleChange' in props) {
      newProps.onVisibleChange = props.onVisibleChange;
    }
  }

  if ('formater' in props) {
    deprecated('formater', 'format showTime.format', 'DatePicker');
  }

  if ('format' in props && typeof props.format !== 'string') {
    deprecated('format', 'format: PropTypes.string,', 'DatePicker');
  }

  if ('ranges' in props) {
    deprecated('ranges', 'footerRender: PropTypes.func', 'RangePicker');
  }

  return newProps;
};

_datePicker["default"].RangePicker = _configProvider["default"].config(_rangePicker["default"], {
  componentName: 'DatePicker',
  transform: transform
});
_datePicker["default"].MonthPicker = _configProvider["default"].config(_monthPicker["default"], {
  componentName: 'DatePicker',
  transform: transform
});
_datePicker["default"].YearPicker = _configProvider["default"].config(_yearPicker["default"], {
  componentName: 'DatePicker',
  transform: transform
});

var _default = _configProvider["default"].config(_datePicker["default"], {
  transform: transform
});

exports["default"] = _default;