// src/pages/categories/common/components/category-image-fields/types.ts
var getCategoryGallery = (images) => (images ?? []).filter((image) => !image.type).sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0));
var getCategoryIcon = (images) => (images ?? []).find((image) => image.type === "icon") ?? null;

// src/pages/categories/common/utils.ts
function getIsActiveProps(isActive, t) {
  switch (isActive) {
    case true:
      return {
        label: t("categories.fields.status.active"),
        color: "green"
      };
    case false:
      return {
        label: t("categories.fields.status.inactive"),
        color: "red"
      };
  }
}
function getIsInternalProps(isInternal, t) {
  switch (isInternal) {
    case true:
      return {
        label: t("categories.fields.visibility.internal"),
        color: "blue"
      };
    case false:
      return {
        label: t("categories.fields.visibility.public"),
        color: "green"
      };
  }
}
function getCategoryPath(category) {
  if (!category) {
    return [];
  }
  const path = category.parent_category ? getCategoryPath(category.parent_category) : [];
  path.push({ id: category.id, name: category.name });
  return path;
}
function getCategoryChildren(category) {
  if (!category || !category.category_children) {
    return [];
  }
  return category.category_children.map((child) => ({
    id: child.id,
    name: child.name
  }));
}

export {
  getCategoryGallery,
  getCategoryIcon,
  getIsActiveProps,
  getIsInternalProps,
  getCategoryPath,
  getCategoryChildren
};
