import { defineComponent, useAttrs, computed, resolveComponent, createElementBlock, openBlock, mergeProps, unref, createVNode, renderSlot, createCommentVNode, createSlots, withCtx, normalizeClass } from 'vue';
import '../../../utils/index.mjs';
import { omit } from 'lodash-es';
import { rateProps } from './rate.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlRate", inheritAttrs: false },
  __name: "rate",
  props: rateProps,
  emits: ["update:value"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const bem = createNamespace("rate");
    const attrs = useAttrs();
    const value = computed({
      get: () => props.value,
      set: (val) => {
        emits("update:value", val);
      }
    });
    const containerAttrs = computed(() => ({
      class: attrs.class,
      style: attrs.style
    }));
    const componentAttrs = computed(() => {
      return { ...omit(attrs, ["class", "style"]) };
    });
    const getStyle = computed(() => ({
      fontSize: props.size + "px",
      color: props.color
    }));
    const getCustomText = computed(() => {
      if (typeof props.customText === "function") {
        return props.customText(value.value);
      }
      return props.customText;
    });
    return (_ctx, _cache) => {
      const _component_a_rate = resolveComponent("a-rate");
      const _component_ll_html = resolveComponent("ll-html");
      return openBlock(), createElementBlock(
        "div",
        mergeProps({
          class: unref(bem).b()
        }, containerAttrs.value),
        [
          createVNode(_component_a_rate, mergeProps({
            value: value.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => value.value = $event)
          }, componentAttrs.value, { style: getStyle.value }), createSlots({
            _: 2
            /* DYNAMIC */
          }, [
            _ctx.$slots.character ? {
              name: "character",
              fn: withCtx(() => [
                renderSlot(_ctx.$slots, "character")
              ]),
              key: "0"
            } : void 0
          ]), 1040, ["value", "style"]),
          _ctx.$slots.customText || _ctx.customText ? renderSlot(_ctx.$slots, "customText", { key: 0 }, () => [
            createVNode(_component_ll_html, {
              class: normalizeClass(unref(bem).e("extra")),
              value: getCustomText.value
            }, null, 8, ["class", "value"])
          ]) : createCommentVNode("v-if", true)
        ],
        16
        /* FULL_PROPS */
      );
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=rate.vue2.mjs.map
