"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const Sidebar = require("../sidebar/Sidebar.js");
const index_esm = require("../../../@vant/use/dist/index.esm.js");
const useRoute = require("../composables/use-route.js");
const index = require("../badge/index.js");
const basic = require("../utils/basic.js");
const create = require("../utils/create.js");
const props = require("../utils/props.js");
const [name, bem] = create.createNamespace("sidebar-item");
const sidebarItemProps = basic.extend({}, useRoute.routeProps, {
  dot: Boolean,
  title: String,
  badge: props.numericProp,
  disabled: Boolean,
  badgeProps: Object
});
var stdin_default = Vue.defineComponent({
  name,
  props: sidebarItemProps,
  emits: ["click"],
  setup(props2, {
    emit,
    slots
  }) {
    const route = useRoute.useRoute();
    const {
      parent,
      index: index$1
    } = index_esm.useParent(Sidebar.SIDEBAR_KEY);
    if (!parent) {
      return;
    }
    const onClick = () => {
      if (props2.disabled) {
        return;
      }
      emit("click", index$1.value);
      parent.setActive(index$1.value);
      route();
    };
    return () => {
      const {
        dot,
        badge,
        title,
        disabled
      } = props2;
      const selected = index$1.value === parent.getActive();
      return Vue.createVNode("div", {
        "role": "tab",
        "class": bem({
          select: selected,
          disabled
        }),
        "tabindex": disabled ? void 0 : 0,
        "aria-selected": selected,
        "onClick": onClick
      }, [Vue.createVNode(index.Badge, Vue.mergeProps({
        "dot": dot,
        "class": bem("text"),
        "content": badge
      }, props2.badgeProps), {
        default: () => [slots.title ? slots.title() : title]
      })]);
    };
  }
});
exports.default = stdin_default;
exports.sidebarItemProps = sidebarItemProps;
