{"version":3,"file":"get-plain-text.cjs","names":["walkMentions"],"sources":["../../../../src/components/Mentions/utils/get-plain-text.ts"],"sourcesContent":["/*\n * Derived from react-mentions 4.4.10 (https://github.com/signavio/react-mentions)\n * — BSD-3-Clause, Copyright (c) 2018 Signavio GmbH. See ../LICENSE for the full license text.\n *\n * Local changes compared to react-mentions 4.4.10:\n * - Derived from the spans of walkMentions instead of an iterateMentionsMarkup callback\n * - getIdText renders each mention with its id (react-mentions getPlainText renders display)\n * - The trigger prefix is part of the plain text only when withTrigger is set\n * - TypeScript types adjusted for the Mantine build, formatted with oxfmt\n */\n\nimport type { MentionConfig } from './types';\nimport { walkMentions, type MentionWalk } from './walk-mentions';\n\nexport function getPlainText(value: string, configs: MentionConfig[]): string {\n  return walkMentions(value, configs).plainText;\n}\n\nexport function getIdText({ value, spans }: MentionWalk, configs: MentionConfig[]): string {\n  let result = '';\n  let markupCursor = 0;\n\n  for (const span of spans) {\n    result += value.slice(markupCursor, span.markupStart);\n    result += (configs[span.sourceIndex].withTrigger ? span.trigger : '') + span.id;\n    markupCursor = span.markupEnd;\n  }\n\n  return result + value.slice(markupCursor);\n}\n"],"mappings":";;;AAcA,SAAgB,aAAa,OAAe,SAAkC;CAC5E,OAAOA,sBAAAA,aAAa,OAAO,OAAO,CAAC,CAAC;AACtC;AAEA,SAAgB,UAAU,EAAE,OAAO,SAAsB,SAAkC;CACzF,IAAI,SAAS;CACb,IAAI,eAAe;CAEnB,KAAK,MAAM,QAAQ,OAAO;EACxB,UAAU,MAAM,MAAM,cAAc,KAAK,WAAW;EACpD,WAAW,QAAQ,KAAK,YAAY,CAAC,cAAc,KAAK,UAAU,MAAM,KAAK;EAC7E,eAAe,KAAK;CACtB;CAEA,OAAO,SAAS,MAAM,MAAM,YAAY;AAC1C"}