/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

import { renderLNodeJSX } from '../../utils/render-node.js';
import { getClassPrefixMixins } from '../config-provider/config-receiver.js';
import mixins from '../../utils/mixins.js';
import props from './props.js';
import 'vue';
import 'lodash';
import 'lodash/mergeWith';
import '../config-provider/context.js';
import '../../chunks/zh_CN.js';
import '../config-provider/type.js';

const classPrefixMixins = getClassPrefixMixins("comment");
var _Comment = mixins(classPrefixMixins).extend({
  name: "LComment",
  props,
  methods: {
    renderReply() {
      const h = this.$createElement;
      const reply = renderLNodeJSX(this, "reply");
      return reply ? h("div", {
        "class": `${this.componentName}__reply`
      }, [reply]) : null;
    },
    renderActions() {
      const h = this.$createElement;
      const actions = renderLNodeJSX(this, "actions");
      return actions && actions.length ? h("ul", {
        "class": `${this.componentName}__actions`
      }, [actions.map((action, index) => h("li", {
        "key": `action-${index}`
      }, [action]))]) : null;
    },
    renderQuote() {
      const h = this.$createElement;
      const quote = renderLNodeJSX(this, "quote");
      return quote ? h("div", {
        "class": `${this.componentName}__quote`
      }, [quote]) : null;
    },
    renderAuthorDatetime() {
      const h = this.$createElement;
      const author = renderLNodeJSX(this, "author");
      const datetime = renderLNodeJSX(this, "datetime");
      return (author || datetime) && h("div", {
        "class": `${this.componentName}__author`
      }, [author && h("span", {
        "class": `${this.componentName}__name`
      }, [author]), datetime && h("span", {
        "class": `${this.componentName}__time`
      }, [datetime])]);
    },
    renderContent() {
      const h = this.$createElement;
      return h("div", {
        "class": `${this.componentName}__content`
      }, [this.renderAuthorDatetime(), h("div", {
        "class": `${this.componentName}__detail`
      }, [renderLNodeJSX(this, "content")]), this.renderQuote(), this.renderActions()]);
    },
    renderAvatar() {
      const h = this.$createElement;
      const avatar = renderLNodeJSX(this, "avatar");
      return avatar ? h("div", {
        "class": `${this.componentName}__avatar`
      }, [typeof avatar === "string" ? h("img", {
        "attrs": {
          "src": avatar,
          "alt": ""
        },
        "class": `${this.componentName}__avatar-image`
      }) : avatar]) : null;
    }
  },
  render() {
    const h = arguments[0];
    return h("div", {
      "class": this.componentName
    }, [h("div", {
      "class": `${this.componentName}__inner`
    }, [this.renderAvatar(), this.renderContent()]), this.renderReply()]);
  }
});

export { _Comment as default };
//# sourceMappingURL=comment.js.map
