/**
 * 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 comment_props = require('./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 preName = "".concat(config.prefix, "-comment");
var _Comment = Vue__default["default"].extend({
  name: "TComment",
  props: comment_props["default"],
  methods: {
    renderReply: function renderReply() {
      var h = this.$createElement;
      var reply = utils_renderTnode.renderTNodeJSX(this, "reply");
      return reply ? h("div", {
        "class": "".concat(preName, "__reply")
      }, [reply]) : null;
    },
    renderActions: function renderActions() {
      var h = this.$createElement;
      var actions = utils_renderTnode.renderTNodeJSX(this, "actions");
      return actions && actions.length ? h("ul", {
        "class": "".concat(preName, "__actions")
      }, [actions.map(function (action, index) {
        return h("li", {
          "key": "action-".concat(index)
        }, [action]);
      })]) : null;
    },
    renderQuote: function renderQuote() {
      var h = this.$createElement;
      var quote = utils_renderTnode.renderTNodeJSX(this, "quote");
      return quote ? h("div", {
        "class": "".concat(preName, "__quote")
      }, [quote]) : null;
    },
    renderAuthorDatetime: function renderAuthorDatetime() {
      var h = this.$createElement;
      var author = utils_renderTnode.renderTNodeJSX(this, "author");
      var datetime = utils_renderTnode.renderTNodeJSX(this, "datetime");
      return (author || datetime) && h("div", {
        "class": "".concat(preName, "__author")
      }, [author && h("span", {
        "class": "".concat(preName, "__name")
      }, [author]), datetime && h("span", {
        "class": "".concat(preName, "__time")
      }, [datetime])]);
    },
    renderContent: function renderContent() {
      var h = this.$createElement;
      return h("div", {
        "class": "".concat(preName, "__content")
      }, [this.renderAuthorDatetime(), h("div", {
        "class": "".concat(preName, "__detail")
      }, [utils_renderTnode.renderTNodeJSX(this, "content")]), this.renderQuote(), this.renderActions()]);
    },
    renderAvatar: function renderAvatar() {
      var h = this.$createElement;
      var avatar = utils_renderTnode.renderTNodeJSX(this, "avatar");
      return avatar ? h("div", {
        "class": "".concat(preName, "__avatar")
      }, [typeof avatar === "string" ? h("img", {
        "attrs": {
          "src": avatar,
          "alt": ""
        },
        "class": "".concat(preName, "__avatar-image")
      }) : avatar]) : null;
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": preName
    }, [h("div", {
      "class": "".concat(preName, "__inner")
    }, [this.renderAvatar(), this.renderContent()]), this.renderReply()]);
  }
});

exports["default"] = _Comment;
//# sourceMappingURL=comment.js.map
