<?php

declare(strict_types=1);

/** @maestro-core-managed — reset via `php artisan core:install --force` */

/*
|--------------------------------------------------------------------------
| SPA catch‑all (required)
|--------------------------------------------------------------------------
|
| Single global fallback so Maestro CORE API routes (/login, /api/*) match first and Vue
| deep links resolve through your Blade shell. Paths under `vendor/maestro/branding/*`
| must hit CORE static routes; **`/api/*`** must resolve to Laravel (session JSON + auth),
| not the SPA shell — otherwise GET/POST to `/api/...` can bind the catch‑all and return
| 405 / HTML for XHR. Do not register a second package-level `/{any?}` — precedence becomes
| host-dependent when duplicates exist.
|
*/

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Exclude packaged static branding from the SPA shell so GET /vendor/maestro/branding/*
| hits Maestro CORE routes registered in routes/core.php (see CoreBrandingAssetController).
|--------------------------------------------------------------------------
*/
Route::get('/{any?}', fn () => view('spa'))->where(
    'any',
    '^(?!vendor/maestro/branding/)(?!api(?:/|$)).*$',
);
