/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

'use strict';

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

var utils_renderTnode = require('../utils/render-tnode.js');
var configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../utils/mixins.js');
var button_index = require('../button/index.js');
var comment_props = require('./props.js');
require('@babel/runtime/helpers/defineProperty');
require('@babel/runtime/helpers/typeof');
require('vue');
require('@vue/composition-api');
require('lodash/camelCase');
require('lodash/kebabCase');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('lodash/merge');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('../_chunks/dep-7c884501.js');
require('dayjs');
require('../utils/withInstall.js');
require('lodash/capitalize');
require('../button/button.js');
require('../loading/index.js');
require('../loading/directive.js');
require('lodash/isObject');
require('lodash/mapKeys');
require('lodash/isEqual');
require('../loading/plugin.js');
require('../config.js');
require('../utils/dom.js');
require('raf');
require('lodash/isString');
require('../utils/easing.js');
require('../loading/loading.js');
require('../utils/transfer-dom.js');
require('../loading/props.js');
require('../loading/icon/gradient.js');
require('../_common/js/loading/circle-adapter.js');
require('../_common/js/utils/set-style.js');
require('../_common/js/utils/helper.js');
require('@babel/runtime/helpers/toConsumableArray');
require('@babel/runtime/helpers/objectWithoutProperties');
require('@babel/runtime/helpers/slicedToArray');
require('lodash/isNull');
require('lodash/isUndefined');
require('lodash/isNumber');
require('lodash/isArray');
require('../utils/ripple.js');
require('../button/props.js');

var classPrefixMixins = configProvider_configReceiver.getClassPrefixMixins("comment");
var _Comment = utils_mixins["default"](classPrefixMixins).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(this.componentName, "__reply")
      }, [reply]) : null;
    },
    renderActions: function renderActions() {
      var h = this.$createElement;
      var actions = utils_renderTnode.renderTNodeJSX(this, "actions");
      return actions && actions.length ? h("div", {
        "class": "".concat(this.componentName, "__actions")
      }, [actions.map(function (action, index) {
        return h(button_index.Button, {
          "key": "action-".concat(index),
          "attrs": {
            "size": "small",
            "variant": "text"
          }
        }, [action]);
      })]) : null;
    },
    renderQuote: function renderQuote() {
      var h = this.$createElement;
      var quote = utils_renderTnode.renderTNodeJSX(this, "quote");
      return quote ? h("div", {
        "class": "".concat(this.componentName, "__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(this.componentName, "__author")
      }, [author && h("span", {
        "class": "".concat(this.componentName, "__name")
      }, [author]), datetime && h("span", {
        "class": "".concat(this.componentName, "__time")
      }, [datetime])]);
    },
    renderContent: function renderContent() {
      var h = this.$createElement;
      return h("div", {
        "class": "".concat(this.componentName, "__content")
      }, [this.renderAuthorDatetime(), h("div", {
        "class": "".concat(this.componentName, "__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(this.componentName, "__avatar")
      }, [typeof avatar === "string" ? h("img", {
        "attrs": {
          "src": avatar,
          "alt": ""
        },
        "class": "".concat(this.componentName, "__avatar-image")
      }) : avatar]) : null;
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": this.componentName
    }, [h("div", {
      "class": "".concat(this.componentName, "__inner")
    }, [this.renderAvatar(), this.renderContent()]), this.renderReply()]);
  }
});

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