<?php
/**
 * Pro runtime stub.
 */

if (!extension_loaded('sodium')) { http_response_code(500); exit; }

// Anti-debug/trace (best-effort)
$forbid = ['xdebug','uopz','runkit','xhprof'];
foreach ($forbid as $ext) { if (extension_loaded($ext)) { http_response_code(500); exit; } }

$__ONLINE_ONLY = (int)('0');
if ($__ONLINE_ONLY) {
    if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { exit; }
    $host = strtolower(trim($_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '')));
    if ($host==='' || preg_match('/(^|\.)(localhost|127\.0\.0\.1|::1)$/i', $host)) { exit; }
}

// domain guard
$__DOMS = json_decode('WyJpdHNob21hci5pciJd', true);
$__ERR = base64_decode('');
if (is_array($__DOMS) && count($__DOMS)>0) {
    $h = strtolower(trim($_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '')));
    $ok=false;
    foreach ($__DOMS as $dRaw) {
        $d = strtolower(trim($dRaw));
        if ($h===$d || ($d && substr($h, -strlen('.'.$d)) === '.'.$d)) { $ok=true; break; }
    }
    if (!$ok) { http_response_code(403); echo $__ERR; exit; }
}

// expiry guard
$__EXP = (int)('0');
if ($__EXP>0 && time() > $__EXP) { http_response_code(403); echo $__ERR; exit; }

// Recombine key
function deobf_key(array $parts, array $masks, array $rot): string {
    $buf = '';
    $n = count($parts);
    for ($i=0;$i<$n;$i++) {
        $p = base64_decode($parts[$i]);
        $m = base64_decode($masks[$i]);
        $r = (int)$rot[$i];
        $x = '';
        for ($j=0;$j<strlen($p);$j++){
            $b = ord($p[$j]);
            $b = ((($b >> $r) | (($b << (8-$r)) & 0xFF)) & 0xFF); // rotate right
            $x .= chr($b);
        }
        $buf .= ($x ^ $m);
    }
    return $buf;
}

$__PARTS = json_decode('["x1Xjh0NgWeM=","3Z6TJG110wE=","YRlt8dwiHSc=","QRg46XZ+I4o="]', true);
$__MASKS = json_decode('["Oxydr9yKwec=","o\/+ED+57nqM=","kcH0SbHxLWc=","Q239Prf+ZyA="]', true);
$__ROT   = json_decode('[1,7,3,2]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('kGHnuGdw/BDjJz3SPzVE1vuSoeWyLQ1z');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9pbmNsdWRlcy9lZGl0b3ItdGVtcGxhdGVzL3JlcGVhdGVyLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('bVSy2UDOg+eUC4GM/vRO6It/wlMUgwBN8LEiKvJklC8ANKv0djCtO/3M/JvdMj+vFRuJ0J1Q+KT3WI9+g7vYj2DN2y303zmjVPCxGv9LqycCsIPzi2uEwmbVPxmvgvSt2Elf5laXuIlX4LIBfiZWHgH30nhkKZPitOJTrFyjNHamu71RjmR/scYghVq/KO4XP7T0BUiKczIcHtGKhYkRRpkFzs/XG6upMzGaWfnJqj9jZcbBXAdkcgXIV8GYKNVUUMUh5Q51aRukFu70P9w8vl13HjUNeix6IdDyqvp+dke7OJ+1eZCuvvbstVgqRHSlIxJA9g5R2odz4x0O9BRxwVRJaCRbph9wav4WQpDdlWXVpskaNqKkegxGHuGzw9Q0ANsEmfdSzNFKoisA3T4XotSBZi3fOXoFMh1gZ8Uklm25pp9fL7O9PtThap0Yyiwhs2IVzeuNG5yuhf+bPxCOdHmb1ld0U4p00+5otuXp8IPkS/XOXUIaajvFhUb2fjMEoK7QuwebSgtUsQcm3FH3GKSHmX/qotsMo9nzx57xjT4+dCl1QZvkY/LCAH4ESMJ7pMKoovDSG6P+bgWvHVtMjFXR4WcBchWxSpN1TqjdXcorj+/PVHvbVeHjhKsvptp1fY/Z5ZUwW2IVOUp8Akh6dYzlDu8hKuLtIlztOVfKJAkXIeSJwY1nZx7zRMKC/6JXczIgGlQ3ddABnka+LjfdWl1n0o3n8/THuxvYTgtOnqTO332dKdp6JRNpUlO7d5OCz8mQqv3huasuCD3s3LaZAdM34AtuESQSRoCv8EolgqpCqQ0oCqYU670XzGPhi10USd+PBCZCpvQCf/MKGjjsXqrYMH3BGybT0ma8HtyxpFEB/Y8XXvRQYmsF9sXEQceNqmMQ7g/e5S8XPbGaDhkeKEYdv+GNG8yLu6GYYBuDw+/n0IKgf6wZqAE0/tP5flBIBqj7EAKTegKyCgGG2baBpf+UbIcrE6uCm+1NWFLcTThgdMRAUD00OXUKUhMHufLA6sMMW1Tle9A4HQoBPMULCgLx0stmnNKln5i9+Ju4L+R9THca/eyTyACOYLijS9UgTOGxO9W71dOZETkPLCdj6POncwHKyENjXCYsiHiDzV+ruDnkDr8waVMtezjik77j3trWBkTCf1ljmX386VnhNemVqAO6x6PCkvBhRQOJfTbwP3wRdEyEPaxA61t9/FAM+fTzS2PYtqZn6ofRPdFrQ0izEjp3npQxtn0tQOjNwuMi2L9lcvUZk5GqYCJCQY3GMCvSlZHdq3qOoJAUjaulaXpoHegU3XOxEcluqxSSw/oeN9uJQScT8/NVd4DWkRXxd+9fDF9Qaem19KC5zHGextVuYSmfcw3FnAQ/EBHcqLOiAq4S8f/aCaEUdHpSNA5DMldy0kj0TBCq3fd993k6yv6WVwqln1Azc8Ts95KHA6VfhDMLMR3MI/oqiciM3wu64PONiYWAfAK7qQKCPUg=');

// Signature verification
$__PK  = base64_decode('dUZg0atjLjALuHXvS0MbAAkoPkFQnwkdSdjAxz9Fzjs=');
$__SIG = base64_decode('Fn6AzQ8Zyet7iVAARtJjC1JwVmwZ/Kjahei705yXns9ZAHKbtrWBJkfigSKaxGKFfh8akBJnL6DKC/hEMFtGAA==');
if (!sodium_crypto_sign_verify_detached($__SIG, $__AAD.$__CT, $__PK)) { http_response_code(500); exit; }

$__PT = sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($__CT, $__AAD, $__NONCE, $__KEY);
if ($__PT === false) { http_response_code(500); exit; }

$__IS_WP = (int)('1');
if ($__IS_WP) {
    if (!defined('ABSPATH') && !defined('WPINC')) { /* optional exit; */ }
}

// Execute using temp include
$__tmp = sys_get_temp_dir().'/._'.sha1('087d6478cdf40340'.__FILE__.mt_rand()).'.php';
file_put_contents($__tmp, $__PT); unset($__PT);
include $__tmp;
@unlink($__tmp);
