"use strict";
const vue = require("vue");
const src_composables_useBreadcrumb_index = require("./src/composables/useBreadcrumb/index.umd.js");
const useDefaults = require("./useDefaults-YXpmugKp.js");
const object = require("./object-DlOVrM-t.js");
const BLink_vue_vue_type_script_setup_true_lang = require("./BLink.vue_vue_type_script_setup_true_lang-B4Fy2Ncx.js");
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
  __name: "BBreadcrumbItem",
  props: {
    ariaCurrent: { default: "location" },
    text: { default: void 0 },
    active: { type: Boolean, default: false },
    activeClass: { default: void 0 },
    disabled: { type: Boolean, default: void 0 },
    exactActiveClass: { default: void 0 },
    href: { default: void 0 },
    icon: { type: Boolean, default: void 0 },
    noRel: { type: Boolean },
    opacity: { default: void 0 },
    opacityHover: { default: void 0 },
    prefetch: { type: Boolean },
    prefetchOn: {},
    noPrefetch: { type: Boolean },
    prefetchedClass: {},
    rel: { default: void 0 },
    replace: { type: Boolean, default: void 0 },
    routerComponentName: { default: void 0 },
    stretched: { type: Boolean, default: false },
    target: { default: void 0 },
    to: { default: void 0 },
    underlineOffset: { default: void 0 },
    underlineOffsetHover: { default: void 0 },
    underlineOpacity: { default: void 0 },
    underlineOpacityHover: { default: void 0 },
    underlineVariant: { default: void 0 },
    variant: { default: void 0 }
  },
  emits: ["click"],
  setup(__props, { emit: __emit }) {
    const _props = __props;
    const props = useDefaults.useDefaults(_props, "BBreadcrumbItem");
    const emit = __emit;
    const computedClasses = vue.computed(() => ({
      active: props.active
    }));
    const computedTag = vue.computed(() => props.active ? "span" : BLink_vue_vue_type_script_setup_true_lang._sfc_main);
    const computedAriaCurrent = vue.computed(() => props.active ? props.ariaCurrent : void 0);
    const computedLinkProps = vue.computed(
      () => computedTag.value !== "span" ? object.pick(props, [
        "active",
        "activeClass",
        "disabled",
        "exactActiveClass",
        "href",
        "icon",
        "noRel",
        "opacity",
        "opacityHover",
        "noPrefetch",
        "prefetch",
        "prefetchOn",
        "prefetchedClass",
        "rel",
        "replace",
        "routerComponentName",
        "stretched",
        "target",
        "to",
        "underlineOffset",
        "underlineOffsetHover",
        "underlineOpacity",
        "underlineOpacityHover",
        "underlineVariant",
        "variant"
      ]) : {}
    );
    const clicked = (e) => {
      if (props.disabled || props.active) {
        e.preventDefault();
        e.stopImmediatePropagation();
        return;
      }
      if (!props.disabled) emit("click", e);
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("li", {
        class: vue.normalizeClass(["breadcrumb-item", computedClasses.value])
      }, [
        (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(computedTag.value), vue.mergeProps({ "aria-current": computedAriaCurrent.value }, computedLinkProps.value, { onClick: clicked }), {
          default: vue.withCtx(() => [
            vue.renderSlot(_ctx.$slots, "default", {}, () => [
              vue.createTextVNode(vue.toDisplayString(vue.unref(props).text), 1)
            ])
          ]),
          _: 3
        }, 16, ["aria-current"]))
      ], 2);
    };
  }
});
const _hoisted_1 = ["id"];
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "BBreadcrumb",
  props: {
    items: { default: void 0 },
    id: { default: void 0 },
    olAttrs: { default: void 0 },
    olClass: { default: void 0 }
  },
  setup(__props) {
    const _props = __props;
    const props = useDefaults.useDefaults(_props, "BBreadcrumb");
    const breadcrumb = src_composables_useBreadcrumb_index.useBreadcrumb(() => props.id || null);
    const breadcrumbItemObjects = vue.computed(() => {
      const localItems = props.items || breadcrumb.items?.value || [];
      let activeDefined = false;
      const items = localItems.map((item, idx) => {
        if (typeof item === "string") {
          item = { text: item };
          if (idx < localItems.length - 1) item.href = "#";
        }
        if (item.active) activeDefined = true;
        if (!item.active && !activeDefined) {
          item.active = idx + 1 === localItems.length;
        }
        return item;
      });
      return items;
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("nav", {
        id: vue.unref(props).id,
        "aria-label": "breadcrumb"
      }, [
        vue.createElementVNode("ol", vue.mergeProps({
          class: ["breadcrumb", vue.unref(props).olClass]
        }, vue.unref(props).olAttrs), [
          vue.renderSlot(_ctx.$slots, "prepend"),
          (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(breadcrumbItemObjects.value, (item, i) => {
            return vue.openBlock(), vue.createBlock(_sfc_main$1, vue.mergeProps({ key: i }, { ref_for: true }, item), {
              default: vue.withCtx(() => [
                vue.createTextVNode(vue.toDisplayString(item.text), 1)
              ]),
              _: 2
            }, 1040);
          }), 128)),
          vue.renderSlot(_ctx.$slots, "default"),
          vue.renderSlot(_ctx.$slots, "append")
        ], 16)
      ], 8, _hoisted_1);
    };
  }
});
exports._sfc_main = _sfc_main;
exports._sfc_main$1 = _sfc_main$1;
//# sourceMappingURL=BBreadcrumb.vue_vue_type_script_setup_true_lang-DKzpYT5X.js.map
