import { computed, unref } from "vue";
import { consoleError } from "../../utils";
import { useIcons } from "../icons";
import { IconComponent } from "../../components/icon/icon-component";
const useIcon = (props) => {
  const icons = useIcons();
  const iconData = computed(() => {
    const { icon: value } = unref(props);
    if (!value) {
      consoleError("Icon value is undefined or null");
      return;
    }
    const icon = typeof value === "string" && value.includes("$") ? icons.aliases?.[value.slice(value.indexOf("$") + 1)] : value;
    if (!icon) {
      consoleError(`Could not find aliased icon "${value}"`);
      return;
    }
    if (typeof icon !== "string")
      return { component: IconComponent, icon };
    const setName = Object.keys(icons.sets).find((v) => icon.startsWith(`${v}:`));
    return {
      component: icons.sets[setName ?? icons.defaultSet],
      icon: setName ? icon.slice(setName.length + 1) : icon
    };
  });
  return { iconData };
};
export {
  useIcon
};
//# sourceMappingURL=use-icon.mjs.map
