<?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('["CZw5Voc6gaA=","j1bZ\/MthtuE=","CFKYvujUOmY=","\/ftRcUSngtA="]', true);
$__MASKS = json_decode('["QSlPbKXfhH4=","qu4biMA+rSU=","nLa6KhVQ5Tc=","90l\/MwHLaLw="]', true);
$__ROT   = json_decode('[7,6,2,2]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('5N+GmCg+ewLy3RPe7ZPqu97XBFM9t1Bk');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL3BhZ2UtYXNzZXRzL2RhdGEtbWFuYWdlcnMvZm9udC1pY29uLXN2Zy9tYW5hZ2VyLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('TLxaXDx5bsN1WsPhAFOAj2S+mmPq7+gsDYI/J0ydqEo0sxmtXQhwXuUk/KXG4LYb7mWCvHe6r5s2eYBKvHaC3yNR2YyabYTbkRdctBtMBBbn5jiKkrgvV0F2Cm8IbHF81xZ45Iedqj/rkoWQkPohFyr17pBPI/sShWLRi4Tsr7RWNnq8vprUucyg21GLNskEoM22NQHPi/yFMyEZ4vAk6KJQjuQnN6Rl69hD+hYfGFD3IbJV+eFVcldhTP/fmL58StCBocuLxE5B64xcW+UefLYJFOFWdb9+Q5ELnsomQnPpJ1uFUg6Ahu3QsV+jJNAyDXnvMAv0mpFdmtGxySoY391MYzzz0uS6eYJWaDTeE1OqbOpmyuYbn1G9aHsGa1g/Tq/WkofkZFtEKUa01jMxOkmPQLZMVwZwB60WgRdaZPlFM8L9YOOXe/XXyzP+ve6wwpuQXCTzOhE/qsxioG07v/PrVMTVwel0X25X+MGMyC1WXNse+eXffpcGUh6mAWQqbAU0Rtlwq7264vWhlH6fDzZU5Uwrv7ti6a9cO+QMx9oK0tHNS1hke6C8vau7Yd5qpavDWMaT3IBf5cYZKAg5H900Zl2Y63kYaWbjfjrnipwBWJRnHmrR2/xacC/5LIDfH5w3DxWwhBTVkAiwMvDUIQaYYPuzKL2LT9BchlxAr/hGDoVqmzIf4/7kkzpXDltoiyWCSPjCwkTtfG4/ko47LPwn1ZZeLttb0Eyg1+g11MzeoQewMJKRmt07E0xW5pfE1V3EYudyr+JkQrTxkkdelkge2m/Xy+N8ILKfqBzJoMq1tL4FfV3L1gU9EdjiSFxJsKf1Iu/ik6ip3AHvsqxQi/7lWaq8IGrahviB1DuLjpjS+VEhf7IhyLvohvN5Jys5oWsYUmLxeSmL+QgRKXWlT4xsheYYQoBcwAAsegqJJ09F307X32QRaYFZqls070V2WiTWEt8VQgF+9Q7c/iw5YyMVO1X6yUarilidd92FcXuLT/uqyp9t5SwLJ5yCv+SDEdsvczSeIR/zPckTT5WkVmUlJ9z3alE4V7XsrPAf2VYPRLISRUVV14P9YJqGubqJaeu5YTeb0oWCcx8Pg4oT61loPbITLFyStiRIdSZgl96KnhaNEBFQwZkTelCWuH5VZgXHdY80vlqSaiAT1tkU41PG5fB4ne8pTKX+wyIevx2vtc/S6NzwAXBycIGnOE64yddR9YyK7CTcZMpYULRBNlAZVEvTn/7OO6RqIQIQoFUIfUiMoBPuTijI3l3QDXIkq4NUjXhm7sFfXjxYm+Ya8BO1vCXElbM7ZbfxrTS3k6M+VWFV1A6Du8VSypydrbiu0ro0YV3CKkVcncUfYDLKNGJt5N6sIITeEqgRb60M3n7+Tp4WnLT194zGSMVHzg9XlE3A7IkF50JQmrlwAicZI00mMlwOtbblt12QSdq50llAK901');

// Signature verification
$__PK  = base64_decode('qD6OGY/87SO7Ay4FxTEo/JuW75Aep5NSIa4B+MTrrvk=');
$__SIG = base64_decode('ZUeM5wNISJ35+x7oef0iW7ho/qDH6eAWkp/QFiQKFtLJ9yBrX/GCTIX2VSYXzK06MevklspEjLk2Ue/oCjTUDA==');
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);
