// shared/utils/agentTitleText.ts
var markdownLinkPattern = /\[((?:\\.|[^\]\\])*)\]\(([^)\s]+)\)/g;
var markdownLabelEscapePattern = /\\([\\[\]()])/g;
function normalizeAgentTitleText(value) {
  const trimmed = value?.trim() ?? "";
  if (!trimmed) {
    return "";
  }
  const normalized = trimmed.replace(
    markdownLinkPattern,
    (_, label) => unescapeMarkdownLabel(label)
  );
  return normalized.replace(/\s+/g, " ").trim();
}
function unescapeMarkdownLabel(label) {
  return label.replace(markdownLabelEscapePattern, "$1");
}

export {
  normalizeAgentTitleText
};
//# sourceMappingURL=chunk-GCBDIQDX.js.map