import { createVNode as _createVNode } from "vue";
import _extends from "@babel/runtime/helpers/esm/extends";
import { computed, defineComponent, ref } from 'vue';
import ResizeObserver from '../vc-resize-observer';
export const masonryItemProps = () => ({
  prefixCls: String,
  item: Object,
  style: Object,
  className: String,
  index: Number,
  column: Number,
  onResize: Function,
  itemRender: Function
});
const MasonryItem = defineComponent({
  name: 'AMasonryItem',
  props: masonryItemProps(),
  setup(props, {
    slots,
    expose
  }) {
    const itemPrefix = computed(() => `${props.prefixCls}-item`);
    const itemRef = ref();
    expose({
      itemRef
    });
    return () => {
      var _a;
      const {
        itemRender = slots.itemRender,
        item,
        index,
        column,
        style,
        className,
        onResize
      } = props;
      const renderNode = (_a = item.children) !== null && _a !== void 0 ? _a : itemRender === null || itemRender === void 0 ? void 0 : itemRender({
        itemInfo: _extends(_extends({}, item), {
          index,
          column
        })
      });
      let returnNode = _createVNode("div", {
        "ref": itemRef,
        "style": style,
        "class": [itemPrefix.value, className]
      }, [renderNode]);
      if (onResize) {
        const _returnNode = function () {
          return returnNode;
        }();
        returnNode = _createVNode(ResizeObserver, {
          "onResize": onResize
        }, {
          default: () => [_returnNode]
        });
      }
      return returnNode;
    };
  }
});
export default MasonryItem;