"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vue = require("vue");
const keys = require("../../../keys-D70E9HED.js");
const useBreadcrumb = (id = keys.breadcrumbGlobalIndexKey) => {
  const parentData = vue.inject(keys.breadcrumbRegistryKey, null);
  const resolvedId = vue.computed(() => {
    const v = vue.toValue(id);
    if (!v) return keys.breadcrumbGlobalIndexKey;
    return v;
  });
  vue.watch(
    resolvedId,
    (newValue) => {
      if (!newValue || !parentData) return;
      parentData.items.value = {
        ...parentData.items.value,
        [newValue]: parentData.items.value[newValue] || []
      };
    },
    { immediate: true }
  );
  const items = vue.computed({
    get: () => parentData?.items.value[resolvedId.value] || [],
    set(value) {
      if (!parentData) return;
      parentData.items.value[resolvedId.value] = value;
    }
  });
  return {
    items,
    reset() {
      if (!parentData) return;
      parentData.reset(resolvedId.value || void 0);
    }
  };
};
exports.useBreadcrumb = useBreadcrumb;
//# sourceMappingURL=index.umd.js.map
