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);

// src/components/pisellFloorMapLayout/utils/floorMapElementNameAsTitle.ts
var floorMapElementNameAsTitle_exports = {};
__export(floorMapElementNameAsTitle_exports, {
  NAME_AS_TITLE_EXT_KEY: () => NAME_AS_TITLE_EXT_KEY,
  buildNameAsTitleExtensionsPatch: () => buildNameAsTitleExtensionsPatch,
  isElementNameAsTitleEnabled: () => isElementNameAsTitleEnabled,
  resolveSceneElementDisplayTitle: () => resolveSceneElementDisplayTitle
});
module.exports = __toCommonJS(floorMapElementNameAsTitle_exports);
var NAME_AS_TITLE_EXT_KEY = "nameAsTitle";
function isElementNameAsTitleEnabled(el) {
  var _a;
  if (!el) return false;
  const v = (_a = el.extensions) == null ? void 0 : _a[NAME_AS_TITLE_EXT_KEY];
  return v === true;
}
function buildNameAsTitleExtensionsPatch(prev, enabled) {
  const base = { ...prev ?? {} };
  if (enabled) {
    base[NAME_AS_TITLE_EXT_KEY] = true;
  } else {
    delete base[NAME_AS_TITLE_EXT_KEY];
  }
  return Object.keys(base).length > 0 ? base : void 0;
}
function resolveSceneElementDisplayTitle(opts) {
  const { sceneElement, recordTitle, fallback } = opts;
  const elName = (sceneElement == null ? void 0 : sceneElement.name) != null ? String(sceneElement.name).trim() : "";
  const rt = recordTitle != null ? String(recordTitle).trim() : "";
  const fb = fallback != null ? String(fallback).trim() : "";
  if (isElementNameAsTitleEnabled(sceneElement) && elName) {
    return elName;
  }
  return rt || elName || fb || "";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  NAME_AS_TITLE_EXT_KEY,
  buildNameAsTitleExtensionsPatch,
  isElementNameAsTitleEnabled,
  resolveSceneElementDisplayTitle
});
