<?php
$html = file_get_contents('full_page.html');

// Find "Bosch As Epc" context
$pos = strpos($html, 'Bosch As Epc');
if ($pos !== false) {
    // Get 2000 chars before and after
    $start = max(0, $pos - 1000);
    $chunk = substr($html, $start, 3000);
    file_put_contents('product_context.html', $chunk);
    echo "Context saved to product_context.html\n";
    echo "Length: " . strlen($chunk) . "\n";
}

// Also look for Livewire product data
preg_match('/wire:initial-data="([^"]+)"/', $html, $wireData);
if (!empty($wireData[1])) {
    $data = json_decode(html_entity_decode($wireData[1]), true);
    echo "\nWire data keys: " . implode(', ', array_keys($data)) . "\n";
    if (isset($data['serverMemo']['data'])) {
        echo "Server memo data keys: " . implode(', ', array_keys($data['serverMemo']['data'])) . "\n";
    }
}

// Look for the products container
$pos2 = strpos($html, 'results 54');
if ($pos2 !== false) {
    $afterResults = substr($html, $pos2, 5000);
    file_put_contents('after_results.html', $afterResults);
    echo "\n'results 54' context saved to after_results.html\n";
}
