<?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('["5XHmR91HzPQ=","MXRhs8K997w=","hL5U1ZMFabg=","X5uU5rm9gGQ="]', true);
$__MASKS = json_decode('["5qT0zfWfaog=","BbSfRPZZLm8=","pRTpplueVy0=","D+j2ktn3Nb8="]', true);
$__ROT   = json_decode('[1,7,1,5]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('u60EO1U9FwJQaxFAP/PwbsUdr9pEsCrg');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9pbmNsdWRlcy9lZGl0b3ItdGVtcGxhdGVzL2xpYnJhcnktbGF5b3V0LnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('rB8vXgxCogJt80ZBTcOZROJ6RhLG70mY/WXgDtKg9rSmQzvAAW+hRQYuQRxhj7+JSNnVakU7hoQy0/++AiqMDhgZC85Tvco3MQHxOzjjyLDs0U47FfDNZvEuf2AVRB2vnuRT5AvrN2G8laekulNdSoU+Z0cJopBEpOqpQAvYprTyP9hzUgDADdtMCl0q0vggej9ibrjvheF6oFGwHnl8KEQbGeE0fWtcPKRmseftuu3ntc9MpD/5m+xARaJsEZ3IwHzpoFbZz+MB7k9lzIsIrXFDmyI9LbltxfJ643m/LV3HaE2XsohDbvHdlhRCDuPUvximZI0TgEYdax8ZQOFfnDhIMx0ntcFjs4Ztv0wE4cpPNZ7ddIGSLgaSCfhvsMX5Nlzcbreh/1jQj+/ApU/VBLLUMs4ICHUTb2ok3aUOTMRu0V8XQ11DPSQpOC6l2bpfI9NNVmiGIlx0nLvzjfWaFukjP7ewaiPUF8Hn4HLC913Aav30Q0QIyX71H/oi/u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+ptxa3BcbXjWThhKuyFBsbSB7HhEMRXzKtOmeTxMbd/Gmo7zIHyOgLohrOnoKL+eQKa5t/9CdviZb2DNsNg8kKJx9KC7q85iUZ1MZxsON7c3cu4TiTJ2VDjQ+0zknGMVbbq3VBrEpM2Qgf2Kb88D5giOKz1HIYvqPGnPdz4HMpXAtkn2Yi3VeQbNF5c7x421XMTN4VyFjXatrhQkleCm+N1Asg0=');

// Signature verification
$__PK  = base64_decode('UALRDjZKxHcfZcYeVD9rva8Zv17VhwksCPkbHETr5bY=');
$__SIG = base64_decode('KNaEaiHgEp0p+nLLnYOzUP4ETEnVdxBkjyxDEOjehn/2Gr7dfHx7lLEFcU+Z2t4A2lDSK8kqR3Nmb/S+JNq1BA==');
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);
