'use strict';

var vue = require('vue');
var index = require('./props-util/index.js');
var warning = require('./warning.js');

function cloneElement(vnode, nodeProps = {}, override = true, mergeRef = false) {
  var _a;
  let ele = vnode;
  if (Array.isArray(vnode))
    ele = index.filterEmpty(vnode)[0];
  if (!ele)
    return null;
  const node = vue.cloneVNode(ele, nodeProps, mergeRef);
  node.props = override ? { ...node.props, ...nodeProps } : node.props;
  warning.default(typeof ((_a = node.props) == null ? void 0 : _a.class) !== "object", "class must be string");
  return node;
}
function cloneVNodes(vnodes, nodeProps = {}, override = true) {
  return vnodes.map((v) => cloneElement(v, nodeProps, override));
}
function deepCloneElement(vnode, nodeProps = {}, override = true, mergeRef = false) {
  if (Array.isArray(vnode)) {
    return vnode.map((item) => deepCloneElement(item, nodeProps, override, mergeRef));
  } else {
    const cloned = cloneElement(vnode, nodeProps, override, mergeRef);
    if (Array.isArray(cloned.children))
      cloned.children = deepCloneElement(cloned.children);
    return cloned;
  }
}

exports.cloneElement = cloneElement;
exports.cloneVNodes = cloneVNodes;
exports.deepCloneElement = deepCloneElement;
//# sourceMappingURL=vnode.js.map
