/**
 * tdesign v0.39.1-alpha.1
 * (c) 2022 tdesign
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var Vue = require('vue');
var config = require('../config.js');
var list_listItemMetaProps = require('./list-item-meta-props.js');
var utils_renderTnode = require('../utils/render-tnode.js');
require('@babel/runtime/helpers/defineProperty');
require('@babel/runtime/helpers/typeof');
require('lodash/isObject');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);

var name = "".concat(config.prefix, "-list-item__meta");
var _ListItemMeta = Vue__default["default"].extend({
  name: "TListItemMeta",
  props: list_listItemMetaProps["default"],
  methods: {
    renderAvatar: function renderAvatar() {
      var h = this.$createElement;

      if (this.avatar || this.$scopedSlots.avatar) {
        console.warn("`avatar` is going to be deprecated, please use `image` instead");
      }

      var thumbnail = utils_renderTnode.renderContent(this, "avatar", "image");
      if (!thumbnail) return;

      if (typeof thumbnail === "string") {
        return h("div", {
          "class": "".concat(name, "-avatar")
        }, [h("img", {
          "attrs": {
            "src": thumbnail
          }
        })]);
      }

      return h("div", {
        "class": "".concat(name, "-avatar")
      }, [thumbnail]);
    }
  },
  render: function render() {
    var h = arguments[0];
    var propsTitleContent = utils_renderTnode.renderTNodeJSX(this, "title");
    var propsDescriptionContent = utils_renderTnode.renderTNodeJSX(this, "description");
    var listItemMetaContent = [this.renderAvatar(), h("div", {
      "class": "".concat(name, "-content")
    }, [propsTitleContent && h("h3", {
      "class": "".concat(name, "-title")
    }, [propsTitleContent]), propsDescriptionContent && h("p", {
      "class": "".concat(name, "-description")
    }, [propsDescriptionContent])])];
    return h("div", {
      "class": name
    }, [listItemMetaContent]);
  }
});

exports["default"] = _ListItemMeta;
//# sourceMappingURL=list-item-meta.js.map
