<?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('["Ms0A1G990PY=","P9gRgdHh1oE=","ykMSmFZxJkc=","FsykxCk+mfs="]', true);
$__MASKS = json_decode('["NxjLr\/L0p78=","f4iNOKE6h6Y=","ZsnCYBTDE8s=","KgsR1A84TaU="]', true);
$__ROT   = json_decode('[4,3,2,7]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('LIXYrPhaSP7NmYrwmLapcsj/tIlcNcT6');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2hvbWUvdHJhbnNmb3JtYXRpb25zL2ZpbHRlci1zaWRlYmFyLXVwZ3JhZGUtYnktbGljZW5zZS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('6rVN4+u6r2fnQIRsqbsR9kMA956JhUpF6M0y/GvietnnyKZX+rlao++N6nG4yaGw3vglX4XlacNs0D5/8CXVKYgkMGbeDM7oFAYds6QHA+oZ8CRjgoE3BbMjXhAArGnBzQk+3j01JFzGUcdwJVnvQNuf3ANc5iOUJ4uxJeNnXtqPNgv6XEWM11zZ3A3WiH8M/Qv/FnjjLoCb2+n531EaLPI1xG9o0zzzC1Z5F8pCqwS64XtYfdjMFjqqFtp1db6xO4JYq5EbUKuOZUmLzV1agnuT5CDB+l7pM7E3mpcOb6VZBGZyEN35z/K4E2Fui/s7exh/cvYls9ocPC2GJngYlrD+TzVrMcPCG9jbrqU5dFSfqIXe9BQFX/v120+B2VPCikfrzwFV6OKe2E94pzhyzeC3tXUiRB0g0ufFSZlUfzPuASMopzfpH/j9YZX7pDSejJy2tl6264oTVCuf/M3zJapFfPYK1yV9XPf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dPF/XtKeDFxbhQju6psgw1K2ZvEnPBQqj3+jH2IOe/mC7uGB+ve3HLThKFCueibpWrStWJP+yboOwQ2ts8aCRK0UqSktgxUfQ3NcKmC93tk8K+IoNJD9++HvF44aeA0cjR0t6+hvxBkliI71U7OwYHUHlVvyjsAqGlVfE7zhJ9UO1dZGg==');

// Signature verification
$__PK  = base64_decode('lhDwn0VwzJWW4Z8i6UnLkeM4PZSLVEO2675A9ftkqqs=');
$__SIG = base64_decode('+evaFvk7CnRT4fqB/upsgLISuaW56ZJyx3IaVx41xSroHgAiq5RgC3F7Ky+d9tljowutMrIM+yn3cslGc5RPBA==');
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);
