@php
    $settingsTable = is_array($settingsTable ?? null) ? $settingsTable : null;
    $settingsTableRows = is_array($settingsTable['rows'] ?? null) ? $settingsTable['rows'] : [];
    $context = is_string($context ?? null) && $context !== '' ? $context : 'policy';
    $recordId = is_scalar($recordId ?? null) ? (string) $recordId : null;
    $settingsTableTitle = is_string($settingsTable['title'] ?? null) ? $settingsTable['title'] : null;
    $shouldShowTitle = is_string($settingsTableTitle)
        && $settingsTableTitle !== ''
        && ! ($context === 'policy' && strtolower($settingsTableTitle) === 'settings');
@endphp

<div class="space-y-2" data-shared-zone="settings-table">
    @if ($shouldShowTitle)
        <div class="text-sm font-semibold text-gray-800 dark:text-gray-200">{{ $settingsTableTitle }}</div>
    @endif

    <livewire:settings-catalog-settings-table
        :settings-rows="$settingsTableRows"
        :context="$context"
        :key="$recordId ? ('sc-settings-'.$context.'-'.$recordId) : ('sc-settings-'.$context)"
    />
</div>