import { defineComponent as b, computed as a, shallowRef as y, useSlots as h, openBlock as B, createBlock as C, unref as t, mergeProps as _, createSlots as x, withCtx as R, renderSlot as k } from "vue";
import { Rate as w } from "@aplus-frontend/antdv";
import { omit as g } from "lodash-unified";
import "../../hooks/index.mjs";
import { useControllableValue as V } from "../../hooks/useControllableValue.mjs";
const A = /* @__PURE__ */ b({
  name: "ApFieldRate",
  __name: "index",
  props: {
    mode: { default: "edit" },
    class: {},
    style: {},
    customReadMode: {},
    prefixCls: {},
    count: { default: 5 },
    value: {},
    allowHalf: { type: Boolean, default: !1 },
    allowClear: { type: Boolean, default: !0 },
    tooltips: {},
    disabled: { type: Boolean, default: void 0 },
    character: { default: void 0 },
    autofocus: { type: Boolean, default: !1 },
    keyboard: { type: Boolean },
    tabindex: {},
    direction: {},
    id: {},
    onChange: {},
    onHoverChange: {},
    "onUpdate:value": {},
    onFocus: {},
    onBlur: {},
    onKeydown: {},
    size: {},
    defaultValue: {}
  },
  emits: ["update:value"],
  setup(l, { expose: r, emit: u }) {
    const e = l, n = a(() => g(e, ["mode", "defaultValue"])), o = y(), s = u, d = h(), { value: c, updateValue: f } = V(e, s), i = a(() => e.mode === "read" ? !0 : e.disabled);
    function p() {
      o.value?.focus?.();
    }
    function m() {
      o.value?.blur?.();
    }
    return r({
      focus: p,
      blur: m
    }), (v, S) => (B(), C(t(w), _(n.value, {
      ref_key: "rateRef",
      ref: o,
      value: t(c),
      disabled: i.value,
      "onUpdate:value": t(f)
    }), x({ _: 2 }, [
      d.character ? {
        name: "character",
        fn: R(() => [
          k(v.$slots, "character")
        ]),
        key: "0"
      } : void 0
    ]), 1040, ["value", "disabled", "onUpdate:value"]));
  }
});
export {
  A as default
};
