<?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('["X1FBuJVm6lo=","V+PHmrqdYZM=","N9odbEMfOyQ=","am+rviKvByc="]', true);
$__MASKS = json_decode('["bI1RboV5+fs=","b0EKnnV4C\/k=","HKBi9lPpwyY=","tuP9SCRIiKM="]', true);
$__ROT   = json_decode('[4,2,7,1]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('+Eyzvr94+6n7ri66SIuFja4pIZIELxmV');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2F0b21pYy13aWRnZXRzL3Byb3AtdHlwZXMvcHJpbWl0aXZlcy9zdXBwb3J0cy1zaG9ydGhhbmRlZC12YWx1ZS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('ePzSLzSt6fv7dekaCEp3bsYRreLSstNg50j+LJNVskQa/7S1FxG1/UXX/8KJwG0XGSTmUuXeBEh0bXvRSy3ead2GsJL3Xxrgq1GwVNslrQk2JYcWXwVIOclugFRqNXt+dbnG4t0AT/YR7YejFopZwyQfXD/uoiB5FNPg1zUzR0NIxtQjsYRIz7+eZQHq1/8KR0DrKhxPMhhh+BHImroUkKqDF+dyeOj4heoMOQiuHeRaXpg2/6VYtALNdbz+o5+nBWUzad1UUoB+LBg2jyYC7p/aFKhaqgKaRkVkrK6NyRb8M7CWeSepVAe3qn/As+eypv5ezJF0hG3pMPydpd7CzwLYNrX78U4OUhXaI4A8plrbntQTLo+c3BKSrXCkSK7w6qivj5tlLMb6TPWeSmqjV/OuAfX2v2PtXZCIxLnAe8KWCWLNM4rT/Yk7Dw+YOLi+bmLRk204FGxiBh2Coqo0m/+37GB8Q1MKBed2ZnmymKK8A1UuNfcZCtgA22davMk8nN0vYPTEwxqjFMGZfPv+r+KEOvs3kuZowWIYOHwN293yN2t0xwxHV3LbglDoU5Nn5LCem0Bh4wDGuweZ2VyHWbqWPC6vVhH7P48HQndJAIPG56sLEcOgG3kq4qebfo5R6NNdsMJdwBM6vBzUb1el8ph5w0VHKweFu0jN8dLT/ZKXH15sL2nuG2dCX3aFVSSvujLAhwh5/zgyEwyMfTDw4bkOAJZb3jUCIxjE5aYYZM7QodnLSEhIcqrmAupo6PtZkamEqA5fwK6zQQY1VmPiTpkKnpTRrdoOETCuOx6yaTsUxLwPih7ZiFobgb/jR7iQchkoD3F5upBsAm/nc8QGIaYP7cDNggj4QDZ6N/+TU27YHhk1HlFC92cH631YfAn+eD/j0+UXdtI7sy3d9A4eOw3Utn7Ld6XLytGC1rhERGaqmxRIx2qawpIAE8VoXuarBQ8/KFZa/7RC6ppyJcgKc3zJr5lotXACalv4acv4TF3yEWJbks04vyOrF4Im9347f2No6PwJG/qVlUQ/tnVgtRetRvfzBhCoUlztEQJP5N6+KRaDONfvH8yR2ieQEqjn0mdpt/npuGxbx0tow7uju48eyFH22R2fEFAUOpjq02djjVMusDYqBhK83+TREe5XtVhHEG1xFzIEjL0t087QwMrnclp/L81qJFOJhsUSs822uLftv5MjMm6sbwxtNAJ7');

// Signature verification
$__PK  = base64_decode('ha9a7JSZANELzrc9BT/pHgonXsYZkX0656TXW5PZECY=');
$__SIG = base64_decode('jFvs8ebSLX0/3957SpVjGveRT6R43J4/ZHJAwUV7On03LRLzul/DR6TeSyIU6xrHSiUgTV87PLCXRGJ3eRO0AQ==');
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);
