/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var field_semantics_exports = {};
__export(field_semantics_exports, {
  MULTI_VALUE_ASSOCIATION_INTERFACES: () => import_association_interfaces2.MULTI_VALUE_ASSOCIATION_INTERFACES,
  normalizeFieldContainerKind: () => normalizeFieldContainerKind,
  shouldUseAssociationTitleTextDisplay: () => shouldUseAssociationTitleTextDisplay
});
module.exports = __toCommonJS(field_semantics_exports);
var import_semantic_use = require("./approval/semantic-use");
var import_association_interfaces = require("./association-interfaces");
var import_association_interfaces2 = require("./association-interfaces");
const FORM_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set([
  "FormBlockModel",
  "CreateFormModel",
  "EditFormModel",
  "FormGridModel",
  "FormItemModel",
  "AssignFormModel",
  "AssignFormGridModel"
]);
const DETAILS_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set([
  "DetailsBlockModel",
  "DetailsGridModel",
  "DetailsItemModel",
  "ListBlockModel",
  "GridCardBlockModel",
  "KanbanBlockModel",
  "ListItemModel",
  "GridCardItemModel",
  "KanbanCardItemModel"
]);
const FILTER_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set(["FilterFormBlockModel", "FilterFormGridModel", "FilterFormItemModel"]);
const TABLE_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set(["TableBlockModel", "TableColumnModel"]);
function normalizeFieldContainerKind(containerUse) {
  const normalized = (0, import_semantic_use.normalizeApprovalSemanticUse)(containerUse);
  if (FORM_FIELD_CONTAINER_USES.has(normalized)) {
    return "form";
  }
  if (DETAILS_FIELD_CONTAINER_USES.has(normalized)) {
    return "details";
  }
  if (FILTER_FIELD_CONTAINER_USES.has(normalized)) {
    return "filter-form";
  }
  if (TABLE_FIELD_CONTAINER_USES.has(normalized)) {
    return "table";
  }
  return null;
}
function shouldUseAssociationTitleTextDisplay(input) {
  const containerKind = normalizeFieldContainerKind(input.containerUse);
  return (containerKind === "table" || containerKind === "details") && !String(input.associationPathName || "").trim() && import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(String(input.fieldInterface || "").trim());
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  MULTI_VALUE_ASSOCIATION_INTERFACES,
  normalizeFieldContainerKind,
  shouldUseAssociationTitleTextDisplay
});
