import { createVNode, mergeProps, isVNode } from "vue";
import "./styles/spacer.scss";
import { makeRowProps, Row } from "../grid/row.mjs";
import { makeColProps, Col } from "../grid/col.mjs";
import { defineComponent } from "../../utils/define-component.mjs";
import { flattenFragments, pick } from "../../utils/dist/index.mjs";
function _isSlot(s) {
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
}
const Spacer = defineComponent({
  name: "VeSpacer",
  props: {
    ...makeRowProps(),
    ...makeColProps({
      cols: "auto"
    })
  },
  setup(props, {
    slots
  }) {
    return () => {
      var _a, _b;
      let _slot;
      const children = flattenFragments((_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : []);
      if (!children.length) {
        return createVNode("div", {
          "class": "ve-spacer"
        }, null);
      }
      const [rowProps] = pick(props, Object.keys(Row.props));
      const [colProps] = pick(props, Object.keys(Col.props));
      return createVNode(Row, mergeProps(rowProps, {
        "class": "ve-spacer"
      }), _isSlot(_slot = children.map((child, index) => createVNode(Col, mergeProps(colProps, {
        "key": index
      }), _isSlot(child) ? child : {
        default: () => [child]
      }))) ? _slot : {
        default: () => [_slot]
      });
    };
  }
});
export {
  Spacer
};
//# sourceMappingURL=spacer.mjs.map
