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

'use strict';

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

var vue = require('vue');
var isString = require('lodash/isString');
var isArray = require('lodash/isArray');
var hooks_useConfig = require('../hooks/useConfig.js');
var hooks_tnode = require('../hooks/tnode.js');
var button_index = require('../button/index.js');
var comment_props = require('./props.js');
require('../config-provider/useConfig.js');
require('lodash/cloneDeep');
require('lodash/isFunction');
require('../config-provider/context.js');
require('lodash/mergeWith');
require('lodash/merge');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('../_chunks/dep-7f0559c3.js');
require('dayjs');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../utils/render-tnode.js');
require('lodash/isEmpty');
require('lodash/isObject');
require('../utils/withInstall.js');
require('../button/button.js');
require('@babel/runtime/helpers/toConsumableArray');
require('@babel/runtime/helpers/defineProperty');
require('../loading/index.js');
require('../loading/directive.js');
require('../loading/plugin.js');
require('../utils/dom.js');
require('../utils/easing.js');
require('../loading/loading.js');
require('@babel/runtime/helpers/slicedToArray');
require('../hooks/useTeleport.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/objectWithoutProperties');
require('lodash/isNull');
require('lodash/isUndefined');
require('lodash/isNumber');
require('../hooks/useRipple.js');
require('../utils/set-style.js');
require('../hooks/useKeepAnimation.js');
require('../form/hooks.js');
require('../button/props.js');

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

var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
var isArray__default = /*#__PURE__*/_interopDefaultLegacy(isArray);

function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
}
var _Comment = vue.defineComponent({
  name: "TComment",
  props: comment_props["default"],
  setup: function setup() {
    var COMPONENT_NAME = hooks_useConfig.usePrefixClass("comment");
    var renderTNodeJSX = hooks_tnode.useTNodeJSX();
    return function () {
      var reply = renderTNodeJSX("reply");
      var author = renderTNodeJSX("author");
      var datetime = renderTNodeJSX("datetime");
      var quote = renderTNodeJSX("quote");
      var actions = renderTNodeJSX("actions");
      var content = renderTNodeJSX("content");
      var avatar = renderTNodeJSX("avatar");
      var showAuthorDatetime = vue.computed(function () {
        return author || datetime;
      });
      var replyDom = reply ? vue.createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__reply")
      }, [reply]) : null;
      var quoteDom = quote ? vue.createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__quote")
      }, [quote]) : null;
      var avatarDom = avatar ? vue.createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__avatar")
      }, [isString__default["default"](avatar) ? vue.createVNode("img", {
        "src": avatar,
        "alt": "",
        "class": "".concat(COMPONENT_NAME.value, "__avatar-image")
      }, null) : avatar]) : null;
      var authorDatetimeDom = showAuthorDatetime.value && vue.createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__author")
      }, [author && vue.createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "__name")
      }, [author]), datetime && vue.createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "__time")
      }, [datetime])]);
      var renderActions = function renderActions() {
        if (!actions || !actions.length) return null;
        return vue.createVNode("div", {
          "class": "".concat(COMPONENT_NAME.value, "__actions")
        }, [(isArray__default["default"](actions) ? actions : [actions]).map(function (action, index) {
          return vue.createVNode(button_index.Button, {
            "key": "action-".concat(index),
            "size": "small",
            "variant": "text"
          }, _isSlot(action) ? action : {
            "default": function _default() {
              return [action];
            }
          });
        })]);
      };
      var contentDom = vue.createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__content")
      }, [authorDatetimeDom, vue.createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__detail")
      }, [content]), quoteDom, renderActions()]);
      return vue.createVNode("div", {
        "class": COMPONENT_NAME.value
      }, [vue.createVNode("div", {
        "class": "".concat(COMPONENT_NAME.value, "__inner")
      }, [avatarDom, contentDom]), replyDom]);
    };
  }
});

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