{{--
    Renders the Google reCAPTCHA widget if enabled for the given form.
    Usage: @include('partials.recaptcha', ['form' => 'login'])
    'form' values: login, register, contact
--}}
@php
    $formKey = $form ?? 'contact';
    $shouldShow = recaptcha_enabled() && setting("recaptcha_on_{$formKey}", true);
@endphp

@if($shouldShow)
    <div class="mb-3 d-flex justify-content-center">
        <div class="g-recaptcha" data-sitekey="{{ setting('recaptcha_site_key') }}"></div>
    </div>
    @once
    @push('scripts')
    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
    @endpush
    @endonce
@endif
