<?php

$dir = new RecursiveDirectoryIterator(__DIR__ . '/../vendor/filament');
$iterator = new RecursiveIteratorIterator($dir);
$regex = new RegexIterator($iterator, '/^.+\.blade\.php$/i', RecursiveRegexIterator::GET_MATCH);

foreach ($regex as $info) {
    $file = $info[0];
    $content = file_get_contents($file);
    if (str_contains($content, 'actions') && (str_contains($content, 'x-filament-') || str_contains($content, 'x-filament-panels::'))) {
        // Find tags
        preg_match_all('/<x-filament-[^\s>]+/i', $content, $matches);
        if (!empty($matches[0])) {
            $relative = str_replace(realpath(__DIR__ . '/..'), '', realpath($file));
            echo "File $relative matches:\n";
            foreach (array_unique($matches[0]) as $tag) {
                echo "  $tag\n";
            }
        }
    }
}
