<?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('["5sp3vsodZjg=","9OU8XjLbc\/o=","quALKu\/ZfSM=","pKVssH61Qwg="]', true);
$__MASKS = json_decode('["yAE4IUL1Vww=","yqV48VBjgGc=","BIcp2r6Ky+M=","GFuHoaI1Zq8="]', true);
$__ROT   = json_decode('[4,7,1,2]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('rQFOBzWEhwCzfOHQHLNbJT7L2upoY3NB');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2xvZ2dlci9pdGVtcy9qcy5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('iWeTyp0jP4MHyvsCo2d+lB879a2s6P4Tl2nvbQieUt2wpRU02Wec49b6frFiqJ+W8X4iS5tIT0DO7HfvDupwzFlJNVn9V5iXfm4Sip7sFn8aw70CML9Mtnfzv97ZELzF4vmEd2UC74lKykC5UBjgPJj5CH7Wrf4sjK0xD/X6B1U93zw+GJbwHuEHflCrLsHovCdvSia/HfO5BjLlXoxWc3fUZ6E41ZLqBtYboTJpRKJVlC9pSeKy5YsNesx7XvKOpnSSMa/ARH0nx7CWaN2ZWHuBHvSLyY1BsUw5dYgdgUgyyT83wOuN+kj43P2h9cf0E9/mSm3et2YpIa4M4cTSG6nOVSyg3V/xWTioOJecUgjR/mTa49aEGf+E7hgKhxcSy9fKiBACdckzfp3qPA7WWfSoeXBupeOgp+VhvetCpHhB3YTIhKaCh00yaxO90WKFwoFZ3FmPttpScVMgkVSQxB6Dx0KbWn6VsAElXEQb8BRcQ1cJt1u1lhAlUGAwYKz+5VN971+8FR7Wsqpv4csq/kAUQHZ43BFFcJ3H35danI+Ruf2TaZ0VgZBXhZvgWLoK0Iisks74urSLT3ETYq9qVCFMfFbSI9NbKicC9xaE+c4ufKhfTbyYgxDG6fQ4PZkMIzbNebeviQi0RvKh7UPJ+h0iCdASZMhC24fwgQie1G1Gs9Igpslv1RjvkF9tQFhU0Vf61/Cd6XEUbb9XrNFx2Qi9VaNjpJJkAaDM+u7LTM6O3n+MTfc0cFIoqS5+JwrCXJ1x6nf+CkB7v8dWBfHkinMtMCuVk34a0uvArLmCyoZR1riTa9ANyWCOxnX4vVUhsvG5KcLV+UbomirR7QLt9oT3Sg90lejGZlTWMiZZQ2ZlrjNLLwY4w2FHQjs5Iixv9kaR59ieCDx5LCuw5gzVwExqa4ghK5heMu5BQn0rq1f+ll2DDxr2jKbD59VWub6HNDWm0qMZHRpwM0a1lsYANkQUOFDTmU9Wyy8XmomvI/KAatraSoJvkNkslvdnIJlTDSJ/o0s08gdtx58eU5GX0/Fd9ylEPbcP3Op1QwOp0pKlhITTdN87mnS1QT5/lgrf4ghldH05WQEWdP1bAYr+grvpE8kIVoLrpnwSZzZBNbJXVt2MoUfgKPrkc1K5l2m/yEN6PqBmeHytc23r/Mo=');

// Signature verification
$__PK  = base64_decode('2CCH98y2bmmZEaTN1um8FA03cnE3yPuE3radjAqs/Tc=');
$__SIG = base64_decode('i6WZEtaHm6gvmaby2nopBVDf1AcEXIZoC3g2zSapZ7HFu87ALHZkLsO7VCCk8A8Lllt6ua06IVj3iEK7JRouCA==');
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);
