"use client";
import { MessageRecordObjectDetail } from "../defaults/MessageRecordObjectDetail.js";
import { MessageRecordObjectPreview } from "./../defaults/MessageRecordObjectPreview.js";
const listItemComponents = /* @__PURE__ */ new Map();
const contentComponents = /* @__PURE__ */ new Map();
const actionsComponents = /* @__PURE__ */ new Map();
const objectDetailComponents = /* @__PURE__ */ new Map();
const objectPreviewComponents = /* @__PURE__ */ new Map();
function getObjectDetailComponentKey(entityModule, entityType) {
  return `${entityModule}:${entityType}`;
}
function configureMessageUiComponentRegistry(registry) {
  listItemComponents.clear();
  contentComponents.clear();
  actionsComponents.clear();
  objectDetailComponents.clear();
  objectPreviewComponents.clear();
  for (const [key, component] of Object.entries(registry.listItemComponents ?? {})) {
    listItemComponents.set(key, component);
  }
  for (const [key, component] of Object.entries(registry.contentComponents ?? {})) {
    contentComponents.set(key, component);
  }
  for (const [key, component] of Object.entries(registry.actionsComponents ?? {})) {
    actionsComponents.set(key, component);
  }
  for (const [key, component] of Object.entries(registry.objectDetailComponents ?? {})) {
    objectDetailComponents.set(key, component);
  }
  for (const [key, component] of Object.entries(registry.objectPreviewComponents ?? {})) {
    objectPreviewComponents.set(key, component);
  }
}
function getMessageUiComponentRegistry() {
  return {
    listItemComponents: Object.fromEntries(listItemComponents.entries()),
    contentComponents: Object.fromEntries(contentComponents.entries()),
    actionsComponents: Object.fromEntries(actionsComponents.entries()),
    objectDetailComponents: Object.fromEntries(objectDetailComponents.entries()),
    objectPreviewComponents: Object.fromEntries(objectPreviewComponents.entries())
  };
}
function getMessageUiComponentForListItem(key) {
  if (!key) return null;
  return listItemComponents.get(key) ?? null;
}
function getMessageUiComponentForContent(key) {
  if (!key) return null;
  return contentComponents.get(key) ?? null;
}
function getMessageUiComponentForActions(key) {
  if (!key) return null;
  return actionsComponents.get(key) ?? null;
}
function getMessageUiComponentForObjectDetail(entityModule, entityType) {
  if (!entityModule || !entityType) return MessageRecordObjectDetail;
  const key = getObjectDetailComponentKey(entityModule, entityType);
  return objectDetailComponents.get(key) ?? MessageRecordObjectDetail;
}
function getMessageUiComponentForObjectPreview(entityModule, entityType) {
  if (!entityModule || !entityType) {
    return objectPreviewComponents.get("messages:default") ?? MessageRecordObjectPreview;
  }
  const key = getObjectDetailComponentKey(entityModule, entityType);
  const component = objectPreviewComponents.get(key);
  return component ?? objectPreviewComponents.get("messages:default") ?? MessageRecordObjectPreview;
}
export {
  configureMessageUiComponentRegistry,
  getMessageUiComponentForActions,
  getMessageUiComponentForContent,
  getMessageUiComponentForListItem,
  getMessageUiComponentForObjectDetail,
  getMessageUiComponentForObjectPreview,
  getMessageUiComponentRegistry
};
//# sourceMappingURL=typeUiRegistry.js.map
