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/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.ts
var floorMapResourcePickerDisplay_exports = {};
__export(floorMapResourcePickerDisplay_exports, {
  buildResourceCapacityBadge: () => buildResourceCapacityBadge,
  floorMapResourcePickerRecordSearchText: () => floorMapResourcePickerRecordSearchText,
  getFloorMapCardPickerCategoryConfig: () => getFloorMapCardPickerCategoryConfig,
  getFloorMapResourcePickerCardMeta: () => getFloorMapResourcePickerCardMeta,
  getFloorMapResourcePickerCategoryPath: () => getFloorMapResourcePickerCategoryPath,
  resolveResourcePickerCapacity: () => resolveResourcePickerCapacity
});
module.exports = __toCommonJS(floorMapResourcePickerDisplay_exports);
var import_react = __toESM(require("react"));
var import_icons = require("@ant-design/icons");
var import_floorMapDataRecordLabel = require("./floorMapDataRecordLabel");
var import_floorMapResourcePickerTypes = require("./floorMapResourcePickerTypes");
function pickField(record, key) {
  const raw = record[key];
  if (raw == null) return null;
  const t = String(raw).trim();
  return t ? t : null;
}
function resolveResourcePickerCapacity(record) {
  const raw = pickField(record, "capacityLabel") ?? pickField(record, "capacity");
  if (!raw) return void 0;
  const num = Number(raw);
  if (!Number.isNaN(num) && num <= 0) return void 0;
  return raw;
}
function resolveReservationAreaRaw(record) {
  return pickField(record, "area");
}
function getFloorMapResourcePickerCategoryPath(record) {
  return (0, import_floorMapResourcePickerTypes.parseNestedPathSegments)(resolveReservationAreaRaw(record), 3);
}
function getFloorMapCardPickerCategoryConfig() {
  return {
    mode: "nested",
    levels: [{}, {}, {}],
    getCategoryPath: getFloorMapResourcePickerCategoryPath
  };
}
function buildResourceCapacityBadge(capacity) {
  if (!capacity) return null;
  return {
    text: capacity,
    icon: import_react.default.createElement(import_icons.TeamOutlined, { "aria-hidden": true })
  };
}
function getFloorMapResourcePickerCardMeta(record) {
  const title = (0, import_floorMapDataRecordLabel.formatDataRecordOptionLabel)(record);
  const idStr = String(record.id ?? "").trim();
  const capacity = resolveResourcePickerCapacity(record);
  const capacityBadge = buildResourceCapacityBadge(capacity);
  return {
    id: idStr,
    title,
    subtitles: [],
    badges: capacityBadge ? [capacityBadge] : []
  };
}
function floorMapResourcePickerRecordSearchText(record) {
  const meta = getFloorMapResourcePickerCardMeta(record);
  const areaRaw = resolveReservationAreaRaw(record);
  const badgeTexts = (meta.badges ?? []).map((b) => b.text);
  return [meta.title, areaRaw, ...badgeTexts, ...meta.subtitles, meta.id].filter(Boolean).join(" ").toLowerCase();
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  buildResourceCapacityBadge,
  floorMapResourcePickerRecordSearchText,
  getFloorMapCardPickerCategoryConfig,
  getFloorMapResourcePickerCardMeta,
  getFloorMapResourcePickerCategoryPath,
  resolveResourcePickerCapacity
});
