"use strict";

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

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

var _slider = _interopRequireDefault(require("./slider"));

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

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(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(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; }

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

var _default = _configProvider["default"].config(_slider["default"], {
  exportNames: ['resize'],
  transform:
  /* istanbul ignore next */
  function transform(props, deprecated) {
    if ('fade' in props) {
      deprecated('fade', 'animation', 'Slider');

      var _props = props,
          fade = _props.fade,
          others = _objectWithoutProperties(_props, ["fade"]);

      if (fade) {
        props = _objectSpread({
          animation: 'fade'
        }, others);
      } else {
        props = others;
      }
    }

    if ('arrowPos' in props) {
      if (props.arrowPos === 'inline') {
        deprecated('arrowPos=inline', 'arrowPosition=inner', 'Slider');
        props.arrowPos = 'inner';
      } else {
        deprecated('arrowPos', 'arrowPosition', 'Slider');
      }

      var _props2 = props,
          arrowPos = _props2.arrowPos,
          _others = _objectWithoutProperties(_props2, ["arrowPos"]);

      props = _objectSpread({
        arrowPosition: arrowPos
      }, _others);
    }

    ['arrowDirection', 'dotsDirection', 'slideDirection'].forEach(function (propName) {
      if (props[propName] === 'horizontal') {
        deprecated("".concat(propName, "=horizontal"), "".concat(propName, "=hoz"), 'Slider');
        props[propName] = 'hoz';
      } else if (props[propName] === 'vertical') {
        deprecated("".concat(propName, "=vertical"), "".concat(propName, "=ver"), 'Slider');
        props[propName] = 'ver';
      }
    });

    if ('initialSlide' in props) {
      deprecated('initialSlide', 'defaultActiveIndex', 'Slider');

      var _props3 = props,
          initialSlide = _props3.initialSlide,
          _others2 = _objectWithoutProperties(_props3, ["initialSlide"]);

      props = _objectSpread({
        defaultActiveIndex: initialSlide
      }, _others2);
    }

    if ('slickGoTo' in props) {
      deprecated('slickGoTo', 'activeIndex', 'Slider');

      var _props4 = props,
          slickGoTo = _props4.slickGoTo,
          _others3 = _objectWithoutProperties(_props4, ["slickGoTo"]);

      props = _objectSpread({
        activeIndex: slickGoTo
      }, _others3);
    }

    if ('afterChange' in props) {
      deprecated('afterChange', 'onChange', 'Slider');

      var _props5 = props,
          afterChange = _props5.afterChange,
          _others4 = _objectWithoutProperties(_props5, ["afterChange"]);

      props = _objectSpread({
        onChange: afterChange
      }, _others4);
    }

    if ('beforeChange' in props) {
      deprecated('beforeChange', 'onBeforeChange', 'Slider');

      var _props6 = props,
          beforeChange = _props6.beforeChange,
          _others5 = _objectWithoutProperties(_props6, ["beforeChange"]);

      props = _objectSpread({
        onBeforeChange: beforeChange
      }, _others5);
    }

    return props;
  }
});

exports["default"] = _default;