import { defineComponent, ref, computed, watchEffect, createVNode, mergeProps } from 'vue';
import PropTypes from '../_util/vue-types/index.mjs';
import warning from '../_util/warning.mjs';
import classNames from '../_util/classNames.mjs';
import '../vc-slick/index.mjs';
import { stringType, booleanType, functionType, withInstall } from '../_util/type.mjs';
import '../hooks/index.mjs';
import useStyle from './style/index.mjs';
import useConfigInject from '../config-provider/hooks/useConfigInject.mjs';
import Slider from '../vc-slick/slider.mjs';

const carouselProps = () => ({
  effect: stringType(),
  dots: booleanType(true),
  vertical: booleanType(),
  autoplay: booleanType(),
  easing: String,
  beforeChange: functionType(),
  afterChange: functionType(),
  // style: PropTypes.React.CSSProperties,
  prefixCls: String,
  accessibility: booleanType(),
  nextArrow: PropTypes.any,
  prevArrow: PropTypes.any,
  pauseOnHover: booleanType(),
  // className: String,
  adaptiveHeight: booleanType(),
  arrows: booleanType(false),
  autoplaySpeed: Number,
  centerMode: booleanType(),
  centerPadding: String,
  cssEase: String,
  dotsClass: String,
  draggable: booleanType(false),
  fade: booleanType(),
  focusOnSelect: booleanType(),
  infinite: booleanType(),
  initialSlide: Number,
  lazyLoad: stringType(),
  rtl: booleanType(),
  slide: String,
  slidesToShow: Number,
  slidesToScroll: Number,
  speed: Number,
  swipe: booleanType(),
  swipeToSlide: booleanType(),
  swipeEvent: functionType(),
  touchMove: booleanType(),
  touchThreshold: Number,
  variableWidth: booleanType(),
  useCSS: booleanType(),
  slickGoTo: Number,
  responsive: Array,
  dotPosition: stringType(),
  verticalSwiping: booleanType(false)
});
const Carousel = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ACarousel",
  inheritAttrs: false,
  props: carouselProps(),
  setup(props, {
    slots,
    attrs,
    expose
  }) {
    const slickRef = ref();
    const goTo = (slide, dontAnimate = false) => {
      var _a;
      (_a = slickRef.value) == null ? void 0 : _a.slickGoTo(slide, dontAnimate);
    };
    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: computed(() => {
        var _a;
        return (_a = slickRef.value) == null ? void 0 : _a.innerSlider;
      })
    });
    watchEffect(() => {
      warning(props.vertical === void 0, "Carousel", "`vertical` is deprecated, please use `dotPosition` instead.");
    });
    const {
      prefixCls,
      direction
    } = useConfigInject("carousel", props);
    const [wrapSSR, hashId] = useStyle(prefixCls);
    const dotPosition = computed(() => {
      if (props.dotPosition)
        return props.dotPosition;
      if (props.vertical !== void 0)
        return props.vertical ? "right" : "bottom";
      return "bottom";
    });
    const vertical = computed(() => dotPosition.value === "left" || dotPosition.value === "right");
    const dsClass = computed(() => {
      const dotsClass = "slick-dots";
      return 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 = classNames(prefixCls.value, {
        [`${prefixCls.value}-rtl`]: direction.value === "rtl",
        [`${prefixCls.value}-vertical`]: vertical.value,
        [`${cls}`]: !!cls
      }, hashId.value);
      return wrapSSR(createVNode("div", {
        "class": className,
        "style": style
      }, [createVNode(Slider, mergeProps({
        "ref": slickRef
      }, props, restAttrs, {
        "dots": !!dots,
        "dotsClass": dsClass.value,
        "arrows": arrows,
        "draggable": draggable,
        "fade": fade,
        "vertical": vertical.value
      }), slots)]));
    };
  }
});
var index = withInstall(Carousel);

export { carouselProps, index as default };
//# sourceMappingURL=index.mjs.map
