@php
$invitation = $this->invitation;
$user = $this->currentUser;
@endphp
{{-- Single root element for Livewire. The auth layout wrapping is
applied by #[Layout('layouts.auth')] on the Show component
class, NOT by an in-view component wrapper. --}}
@if ($invitation === null)
{{-- Unknown token --}}
@elseif ($invitation->isAccepted())
{{ __('Log in') }}
@elseif ($invitation->isExpired())
@elseif ($user !== null && strcasecmp($user->email, $invitation->email) !== 0)
{{-- Wrong logged-in account --}}
@elseif ($user !== null)
{{-- Authenticated and matches: show accept button. --}}
@error('invitation')
@enderror
@elseif ($this->emailHasExistingUser)
{{-- Guest, but email already has a user → log in flow. --}}
{{ __('Log in') }}
@else
{{-- Guest, brand-new user → register form. Email is locked
to the invitation email server-side. --}}
@error('invitation')
@enderror
@endif