import { findSkillSelectionMarker, removeSkillSelectionMarker } from '../../shared/skills/invocation.js';
export function parseSkillBlock(text) {
    const legacyMatch = text.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);
    if (legacyMatch) {
        return {
            name: legacyMatch[1],
            location: legacyMatch[2],
            content: legacyMatch[3],
            userMessage: legacyMatch[4]?.trim() || undefined
        };
    }
    const markerMatch = findSkillSelectionMarker(text);
    if (!markerMatch)
        return null;
    return {
        name: markerMatch.name,
        location: '',
        content: '',
        userMessage: removeSkillSelectionMarker(text, markerMatch),
        beforeText: markerMatch.beforeText,
        afterText: markerMatch.afterText,
        markerStart: markerMatch.start,
        markerEnd: markerMatch.end
    };
}
//# sourceMappingURL=skill-block.js.map