@php
    $action = is_string($action ?? null) ? $action : '';
    $before = $action;
    $prompt = null;
    $after = '';

    if (preg_match('/^(.*?)(?:Image prompt(?: \(text only\))?:\s*)(.+?)(\s*The studio makes the still\..*)?$/su', $action, $match) === 1) {
        $before = trim($match[1]);
        $prompt = trim($match[2]);
        $after = trim((string) ($match[3] ?? ''));
    }
@endphp
@if ($before !== '')
    <span class="mb-perf-action-text">{{ $before }}</span>
@endif
@if (is_string($prompt) && $prompt !== '')
    <pre class="mb-perf-prompt"><code>{{ $prompt }}</code></pre>
@endif
@if ($after !== '')
    <span class="mb-perf-action-note">{{ $after }}</span>
@endif
