'use strict';

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

var vue = require('vue');
require('../../../utils/index.cjs');
require('../../../vue-components/index.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var index = require('../style/index.cjs');
var props = require('./props.cjs');
var log = require('../../../utils/log.cjs');
var _class = require('../../../utils/dom/class.cjs');
var slider = require('../../../vue-components/vc-slick/src/slider.cjs');

var ACarousel = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ACarousel",
  inheritAttrs: false,
  props: props.carouselProps(),
  setup(props, {
    slots,
    attrs,
    expose
  }) {
    const slickRef = vue.ref();
    const goTo = (slide, dotAnimate = false) => {
      var _a;
      (_a = slickRef.value) == null ? void 0 : _a.slickGoTo(slide, dotAnimate);
    };
    expose({
      goTo,
      autoplay: (palyType) => {
        var _a, _b;
        (_b = (_a = slickRef.value) == null ? void 0 : _a.innerSlider) == null ? void 0 : _b.handleAutoPlay(palyType);
      },
      prev: () => {
        var _a;
        (_a = slickRef.value) == null ? void 0 : _a.slickPrev();
      },
      next: () => {
        var _a;
        (_a = slickRef.value) == null ? void 0 : _a.slickNext();
      },
      innerSlider: vue.computed(() => {
        var _a;
        return (_a = slickRef.value) == null ? void 0 : _a.innerSlider;
      })
    });
    vue.watchEffect(() => {
      log.devWarning(props.vertical === void 0, "Carousel", "`vertical` is deprecated, please use `dotPosition` instead.");
    });
    const {
      prefixCls,
      direction
    } = useConfigInject.default("carousel", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const dotPosition = vue.computed(() => {
      if (props.dotPosition)
        return props.dotPosition;
      if (props.vertical !== void 0)
        return props.vertical ? "right" : "bottom";
      return "bottom";
    });
    const vertical = vue.computed(() => dotPosition.value === "left" || dotPosition.value === "right");
    const dsClass = vue.computed(() => {
      const dotsClass = "slick-dots";
      return _class.classNames({
        [dotsClass]: true,
        [`${dotsClass}-${dotPosition.value}`]: true,
        [`${props.dotsClass}`]: !!props.dotsClass
      });
    });
    return () => {
      const {
        dots,
        arrows,
        draggable,
        effect
      } = props;
      const {
        class: cls,
        style,
        ...restAttrs
      } = attrs;
      const fade = effect === "fade" ? true : props.fade;
      const className = _class.classNames(prefixCls.value, {
        [`${prefixCls.value}-rtl`]: direction.value === "rtl",
        [`${prefixCls.value}-vertical`]: vertical.value,
        [`${cls}`]: !!cls
      }, hashId.value);
      return wrapSSR(vue.createVNode("div", {
        "class": className,
        "style": style
      }, [vue.createVNode(slider.default, {
        "ref": slickRef,
        ...props,
        ...restAttrs,
        "dots": !!dots,
        "dotsClass": dsClass.value,
        "arrows": arrows,
        "draggable": draggable,
        "fade": fade,
        "vertical": vertical.value
      }, slots)]));
    };
  }
});

exports.default = ACarousel;
//# sourceMappingURL=Carousel.cjs.map
