var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/pisellReservation/grid/reservationResourceGridColumns.tsx
var reservationResourceGridColumns_exports = {};
__export(reservationResourceGridColumns_exports, {
  getReservationResourceGridColumns: () => getReservationResourceGridColumns
});
module.exports = __toCommonJS(reservationResourceGridColumns_exports);
var import_utils = require("@pisell/utils");
var import_locales = __toESM(require("../locales/locales"));
var I18N_RES_ID = "pisell-reservation.resource-grid.id";
var I18N_RES_NAME = "pisell-reservation.resource-grid.name";
var I18N_RES_FORM = "pisell-reservation.resource-grid.form-code";
var I18N_RES_CAP = "pisell-reservation.resource-grid.capacity";
var I18N_RES_SCHEDULE = "pisell-reservation.resource-grid.schedule";
var I18N_RES_FORM_ID = "pisell-reservation.resource-grid.form-id";
function initGridLocales(lang) {
  import_utils.locales.init(import_locales.default, lang);
}
function renderSchedule(v) {
  if (v == null) return "—";
  if (Array.isArray(v)) return v.length ? v.join(", ") : "—";
  if (typeof v === "string") return v.trim() || "—";
  return String(v);
}
function getReservationResourceGridColumns(engineLocale) {
  initGridLocales(engineLocale);
  return [
    {
      key: "id",
      title: import_utils.locales.getText(I18N_RES_ID),
      dataIndex: "id",
      width: 88,
      filterable: false,
      sortable: false
    },
    {
      key: "main_field",
      title: import_utils.locales.getText(I18N_RES_NAME),
      dataIndex: "main_field",
      ellipsis: true,
      filterable: false,
      sortable: false,
      render: (v) => {
        var _a;
        const s = typeof v === "string" ? v : "";
        const first = ((_a = s.split(" ## ")[0]) == null ? void 0 : _a.trim()) ?? "";
        return first || "—";
      }
    },
    {
      key: "form_code",
      title: import_utils.locales.getText(I18N_RES_FORM),
      dataIndex: "form_code",
      width: 120,
      ellipsis: true,
      filterable: false,
      sortable: false,
      render: (v) => typeof v === "string" && v.trim() ? v : "—"
    },
    {
      key: "capacity",
      title: import_utils.locales.getText(I18N_RES_CAP),
      dataIndex: "capacity",
      width: 88,
      filterable: false,
      sortable: false,
      render: (v) => v != null && v !== "" ? String(v) : "—"
    },
    {
      key: "schedule",
      title: import_utils.locales.getText(I18N_RES_SCHEDULE),
      dataIndex: "schedule",
      width: 120,
      ellipsis: true,
      filterable: false,
      sortable: false,
      render: (_, record) => renderSchedule(record.schedule)
    },
    {
      key: "form_id",
      title: import_utils.locales.getText(I18N_RES_FORM_ID),
      dataIndex: "form_id",
      width: 96,
      filterable: false,
      sortable: false,
      render: (v) => v != null && v !== "" ? String(v) : "—"
    }
  ];
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getReservationResourceGridColumns
});
