import { defineComponent, ref, createVNode, Transition } from 'vue';
import '../../../../utils/index.mjs';
import { mobileProps } from './interface.mjs';
import { flattenChildren } from '../../../../utils/vue/props.mjs';
import { classNames } from '../../../../utils/dom/class.mjs';

var MobilePopupInner = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "MobilePopupInner",
  inheritAttrs: false,
  props: mobileProps,
  emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"],
  setup(props, {
    expose,
    slots
  }) {
    const elementRef = ref();
    expose({
      forceAlign: () => {
      },
      getElement: () => elementRef.value
    });
    return () => {
      var _a;
      const {
        zIndex,
        visible,
        prefixCls,
        mobile: {
          popupClassName,
          popupStyle,
          popupMotion = {},
          popupRender
        } = {}
      } = props;
      const mergedStyle = {
        zIndex,
        ...popupStyle
      };
      let childNode = flattenChildren((_a = slots.default) == null ? void 0 : _a.call(slots));
      if (childNode.length > 1) {
        const _childNode = function() {
          return childNode;
        }();
        childNode = createVNode("div", {
          "class": `${prefixCls}-content`
        }, [childNode]);
      }
      if (popupRender)
        childNode = popupRender(childNode);
      const mergedClassName = classNames(prefixCls, popupClassName);
      return createVNode(Transition, {
        "ref": elementRef,
        ...popupMotion
      }, {
        default: () => [visible ? createVNode("div", {
          "class": mergedClassName,
          "style": mergedStyle
        }, [childNode]) : null]
      });
    };
  }
});

export { MobilePopupInner as default };
//# sourceMappingURL=MobilePopupInner.mjs.map
